router.config.js 714 B

123456789101112131415161718192021222324252627
  1. import {UIRouterReact, servicesPlugin, pushStateLocationPlugin} from '@uirouter/react';
  2. //add visualizer
  3. //import {visualizer} from '@uirouter/visualizer';
  4. import appStates from './states';
  5. // Create a new instance of the Router
  6. export const router = new UIRouterReact();
  7. router.plugin(servicesPlugin);
  8. // router.plugin(hashLocationPlugin);
  9. router.plugin(pushStateLocationPlugin);
  10. // Register the initial (eagerly loaded) states
  11. appStates.forEach(state => router.stateRegistry.register(state));
  12. // Global config for router
  13. router.urlService.config.baseHref('/');
  14. router.urlService.rules.initial({
  15. state: 'home'
  16. });
  17. // Start the router
  18. //router.start();
  19. // Setup the state visualizer
  20. //visualizer(router);