I have written a angularjs directive. in this directive\'s template I have added an ngIf directive and within it I display an input that is bound to my directive\'s scope.>
Define foo as an object with properties. This all has to do with javascript prototypical inheritance. See your modified jsfiddle.
angular.module('testApp', [])
.controller('MyController',function($scope){
$scope.foo = {bool: true};
})
.directive('testDir', function () {
return {
restrict: 'A',
template: '
changing me does not update the other inputs because i am in an ngIf if in ngShow all works just fine',
link: function (scope, elem, attrs) {
scope.foo.x = "bar";
scope.foo.bool = true;
}
}
});
For a detailed info see this video.