how to show long text with more button using angular?

前端 未结 5 834
执笔经年
执笔经年 2021-02-19 08:22

i have long text like that :-

\"5 Simple Steps to Improve Patient Experience5 Simple Steps to Improve Patient Experience5 Simple Steps to Improve Patient Experience5 Si

5条回答
  •  借酒劲吻你
    2021-02-19 09:25

    Yes, this is totally possible with AngularJS -- but most of the solution is actually CSS.

    You'll be able to do this mostly through CSS. First, HTML/CSS doesn't really have a concept for how many lines a bunch of text is taking up. You can get the behavior you want by setting the height of a container element and the line-height of your text on the CSS line-height. For your default state, set the height based on two times your line height and set the overflow to hidden. Then you just need have your button conditionally apply a class that expands the height of the container and sets the overflow to visible: