Limit string to fixed length and open remaining string in modal popup (Angularjs) -
i have limit string length in label if exceeds 25 characters , display entire string in modal popup making hyperlink. this: if string "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz", should displayed as:
label: abcdefghijklmnopqrstuvwxy
i gave hyperlink www.google.com in example want modal popup should open entire text.
i used directive limit length: http://itsolutionstuff.com/post/angularjs-how-to-limit-string-length-using-filterexample.html.
var app = angular.module('myapp', []); app.filter('limitchar', function () { return function (content, length, tail) { if (isnan(length)) length = 25; if (tail === undefined) tail = "..."; if (content.length <= length || content.length - tail.length <= length) { return content; } else { return string(content).substring(0, length-tail.length) + tail; } }; });
`
i trying make "tail" hyperlink open modal popup can display entire text. tried along these lines:
if (tail === undefined) { $sce.myhtml = $sce.trustashtml('<a href="#" ng-click="showfullword(content)">(more)</a>'); tail = $sce.myhtml; }
my function is
$scope.showfullword = function (content) { $('#displaymodal').modal('show'); $scope.value = content; }
which not working. can give me idea how should proceed this.
Comments
Post a Comment