I have a list of tags built from a JSON object...
<div ng-repeat="comedian in comedians.details | orderBy: 'tag' | unique: 'tag'">
<span ng-click="search = { tag: comedian.tag }">{{ comedian.tag }}</span>
</div>
And a list of images built from the same object...
<div ng-repeat="comedian in comedians.details | orderBy: 'name' | filter:search:strict">
<img width="50" src="{{ comedian.image }}" alt="{{ comedian.name }}">
</div>
Both lists build as expected. But the click event is not firing to filter the images. If I manually build the list of tags like below the click event works...
<span ng-click="search = { tag: 'Character'}">Character</span>
<span ng-click="search = { tag: 'Sitcom'}">Sitcom</span>
But inside the ng-repeat they do not. Let me know if you need any other details! Thanks
Like @Cherniv suggested in the first comment: use $parent.search
so assing to the parent scope.
I'm mostly adding this as an answer so it can be accepted, since this question looks pretty unanswered at first sight, while it's actually solved.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.