Angularjs toggle div visibility

前端 未结 3 1028
情话喂你
情话喂你 2021-02-02 16:31

I am trying to toggle a div text on click of a button. I tried taking a scope variable and toggeling classname based on the variable. Where am I making the mistake here



        
3条回答
  •  灰色年华
    2021-02-02 17:02

    I have changed your directive..

    html

        
    
    hello test

    Controller

    function ctrl($scope) {    
    
        $scope.toggle = function () {
          $scope.state = !$scope.state;
        }; }
    

    see complete code here http://jsfiddle.net/nw5ndzrt/345/

提交回复
热议问题