1

I am trying to filter an array (list) of repeated objects, based on the value of one of the property. However I keep getting [filter: not array] error. Screenshot of the error: angular error message

I have also tried adding this angular toArrayFIlter injector https://github.com/petebacondarwin/angular-toArrayFilter however, the error still pops out.

Any help is much appreciated!

My array:

var orders = [
{
  "assignedBy": "system",
  "serviceDate":"2017-11-13",
  "serviceStartTime":"04:00 PM"
},
{
  "assignedBy": "system",
  "serviceDate":"2017-11-13",
  "serviceStartTime":"07:00 AM"
}];

html

<ul ng-repeat="task in orders  track by $index | filter: { serviceStartTime: '04:00 PM' }">  
  <li >
    <p>{{task.serviceDate}}</p>
    <p>{{task.serviceStartTime}}</p>
  </li>
</ul>
1
  • Remove track by $index. Commented Nov 12, 2017 at 19:14

1 Answer 1

1

You'll need to filter the array before iterating it, like this:

<ul ng-repeat="task in (orders | filter: { serviceStartTime: '04:00 PM' }) track by $index ">  
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.