I am new to angularjs.
I want to use the data in filter which i have in my controller.
Is there any specific way to do dat?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The best way is to pass the data as an additional parameter:
<span>{{ value | filter:anotherValue }}</span>. This way, thevalueandanotherValueare controller’s scope variables. Thefilteris your custom filter. The filter will receive theanotherValuecontent as the second parameter, and a change to it will reapply the filter. Here is a fiddle.Another solution, if you it’s not proper to pass the information along all times you write the filter, is to use a shared service between them. You can then expose the properties from the controller and use in the filter. Another fiddle here (just change the input text value).
Basically, this is what happens on the fiddle: