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
I have changed your directive..
html
test hello test
Controller
function ctrl($scope) { $scope.toggle = function () { $scope.state = !$scope.state; }; }
see complete code here http://jsfiddle.net/nw5ndzrt/345/