This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 22nd, 2013  |  syntax: JavaScript  |  size: 1.17 KB  |  views: 38  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. .config(function($routeProvider) {
  2.   $routeProvider
  3.     .when('/:feed_term', {
  4.       templateUrl: 'views/feedlist.html',
  5.       controller: 'searchtermCtrl'
  6.     })
  7.     .otherwise({redirectTo: '/term/'});
  8. })
  9.  
  10. /* CONTROLLERS */
  11. // Navigation - Controller //
  12. .controller('NavigationCtrl', function ($scope, $routeParams) {
  13.   $scope.activeTab = $routeParams.feedterm // Trying to target the navigation within the Navigation Controller, when it is not in ng-view
  14. })
  15.  
  16. // Search Term - Controller
  17. .controller('searchtermCtrl', function($scope, Feed, $routeParams){
  18.   $scope.feed = Feed.query({ feed : $routeParams.feed_term });
  19.   $scope.activeTab = $routeParams.feed_term  // Works with added classes for specified items for active tab within ng-view
  20. })
  21.  
  22.  
  23. ***HTML***
  24.  
  25. <!-- Header -->
  26. <div ng-controller="NavigationCtrl">
  27.   <ul class="nav navbar-nav">
  28.     <li ng-class="{active: activeTab == 'feedterm_1'}">
  29.       <a href="#/feedterm_1">Feed 1</a>
  30.     </li>
  31.     <li ng-class="{active: activeTab == 'feedterm_2'}">
  32.       <a href="#/feedterm_2">Feed 2</a>
  33.     </li>
  34.   </ul>
  35. </div>
  36. <!-- END - Header -->
  37.  
  38. <-- Body -->
  39. <div id="wrapper" ng-view></div>
  40. <!-- End - Body
clone this paste RAW Paste Data