According to the answer in Is it Possible to Update Parent Scope from Angular Directive with scope: true? it won't work to overwrite a primitive value in the parent scope from a directive since the reference is lost.
However, in this example that's exactly what's happening and the reference is kept:
http://adamalbrecht.com/2013/12/12/creating-a-simple-modal-dialog-directive-in-angular-js/
http://output.jsbin.com/neluxejuwi
Directive JS:
scope: {
show: '='
},
[...]
link: function(scope, element, attrs) {
[...]
scope.hideModal = function() {
scope.show = false;
};
},
HTML:
<modal-dialog show='modalShown' width='750px' height='90%'>
<p>Modal Content Goes here<p>
</modal-dialog>
How is this possible?