javascript - AngularJS ng-repeat certain filter expressions -
here's have:
<div data-ng-if="hasselectedcompany"> <tbody data-ng-repeat="driver in result.applications | filter: { name: selectedapplication } track $index"> </div> <div data-ng-if="hasselectedsupportedcompany"> <tbody data-ng-repeat="driver in result.applications | filter: { name: selectedsupportedapplication } track $index"> </div>
and know can improved, i'm not sure how. it's not working right now. first expression not working when have both of these in there. when remove second expression completely, first 1 starts work. second 1 works both of them in.
what's alternative way accomplish this?
thanks!
both filters not work because both referring same result.applications
.
you need separate filtered array of both assigning different variable applicationsforcompany
hasselectedcompany
div & applicationsforsupportedcompany
hasselectedsupportedcompany
div
markup
<div data-ng-if="hasselectedcompany"> <tbody data-ng-repeat="driver in applicationsforcompany = (result.applications | filter: { name: selectedapplication }) track $index"> </div> <div data-ng-if="hasselectedsupportedcompany"> <tbody data-ng-repeat="driver in applicationsforsupportedcompany = (result.applications | filter: { name: selectedsupportedapplication }) track $index"> </div>
Comments
Post a Comment