change the text apperence using angular js

前端 未结 2 661
萌比男神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:43

    here is a working fiddle fiddle

    HTML:

    {{rootFolders}}
    rootFolders={{rootFolders}}

    JS:

    var app = angular.module('myApp',[]);
    
    function MyCtrl($scope) {
    $scope.class=""    
        $scope.chiliSpicy=function(){
        $scope.class="text_type_bold"
        }
           $scope.jalapenoSpicy=function(){
        $scope.class="text_type_italic"
        }
    }
    

    CSS:

    .text_type_bold{
        font-style:none;
     font-weight:bold;
    }
    
    .text_type_italic{
        font-weight:normal;
     font-style:italic;
    }
    

提交回复
热议问题