I am facing an issue with the following directive
var chartDir = function () {
return {
scope: {
stat: '='
},
link: function (scope, element, attr) {
console.log(scope);
return;
}
}
HTML
<svg chart stat="stat"></svg>
When I check the console, I can see that the scope has a property called stat
which is an array and not empty.
Here is the screenshot...
https://i.sstatic.net/8AdiH.png
However, when I try to access scope.stat
using console.log( scope.stat )
, it returns just undefined
. The same directive works fine in another chart, so I'm confused as to why I can't access scope.stat
here.
UPD: more HTML
<div class="chart-container container" ng-show="statLoaded">
<div class="text col">
<div class="item" ng-repeat="item in stat | limitTo: middleIndex">
<div class="color">
<div class="sample" color-sample color="item.color"></div>
</div>
<div class="amount">
{{ item.amount }}
</div>
<div class="text">
{{ item.text }}
</div>
</div>
</div>
<div class="col">
<svg chart stat="stat"></svg>
</div>
...
I can see all items and the "color-sample" directive works perfectly. So, 'stat' is definitely loaded. I'm just unsure why the 'color-sample' directive works while the 'chart' directive doesn't.