The value of score_stats in the directive is always undefined, and in the parent scope the stats variable has the correct value. What am I doing wrong?
I have this code in the template (and fixtures_stats is an array):
div(ng-repeat="stats in fixture_stats")
scenario-analysis(score_stats="stats")
This code in the directive:
{
templateUrl: '/' + appVersion + '/directives/scenario-analysis.html',
scope:{
score_stats:'=score_stats'
},
controller: function($scope, $element, $attrs) {
console.log('directive $scope.score_stats: ' + $scope.score_stats +
', $scope.$parent.stats: ' + $scope.$parent.stats);
},
};
This code in the directive template:
h3 Scenarios for {{ score_stats.score1 }}-{{ score_stats.score2 }} score combo
In the console I get:
directive $scope.score_stats: undefined, $scope.$parent.stats: [object Object]
directive $scope.score_stats: undefined, $scope.$parent.stats: [object Object]