javascript - angular custom filter only on button click -


i new angular custom filters , wondering if there way apply filters ng-repeat when button clicked.

here jsfiddle example :

http://jsfiddle.net/toddmotto/53xuk/

<div ng-app="app">     <div ng-controller="personctrl person">         <input type="text" ng-model="letter" placeholder="enter letter filter">         <ul>             <li ng-repeat="friend in person.friends | startswithletter:letter">                 {{ friend }}             </li>         </ul>     </div> </div> 

sometings this:

function mycontroller(startswithletterfilter) {     //retrieve person object             this.friends = person.friends;      this.onclick = function() {         this.friends = startswithletterfilter(person.friends, myletter);     } } 

bind repeater friends property , not directed person.friends can manipulate array responding on events


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -