Commit 5f80a473 authored by Robert Knight's avatar Robert Knight

Simplify <excerpt> link function

Wrapping the init logic in `scope.$evalAsync()` used to be
necessary so that any code touching the '.excerpt' element
ran after that element had been transcluded into the DOM.

However, this is no longer necessary since all the init logic
now runs inside a `scope.$watch()` callback, which is invoked
after `ngIf` has inserted the '.excerpt' element into the DOM.
parent c7687b68
......@@ -69,7 +69,6 @@ function excerpt($timeout) {
return contentElem.scrollHeight > ctrl.collapsedHeight;
};
scope.$evalAsync(function () {
scope.$watch('vm.enabled()', function (isEnabled) {
if (isEnabled) {
contentElem = elem[0].querySelector('.excerpt');
......@@ -101,7 +100,6 @@ function excerpt($timeout) {
ctrl.onCollapsibleChanged({collapsible: ctrl.overflowing()});
}
});
});
},
scope: {
/** Whether or not truncation should be enabled */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment