Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .config(function($routeProvider) {
- $routeProvider
- .when('/:feed_term', {
- templateUrl: 'views/feedlist.html',
- controller: 'searchtermCtrl'
- })
- .otherwise({redirectTo: '/term/'});
- })
- /* CONTROLLERS */
- // Navigation - Controller //
- .controller('NavigationCtrl', function ($scope, $routeParams) {
- $scope.activeTab = $routeParams.feedterm // Trying to target the navigation within the Navigation Controller, when it is not in ng-view
- })
- // Search Term - Controller
- .controller('searchtermCtrl', function($scope, Feed, $routeParams){
- $scope.feed = Feed.query({ feed : $routeParams.feed_term });
- $scope.activeTab = $routeParams.feed_term // Works with added classes for specified items for active tab within ng-view
- })
- ***HTML***
- <!-- Header -->
- <div ng-controller="NavigationCtrl">
- <ul class="nav navbar-nav">
- <li ng-class="{active: activeTab == 'feedterm_1'}">
- <a href="#/feedterm_1">Feed 1</a>
- </li>
- <li ng-class="{active: activeTab == 'feedterm_2'}">
- <a href="#/feedterm_2">Feed 2</a>
- </li>
- </ul>
- </div>
- <!-- END - Header -->
- <-- Body -->
- <div id="wrapper" ng-view></div>
- <!-- End - Body
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement