ng-repeat with a filter on a custom directive issue

180 views
Skip to first unread message

Shairez

unread,
Feb 28, 2013, 7:33:39 AM2/28/13
to ang...@googlegroups.com
Hi Guys,

I tried to use a filter inside a ng-repeat, but did it in my own custom directive.

Try entering the word "bar" in the next plunkr - 



You are suppose to get only 1 result, but it gets messy...

It is related to the <thumbnail> directive, without it it works as expected, and also when I do the ng-repeat on a wrapper div that wraps the <thumbnail>

Anyone knows what am I missing?


Thanks,
Shai

Clint Checketts

unread,
Feb 28, 2013, 9:12:19 AM2/28/13
to ang...@googlegroups.com
This is a bug in Angular when using templateUrl.

2 solutions:
1- Use a template inline (or using <script>) to preload the template
2- Put the ng-repeat on a wrapping element http://plnkr.co/edit/URfBMUclNPzTYN89iV7k?p=preview



--
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 angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Shairez

unread,
Feb 28, 2013, 11:56:57 AM2/28/13
to ang...@googlegroups.com
Thanks a lot Clint!

Thought I was doing something wrong, good to know it's a bug :)

Danny Eck

unread,
Sep 18, 2013, 11:53:31 AM9/18/13
to ang...@googlegroups.com
I believe this is issue #2151 https://github.com/angular/angular.js/issues/2151

I have fallen into this trap twice now (shame on me) using the exact pattern in Shairez's plunk.

<myDirective ng-repeat="foo in foos | filter:myFilter"></myDirective>

I've been using Clint's 2nd suggestion.
Reply all
Reply to author
Forward
0 new messages