Create read more link in AngularJS

前端 未结 4 1151
后悔当初
后悔当初 2020-12-28 21:58

I want to create a link with read more text. if there are more than 3 lines in a paragraph this link should be visible and clicking on this it show display all the lines.

4条回答
  •  自闭症患者
    2020-12-28 22:36

    For read more , you can use angular limitTo filter for limiting your paragraph to character's length instead of limiting paragraph to line numbers .

    You can use something like this :

    in html

    {{myString | limitTo:numLimit}}

    in controller

    $scope.numLimit=200;
    $scope.readMore=function(){
    $scope.numLimit=10000;
    };
    

提交回复
热议问题