2

Now solved Plunker: http://plnkr.co/edit/oimkGE83UgPX22E7NXl2?p=preview

When you have objects nested like this:

$scope.customer = {
  roomsclean1: {
    "price": 27,
    "title": "Room(s) to clean",
    "area": "6"
  },
  roomsprotect1: {
    "price": 62,
    "title": "Room(s) to protect",
    "area": "0"
  }

}

What is the best way to iterate over each item and return each proptery them by weather or not the nested key area is not zero?

obviously something like {{customer | filter:{area : "!0"} }} didn't work.

1
  • 1
    Please consider editing your question to remove the "answer" portions from it. If you've got an answer to your question, feel encouraged to post it as an answer instead of editing it into your question. Commented May 24, 2015 at 3:26

1 Answer 1

2

filter accepts filtering method as parameter.

You should do : {{customer | filter:myFilter }}

And in your controller :

$scope.myFilter = function(element) {
    return element.area !== "0";
}

Your structure is strange though. You are using an object where you obviously should use a simple list.

Sign up to request clarification or add additional context in comments.

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.