當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript aurelia-router.Router類代碼示例

本文整理匯總了TypeScript中aurelia-router.Router的典型用法代碼示例。如果您正苦於以下問題:TypeScript Router類的具體用法?TypeScript Router怎麽用?TypeScript Router使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Router類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: prepare

    prepare() {
        if (this.router.isConfigured) {
            return;
        }

        this.router.configure((config: RouterConfiguration) => {
            config.title = 'Aurelia';
            config.map([
                { route: ['', 'login'], name: 'login', moduleId: 'login' },
                { route: 'page1', name: 'page1', moduleId: 'page1', settings: { auth: true } },
                { route: 'page2', name: 'page2', moduleId: 'page2', settings: { auth: true } }
            ]);
            config.addAuthorizeStep(AuthPlugin);

            return config;
        });

        let callback = (eventArgs: Object, name) => {
            logger.warn(eventArgs['instruction']['config']['name'], name);
        };

        this.eventAggregator.subscribe('router:navigation:processing', callback);
        this.eventAggregator.subscribe('router:navigation:error', callback);
        this.eventAggregator.subscribe('router:navigation:canceled', callback);
        this.eventAggregator.subscribe('router:navigation:success', callback);
        this.eventAggregator.subscribe('router:navigation:complete', callback);
    }
開發者ID:codeaid,項目名稱:skeleton-navigation,代碼行數:27,代碼來源:router-config.ts

示例2: constructor

 constructor(public router: Router) {
   router.configure(config => {
     config.title = 'TinyUI';
     config.map([
       { route: ['','examples'],  moduleId: './examples',      nav: true, title:'examples' }
     ]);
   });
 }
開發者ID:giabao,項目名稱:tinyui-doc,代碼行數:8,代碼來源:app.ts

示例3: constructor

 constructor(private router: Router) {
   this.router.configure(config => {
     config.title = "Teatr";
     config.map([
       { route: ["", "home"], name: "home", moduleId: "views/home", nav: true, title: "Home" },
       { route: "manage", name: "manage", moduleId: "views/manage", nav: true, title: "Manage" }
     ]);
     return config;
   });
 }
開發者ID:alisabzevari,項目名稱:Teatr,代碼行數:10,代碼來源:app.ts

示例4: loadRouter

    private loadRouter() {
        this.router.configure((config: RouterConfiguration): RouterConfiguration => {
            config.title = "Aurelia";
            config.map([
                { route: ['', 'dash'], name: 'dash', moduleId: './views/dashboard/dash', nav: true, title: 'Dashboard' },

            ]);
            return config;
        });
    }
開發者ID:cloudspire,項目名稱:Aurelia_Scaffolding,代碼行數:10,代碼來源:app.ts

示例5: constructor

 constructor(private router: Router) {
   this.router = router;
   this.router.configure(config => {
     config.title = 'Aurelia';
     config.map([
       { route: ['','welcome'],  moduleId: './welcome',      nav: true, title:'Welcome' },
       { route: 'flickr',        moduleId: './flickr',       nav: true },
       { route: 'child-router',  moduleId: './child-router', nav: true, title:'Child Router' }
     ]);
   });
 }
開發者ID:searus,項目名稱:skeleton-navigation,代碼行數:11,代碼來源:app.ts

示例6: activeNavItemChanged

 activeNavItemChanged(activeNavLink) {
     for (let index = 0; index < this.navItems.length; index++) {
         let navItem = this.navItems[index];
         navItem.isActive = navItem.link === activeNavLink;
     }
     this.router.navigate(activeNavLink);
 }
開發者ID:t0ms3n,項目名稱:SoftwareManager,代碼行數:7,代碼來源:app.ts

示例7: save

    public save() {
        if (!this.canSave) {
            return;
        }

        this.storage.saveTodo(this.todo);
        this.router.navigateToRoute('list');
    }
開發者ID:Jenselme,項目名稱:tests-ionic2-and-aurelia-framework7,代碼行數:8,代碼來源:edit.ts

示例8:

 return this.ds.login().then(user => {
   if (user) {
     this.session.setUser(user);
     return this.router.navigateToRoute("dispatch");
   } else {
     return true;
   }
 });
開發者ID:rgwch,項目名稱:webelexis,代碼行數:8,代碼來源:stage1.ts

示例9: alert

 this.ds.login(this.username, this.password).then(user => {
   if (user) {
     this.session.setUser(user);
     this.router.navigateToRoute("dispatch");
   } else {
     alert("Username oder Passwort falsch");
   }
 });
開發者ID:rgwch,項目名稱:webelexis,代碼行數:8,代碼來源:stage1.ts


注:本文中的aurelia-router.Router類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。