Skip to content

Instantly share code, notes, and snippets.

@BryanWilhite
Created September 11, 2015 00:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BryanWilhite/0b0484102980acf5ccb2 to your computer and use it in GitHub Desktop.
Save BryanWilhite/0b0484102980acf5ccb2 to your computer and use it in GitHub Desktop.
Using ngClass, $parent, $first and the Client View Model with ngRepeat
isIndexSubsetHeaderSelected: function (subset, isFirst) {
if (!this.routeIndexSet) {
return false;
}
if (!this.routeIndexSubset) {
return isFirst;
};
return (this.routeIndexSubset === subset);
},
<div data-ng-if="!clientVM.isSplash" class="col-md-4 col-sm-4 col-xs-10 IndexSubset">
<h3 data-ng-class="{selected:$parent.clientVM.isIndexSubsetHeaderSelected(i.id, $first)}" data-ng-repeat="i in clientVM.currrentIndexMeta">
<a
href="{{i.url}}"
data-ng-if="i.url">{{i.text}}</a>
<a
href="#/index/{{$parent.clientVM.routeIndexSet}}/{{i.id}}"
data-ng-if="!i.url">{{i.text}}</a>
</h3>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment