mercredi 1 avril 2015

Why isn't my child directive able to read from the parent scope?


Vote count:

0




I'm just fiddling around to practice with Angular...I was making a child directive with isolate scope configured such that it would automatically get updates from the parent scope but you would have to manually and deliberately send any updates in the child BACK to the parent scope.


On the jsfiddle it works perfectly but on the plunk it doesn't work, even though the code is the same. It's just driving me up the wall. (I couldn't get it to work in Plunk and then switched to jsfiddle and it worked.) What am I missing in the plunk?


http://ift.tt/1EEST6s


http://ift.tt/1F37YKb


Simple JS code:



var myModule = angular.module('myModule', [])
.directive('myComponent', function () {
return {
restrict: 'A',
scope: {
inward: '@',
outward: '&'
}
};
})
.controller('MyCtrl', ['$scope', function ($scope) {
$scope.value = 'Hello!';
$scope.updateValue = function (newValue) {
$scope.value = newValue;
}
}]);


asked 1 min ago







Why isn't my child directive able to read from the parent scope?

Aucun commentaire:

Enregistrer un commentaire