I know what you mean, and I agree with you. It would be nice if Angular provided a convenient structure for a directive to configure two-way model binding between the parent sphere variable and the child variable and still support prototype region inheritance.
To achieve the same effect as in the selected area:
scope = {'varname':'=attrname'}
you can configure the binding of a two-way model in your directory link:
scope: true,
link: function(scope, element, attr) {
scope.$parent.$watch(attr.attrname, function(newVal) {
scope.varname = newVal;
});
scope.$watch('varname', function(newVal) {
scope.$parent[attr.attrname] = newVal;
});
}
source
share