- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2018 09:37 AM
Just to add to this, if you want to get the page id or other parameters when the page changes you can look for the $locationChangeSuccess event and set the current page. The $scope.page.id does not update when the page changes. This is useful when you are looking to highlight menu items or header links. The header and footer are not re-run on page change, and you have to look for a page change event.
In the Client controller:
function($scope, $location) {
var c = this;
c.current_page = $scope.page.id; //set the current page when first loaded
$scope.$on.('$locationChangeSuccess', function() {
c.current_page = $location.search().id;
});
}
Example HTML:
<ul>
<li ng-class="{'active': c.current_page == 'my_incidents'}">
<a href="?id=my_incidents'">My Incidents</a>
</li>
</ul>