Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/angular-ellipsis.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ angular.module('dibari.angular-ellipsis', [])
}

if (_isDefined(attributes.ellipsisFallbackFontSize) && isOverflowed(element)) {
element.css('font-size',attributes.ellipsisFallbackFontSize);
element.css('font-size',attributes.ellipsisFallbackFontSize);
}

// If text has overflow
Expand All @@ -130,6 +130,9 @@ angular.module('dibari.angular-ellipsis', [])
//Set data-overflow on element for targeting
element.attr('data-overflowed', 'true');

// Set variable for full text retrieval in parent scope (like in bootstrap popover, title...)
scope.$parent.$overflowFull = binding;

// Set complete text and remove one word at a time, until there is no overflow
for (; i < bindArrayStartingLength; i++) {
var current = bindArray.pop();
Expand Down Expand Up @@ -168,7 +171,9 @@ angular.module('dibari.angular-ellipsis', [])
}
}
else{
// remove set data in case text is no longer overflowing
element.attr('data-overflowed', 'false');
scope.$parent.$overflowFull = '';
}
}
}
Expand Down Expand Up @@ -221,7 +226,7 @@ angular.module('dibari.angular-ellipsis', [])
/**
* Execute ellipsis truncate when element becomes visible
*/
scope.$watch(function() { return element[0].offsetWidth != 0 && element[0].offsetHeight != 0 }, function() {
scope.$watch(function() { return element[0].offsetWidth !== 0 && element[0].offsetHeight !== 0 }, function() {
asyncDigestDebounced.add(buildEllipsis);
});

Expand Down
2 changes: 1 addition & 1 deletion src/angular-ellipsis.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.