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


TypeScript Location.path方法代碼示例

本文整理匯總了TypeScript中angular2/router.Location.path方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Location.path方法的具體用法?TypeScript Location.path怎麽用?TypeScript Location.path使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在angular2/router.Location的用法示例。


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

示例1: isSelected

 isSelected(path) {
   if(path === this.location.path()){
       return true;
   }
   else if(path.length > 0){
       return this.location.path().indexOf(path) > -1;
   }
 }
開發者ID:michidk,項目名稱:Angular2-Routing-Example,代碼行數:8,代碼來源:nav.component.ts

示例2: getLinkStyle

    getLinkStyle(path) {

        if(path === this.location.path()){
            return true;
        }
        else if(path.length > 0){
            return this.location.path().indexOf(path) > -1;
        }
    }
開發者ID:2947721120,項目名稱:angular-2-samples,代碼行數:9,代碼來源:app.ts

示例3: isActiveRoute

	public isActiveRoute(route: string): boolean {
		let path = this._location.path()
		if (path == '/'+route) {
			return true
		} else {
			return false
		}
	}
開發者ID:Dequisitor,項目名稱:MDash-Nodejs,代碼行數:8,代碼來源:home.router.component.ts

示例4: if

		client.session.subscribe((auth: FirebaseAuthData) => {
			router.recognize(location.path()).then((instruction: Instruction) => {
				if (auth && isAuthComponent(instruction)) {
					router.navigate(['/Dashboard']);
				} else if (!auth && !isAuthComponent(instruction)) {
					router.navigate(['/Auth', 'Login']);
				}
			});
		});
開發者ID:virajs,項目名稱:ng2-lab,代碼行數:9,代碼來源:app.ts

示例5: constructor

	constructor(txtFileDataService: TxtFileDataService, location: Location) {

		this.location = location;

		console.log(location.path())

		txtFileDataService.loadPageTitle().subscribe((data) => {
			this.pageTitle = data;
		});
	}
開發者ID:dodishes,項目名稱:glenwoodapt12,代碼行數:10,代碼來源:app.component.ts

示例6: tryNavigateAfterReloading

    /**
     *
     * @returns {Promise.<string>} returns the original location where the browser comes from
     */
    public tryNavigateAfterReloading(): Promise<string> {
        const locationPath = this._location.path();

        return this.getChildRoute(locationPath)
            .then((carrier: RouteInstruction)=> {
                this._outstandingChildRoutingUrl = carrier.outstandingPath;
                return this._router.navigateByInstruction(carrier.instruction);
            })
            .then(() => locationPath);
    }
開發者ID:LVM-IT,項目名稱:spa-prototype,代碼行數:14,代碼來源:recursive.router.ts

示例7:

      .subscribe((isAuthorized: boolean) => {
        if (isFirst)
          return isFirst = false

        const isLogin = /login/.test(this._location.path())

        if (isAuthorized && !isLogin)
          return

        if (isLogin && isAuthorized)
          this._router.navigate(['Home'])
        else
          this._router.navigate(['Login'])
      })
開發者ID:MikaAK,項目名稱:trello-burndown,代碼行數:14,代碼來源:index.ts

示例8:

 return state$ => state$.do(s => {
     if (s.router.url !== location.path()) {
       router.navigateByUrl(s.router.url);
     }
   })
開發者ID:MikeRyan52,項目名稱:ngrx-store-router,代碼行數:5,代碼來源:middleware.ts

示例9: getMode

 getMode() {
     return this._location.path() == '' ? 'categories' : this._location.path();
 }
開發者ID:smartyauge,項目名稱:angular-2-beta-boilerplate,代碼行數:3,代碼來源:app.component.ts

示例10:

 this.router.subscribe(() => {
     this.activeView = this.location.path();
 });
開發者ID:aschuettler,項目名稱:videogular2,代碼行數:3,代碼來源:app.ts


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