If I have the following controllers:
function parent($scope, service) {
$scope.a = 'foo';
$scope.save = function() {
service.save({
a: $scope.a,
b: $scope.b
});
}
}
function child($scope) {
$scope.b = 'bar';
}
What's the proper way to let parent
read b
out of child
? If it's necessary to define b
in parent
, wouldn't that make it semantically incorrect assuming that b
is a property that describes something related to child
and not parent
?
Update: Thinking further about it, if more than one child had b
it would create a conflict for parent
on which b
to retrieve. My question remains, what's the proper way to access b
from parent
?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…