change the text apperence using angular js

前端 未结 2 714
萌比男神i
萌比男神i 2021-02-09 13:53

am new to angular js using this ihave to perform following operation i have a text name bob.and a button like bold and italic while cliking on the bold button i want to bold the

2条回答
  •  自闭症患者
    2021-02-09 14:42

    Try to use the directive ng-class. Create two boolean, and set values when you click on the buttons. When the boolean is changing, the ng-class is updating.

    Live demo

    HTML:


    {{rootFolders}}

    CSS:

    .bold {
      font-weight: bold
    }
    
    .italic{
      font-style : italic;
    }
    

    Reference

    • AngularJS ngClass
    • AngularJS ngInit

提交回复
热议问题