Anyone? :)
On Thursday, November 26, 2015 at 11:37:01 AM UTC+1, Jérémy Halldén wrote:
>
> Hi,
>
> This is my markup using the built in filter "filter".
>
> <div data-ng-repeat="item in vm.items | filter: vm.filterMethod"></div>
>
> This doesn't work well with bindToController/controllerAs since I have to
> manually create a closure for the filterMethod in order to make it work, as
> follows:
>
> (pseudo)
> controller{
> public items = ["a", "b", "c"];
>
> ctor(){
> this.filterMethod = (item) => this.filterMethodInternal(item);
> }
>
> public filterMethodInternal(item){
> // filter code here
> }
>
> public otherMethodThatWorksFineForClickEtc(eventArgs){ }
> }
>
> An option would be to have the item argument available in the scope of the
> filterMethod, as with $event.
>
> What is the recommended approach here?
>
> Best Regards
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.