In my index.html file, there is an ng-show attribute on a div that determines which header to display based on user clearances. These clearances are stored in $scope.user.clearance as an array of objects with the 'clearance' key. The structure of $scope.user.clearance is as follows:
[
{
'clearance':string
}
]
The directive that is causing a parse error is:
<div ng-show = "user.clearance &&
user.clearance.filter(function(e) { return e['clearance'] === 'SUPERADMIN'; }).length > 0"
ng-include="'/partials/components/superadmin-header.html'">
</div>
The expression in question is:
user.clearance && user.clearance.filter(function(e) {
return e['clearance'] === 'SUPERADMIN';
}).length > 0
This expression works perfectly fine in jsfiddle: http://jsfiddle.net/6frqzwee/2/
Any thoughts on why Angular might be struggling with this?