当前位置: 首页>>代码示例>>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;未经允许,请勿转载。