I have an AngularJS app, and need to display object properties that end with a G on one line, and ones without the G on another:
<div class="col"><strong>Grass</strong>
<span ng-repeat="(key, value) in player.ranking" ng-
filter="value.endsWith('G') = true">
<span class="text-success">{{key.replace('Pool', '')}} {{value}}<span ng-
if="!$last">, </span></span></span>
</div>
<div class="col"><strong>Beach:</strong>
<span ng-repeat="(key, value) in player.ranking" ng-
filter="!value.endsWith('G')">
<span class="text-warning">{{key.replace('Pool', '')}} {{value}}<span ng-
if="!$last">, </span></span>
</span>
</div>
What I have isn't working. Can someone please help me?
I am not sure where you got the
ng-filterattribute from. However, this is not a valid filter forng-repeatin AngularJS.The correct format is:
In your HTML it looks something like:
So the quickest solution to your problem is to use a filter function
html
JS