model.data contains the following:
{
"name": "Jamie",
"age": 25
}
I have a directive that looks like:
<my-directive data="model.data"></my-directive>
I have defined the directive as follows:
app.directive('myDirective', function(){
return {
restrict: 'E',
scope: {
data: '='
},
templateUrl: 'grid.html',
controller: function($scope) {
console.log($scope);
console.log($scope.data);
}
}
}
Problem is that console.log($scope) returns the value in $scope. I can see it containing data:
{
$$asyncQueue: Array[0],
$$childHead: null,
...
...
data: Array[1]
}
However, console.log($scope.data) returns undefined. Any clue why?
model.datacreatedmodel.datais having the values for certain. In the page containing the directive, if I display the value of{{model.data}}, then I can see it correctly.http.get()call, inside thehttp.get()success handler, and inside the directive controller and see the order of execution