0

In controller using filterFilter to filter data in json object like below

self.InfoAlerts = filterFilter(self.alerts, {Type:'Info'});

Which returns json object only if Type is Info. Is it possible to compare date and return object if the date value from json object is less than 2 weeks?

Refered: https://docs.angularjs.org/guide/filter

1 Answer 1

1

No,you need to use a custom filter for this.

The default filter in angular is just a simple text filter and is very similar to the Arra.filter() of javascript.

Array.filter()

You can refer to the same docs for writing that custom filter requirement. Also, in your use case I don't see a need to use apply the filter in controller and you can use it in HTML.

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

1 Comment

Thanks for the reply and already used the custom filter at many places in our project. I just wanted if it is possible using filterFilter.

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.