I have a directive:
app.directive('hideButton', function () {
return {
restrict: "A",
scope: {
init: '='
},
replace : true,
link: function(scope, elem, attrs) {
if(scope.init) {
elem.css('display', 'none');
scope.init = false;
}
elem.on('click', function() {
elem.css('display', 'none');
});
}
}
});
Here, init
is a controller variable.
Now in the directive I have set scope.init = false
but the change is not reflected into controller.