我有一个奇怪的问题,用 `dotdotdot1 指令很难重现:
.directive('dotdotdot', ['$timeout', function($timeout) {
return {
restrict: 'A',
link: function(scope, element) {
scope.$evalAsync(function () {
element.dotdotdot({
watch: true,
wrap: 'letter'
});
});
angular.element('.modal').on('shown.bs.modal', function() {
angular.element('.modal-nonedit-dotdotdot').dotdotdot({
watch: true,
wrap: 'letter'
});
});
}
};
}]);
但有时它在从服务器获取我的范围变量之前被调用,所以它的行为真的很奇怪......
而且我有想法必须使用超时...
但我该如何使用它?因为如果我设置
$timeout(function() {
element.dotdotdot({
watch: true,
wrap: 'letter'
});
});
比它也以奇怪的方式工作......
我怎样才能正确设置指令的执行?