I try to pass a value from parent scope to my directive. To its isolated scope. It works ok if I pass values as argument to my directive. But id does not work for parent scope.
Here is how I use it:
<div ng-init="event='hello'"> <!-- this is parent scope -->
<input31></input31>
</div>
Here is the directive itself.
directives.directive("input31", [function() {
return {
restrict: 'E',
template:"<div> <input type='text' ng-model='data' /> {{data}} </div>",
replace: true,
scope : { //defining isolated scope
event: "=event" // pushing value to isolated directive scope
}
}
}]);
In the end I'm expecting to have event var filled by 'hello' value but I have null
update
I thought that it's possible to select/filter what to use from parent scope, kind of filter. Like if in parent scope I have a,b,c then specifying 'scope {a: '=a'}' I could transfer only 'a' from parent scope. But as I understand this not the way to go. this work only if passing values as directive arguments (?)