I am using angular one-way-binding from controller to directive. When i update value in directive, it should not update the value in controller. But it is working as two-way binding. can some one find my error.
angular.module("myApp",[])
.directive("myDirective",['$timeout', function ($timeout) {
return {
scope: {myValue: "&myAttribute"},
template: '<input type="text" ng-model="myValue().name">',
link: function (scope, iElm, iAttrs) {
var x = scope.myValue();
console.log(x);
$timeout(function(){
x.name= "directive";
},4000);
}
};
}]).controller("myController", function ($scope, $timeout) {
$scope.someObject = {name: "test"};
$timeout(function(){
$scope.someObject.name= "controller";
},2000);
});