Reputation: 9542
angular.module('harbinger').
directive('dossierList', function () {
return {
restrict:"EAC",
template:'<div class="Dossier-details" data-ng-repeat="d in model.dossier | filter:{status:"POI"}">'+
'<p>'+
'<strong>'+'Dossier ID'+'</strong>:'+
'<small>'+'{{ d.title }}'+'</small>'+
'</p>'+
'</div>',
etc........
I want to filter the array using status ,i used filter:{status:"POI"}
,but it throwing error
My json
[
{
"id": "1",
"status": "POI",
"title": "West Nile virus - US",
"dossierId": "000455"
},
{
"id": "2",
"status": "I",
"title": "influenza",
"dossierId": "000455"
},
{
"id": "4",
"status": "P",
"title": "corona virus",
"dossierId": "000455"
}
]
Upvotes: 0
Views: 125
Reputation: 3566
it will be easier here than in the comments, but your issue is just linked to an escaping problem
you can see your directive here, working : http://jsfiddle.net/DotDotDot/S2KhB/1/
the issue :
data-ng-repeat="d in model.dossier | filter:{status:"POI"}"
ou can see that you used " everywhere which was understood by you browser as
data-ng-repeat="d in model.dossier | filter:{status:" +another attribute ignored
so you had an error, the only thing I did was using escaped '
data-ng-repeat="d in data | filter:{status:\'POI\'}"
and it seems to work =)
Have fun
Upvotes: 2