model.data contains the following:
{ "name": "Jamie", "age": 25 }
I have a directive that looks like this:
<my-directive data="model.data"></my-directive>
I 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); } } }
The problem is that console.log($scope) returns a value in $ scope. I see this with data:
{ $$asyncQueue: Array[0], $$childHead: null, ... ... data: Array[1] }
However, console.log($scope.data) returns undefined . Any clue why?
source share