I\'m new to angularJS and maybe have written something bad...
but how could i right implement this plugin: https://github.com/BeSite/jQuery.dotdotdot
on my t
Template
-
{{movie.title}}
Directive
(function () {
'use strict';
angular.module('dma.common').directive('dmaDotDotDot', [
function dmaDotDotDot() {
return {
restrict: 'A',
link: function (scope, element, attrs) {
scope.$evalAsync(function () {
element.dotdotdot({
wrap: 'letter'
});
});
}
};
}
]);
}());
I tested ng-bind and it doesn't seem to work properly for me. ng-bind hides the content, then fires the dotdotdot(), then compiles the content (Which doesn't work).
Though this should work—Much better solution than scope.$watch. And I believe it preforms more consistently than the solutions listed without $evalAsync().
See https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$evalAsync for more information regarding when it fires.