nav-controller.js 538B

1234567891011121314151617181920212223
  1. angular.module('navController', [])
  2. .controller('nav', function($scope, $state) {
  3. $scope.title = 'WWII Shipwrecks';
  4. // returns true if the current router url matches the passed in url
  5. // so views can set 'active' on links easily
  6. $scope.isUrl = function(url) {
  7. if (url === '#') return false;
  8. return ('#' + $state.$current.url.source + '/').indexOf(url + '/') === 0;
  9. };
  10. $scope.pages = [
  11. {
  12. name: 'Home',
  13. url: '#/'
  14. },
  15. {
  16. name: 'Shipwrecks',
  17. url: '#/shipwrecks'
  18. }
  19. ]
  20. });