I make a simple directive .I have two button on that directive .I am able to get click event of that button .But I want to add class on that .
I have one class
.red {
background-color: red;
}
I want to add this class whenever button is click ..
- Intially login button have red class .When logout button is click it apply on logout button and remove from login button
or again if I click on login button it apply on login button and remove from logout button ..
I do like that
angular.module('app', ['ui.router']).directive('tm', function() {
return {
restrict: 'E',
templateUrl: 'login.html',
scope: {
login: "&",
logout: '&'
},
controller: 'f',
controllerAs: 'vm'
};
})
here is code http://plnkr.co/edit/Q1e8u0okOa4looLcb2YO?p=preview
ngClass. docs.angularjs.org/api/ng/directive/ngClass