javascript - using ng-class in angular js -
i trying implement ng-class directive in angular , while doing bit stuck on it..
the below code snippet:-
<button ng-class="{discover_premium btn btn-lg:userlogin ==2,discover_connect_btn btn btn-lg:userlogin ==3}" >{{userlogin}}</button>
i using following in controller:-
var currentmember= currentuserdata.query(); currentmember.$promise.then(function(response){ $scope.memberprofile = response.login_member_details; var memberprofile = $scope.memberprofile; if ($scope.memberprofile.type =="free") { $scope.userlogin = 2 } else { $scope.userlogin = 3 } })
so want implement different class different condition..
please me out newbie..
thanks lot
simply wrap class names single quotes
<button ng-class="{'discover_premium btn btn-lg': userlogin == 2, 'discover_connect_btn btn btn-lg': userlogin == 3}" >{{userlogin}}</button>
Comments
Post a Comment