I have a two-way data binding that is not altering the value of the variable sent to the directive.
My directive watches for a trigger and gives focus to the associa
Directive create a scope. when you pass parameter to scope, object passed by reference and boolean (and number, string...) passed by value.
For example:
function changeToFalse(bool) {
bool= false;
console.log(bool); // false
}
function changeObjToFalse(obj) {
obj.bool= false;
console.log(obj.bool); // false
}
var obj = {bool : true};
changeToFalse(obj.bool);
console.log(obj.bool); // true
changeObjToFalse(obj);
console.log(obj.bool); // false
See also same question - two way binding not working with ng-repeat.