Passing function with parameters in ng-class to get the class

后端 未结 3 1983
闹比i
闹比i 2020-12-11 00:45

I am trying to use ng-class of angular. I have a function which returns the class based on the parameters we send it. How can i achieve it ?

Here\'s what i tried:

3条回答
  •  自闭症患者
    2020-12-11 00:56

    Update

    You can achieve this by like this

    myapp.controller('myCtrl', function ($scope) {
    
    
          $scope.getClass = function(a){
                return a;
          } 
    });
    

    and in template

        
    text

    See My full working updated fiddle

提交回复
热议问题