Every line of 'angularjs ui router cdn' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
1 export function routerConfig($componentLoaderProvider) { 2 'ngInject'; 3 $componentLoaderProvider.setTemplateMapping(function(name) { 4 return `app/${ name }/${ name }.html`; 5 }); 6 }
7 function routerConfig($stateProvider, $urlRouterProvider) { 8 $stateProvider.state('home', { 9 url: '/', 10 component: 'home', 11 }); 12 13 $urlRouterProvider.otherwise('/'); 14 }
54 static forRoot(routes: Routes, config?: ExtraOptions): ModuleWithProviders { 55 return RouterModule.forRoot(routes, config); 56 }
11 function makeRoute (name, needModel = false) { 12 //正则匹配 13 var url = name.replace(/\b(\w)|\s(\w)/g, first => first.toUpperCase()); 14 return { 15 path: name, 16 name: name, 17 getComponent(nextState, cb){ 18 require.ensure([], require => { 19 if (needModel && !app._models.some(val => (val.namespace===url))) 20 app.model(require('./models/' + url)) 21 22 cb(null, require('./routes/' + url)); 23 }); 24 } 25 } 26 }
11 export default function createRouter(base) { 12 const router = new VueRouter({ 13 base, 14 mode: 'history', 15 routes, 16 }); 17 const pageEl = getPageLayoutElement(); 18 19 router.beforeEach(({ meta: { el }, name }, _, next) => { 20 $(`#${el}`).tab('show'); 21 22 // apply a fullscreen layout style in Design View (a.k.a design detail) 23 if (pageEl) { 24 if (name === DESIGN_ROUTE_NAME) { 25 pageEl.classList.add(...DESIGN_DETAIL_LAYOUT_CLASSLIST); 26 } else { 27 pageEl.classList.remove(...DESIGN_DETAIL_LAYOUT_CLASSLIST); 28 } 29 } 30 31 next(); 32 }); 33 34 return router; 35 }
50 static forRoot(routes: Routes, config?: ExtraOptions): ModuleWithProviders { 51 return { 52 ngModule: NativeScriptRouterModule, 53 providers: [...RouterModule.forRoot(routes, config).providers, ...NS_ROUTER_PROVIDERS] 54 }; 55 }
265 private _insertLazyImport(moduleInfo: LazyModuleInfo) { 266 return `loadChildren: '${moduleInfo.fusePath}#${moduleInfo.moduleName}?url=${moduleInfo.browserPath}&split=${moduleInfo.splitBundleName}&pkg=${moduleInfo.packageName}'`; 267 }
19 export function createRouter () { 20 const router = new Router({ 21 base: __dirname, 22 mode: 'history', 23 scrollBehavior: () => ({ y: 0 }), 24 routes: [ 25 route('/', 'Welcome'), 26 route('/inspire', 'Inspire'), 27 // Global redirect for 404 28 { path: '*', redirect: '/' } 29 ] 30 }) 31 32 // Send a pageview to Google Analytics 33 router.beforeEach((to, from, next) => { 34 if (typeof ga !== 'undefined') { 35 ga('set', 'page', to.path) 36 ga('send', 'pageview') 37 } 38 next() 39 }) 40 41 return router 42 }
83 initRouter (routerOptions) { 84 assert(isObject(routerOptions), `lue.router: vue-router options should be a object.`); 85 assert(!isDef(routerOptions['routes']), `lue.router: routes prop of vue-router options should be defined.`); 86 assert(Array.isArray(routerOptions['routes']), `lue.router: routes prop of vue-router options should be a array.`); 87 88 this.router = new VueRouter(routerOptions); 89 }
37 export function createRouter () { 38 return new Router(routerOptions) 39 }