route.js 834 B

1234567891011121314151617181920212223242526272829
  1. 'use strict';
  2. angular.module('app').run([ '$rootScope', '$state', function($rootScope, $state) {
  3. // $rootScope.$on('$stateChangeStart', function(event, toState, toParam,
  4. // fromState, fromParam) {
  5. // console.log('----------------------');
  6. // });
  7. // $rootScope.$on('$stateChangeError', function(event, toState, toParam,
  8. // fromState, fromParam) {
  9. // console.log('------------------333333----');
  10. // });
  11. } ]).config(function($stateProvider, $urlRouterProvider) {
  12. $urlRouterProvider.otherwise('/app/main');
  13. $stateProvider.state('app', {
  14. url : '/app',
  15. templateUrl : 'route/app.html'
  16. }).state('app.main', {
  17. url : '/main',
  18. templateUrl : 'route/main/main.html',
  19. resolve : {
  20. deps : [ '$ocLazyLoad', function($ocLazyLoad) {
  21. return $ocLazyLoad.load({
  22. files : [ 'route/main/main.js' ]
  23. });
  24. } ]
  25. }
  26. })
  27. });