0

I have a json data like this:

{
"body":"message1",
"date":"2015-..",
"folder":{
  "itemId":"3",
  "name":"type1"
},
"subject":"subject"
}

I am trying to filter based on folder.name. this is my html code.

<div ng-repeat="msg in messages |filter:{folder.name:'type1'}">

but I am getting syntax error. how to filter nested json data in html view.

2 Answers 2

0

try this

<div ng-repeat="msg in messages |filter:{folder: {name:'type1'}}">
Sign up to request clarification or add additional context in comments.

Comments

0

Couple of things. Ng-Repeat is expecting a collection(array) not an object, like this:

[{
   body: "message1",
   date: "2015-..",
   folder: {
        itemId: "3",
        name: "type1"
   },
   subject: "subject"
 }]

Then your html should look like this:

  <div ng-repeat="msg in messages | filter: {folder:{name:'type1'}}">

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.