当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Location.replaceState方法代码示例

本文整理汇总了TypeScript中@angular/common.Location.replaceState方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Location.replaceState方法的具体用法?TypeScript Location.replaceState怎么用?TypeScript Location.replaceState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@angular/common.Location的用法示例。


在下文中一共展示了Location.replaceState方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: ngOnInit

 ngOnInit() {
   this.currentUser = this.sessions.getCurrentUser();
   if (!(this.currentUser && this.currentUser.admin)) {
     this.location.replaceState('/');
     this.router.navigateByUrl('/');
   }
 }
开发者ID:dm4562,项目名称:sales-demo,代码行数:7,代码来源:admin.directive.ts

示例2: encodeURIComponent

        this.dttpService.listPage( this.model, this.page, this.pageSize ).subscribe( resp => {
            this.model = resp.model;
            this.resultList = resp.resultList;
            this.count = resp.resultList.count;

            this.location.replaceState( "/metamodel/data-type/grid;page=" + this.page + ";model=" + encodeURIComponent( JSON.stringify( this.model ) ) );
        } );
开发者ID:xeredi,项目名称:portico,代码行数:7,代码来源:data-type-grid.component.ts

示例3: encodeURIComponent

        this.sprtService.listPage( this.model, this.page, this.pageSize ).subscribe( resp => {
            this.model = resp.model;
            this.resultList = resp.resultList;
            this.count = resp.resultList.count;

            this.location.replaceState( "/settings/superport/grid;page=" + this.page + ";model=" + encodeURIComponent( JSON.stringify( this.model ) ) );
        } );
开发者ID:xeredi,项目名称:portico,代码行数:7,代码来源:superport-grid.component.ts

示例4: encodeURIComponent

        this.prmtService.listPage( this.model, this.page, this.pageSize ).subscribe( resp => {
            this.model = resp.model;
            this.enti = resp.enti;
            this.resultList = resp.resultList;

            this.location.replaceState(
                "/master/parameter/grid/" + this.model.entiId
                + ";page=" + this.page
                + ";model=" + encodeURIComponent( JSON.stringify( this.model ) )
            );
        } );
开发者ID:xeredi,项目名称:portico,代码行数:11,代码来源:parameter-grid.component.ts

示例5: constructor

 constructor(
     private adalService: AdalService,
     private router: Router,
     private location: Location
 ) {
     console.log('Entering protected');
     if (!this.adalService.userInfo.isAuthenticated) {
         this.location.replaceState('/');
         this.router.navigate(['login']);
     }
 }
开发者ID:seadeer,项目名称:Azure-AD-Angular2-demo,代码行数:11,代码来源:protected.directive.ts

示例6: onChange

 public onChange(e) {
   console.log('change tab');
   let oldTabName = this.tabName;
   if (e.index==0) {
       this.tabName = "general";
   } else if (e.index==1) {
       this.tabName = "execution";
   }  else {
     this.tabName = "restore";
   }
   this.location.replaceState(this.location.path(false).replace(oldTabName, this.tabName));
 }
开发者ID:fensminger,项目名称:SyncFiles,代码行数:12,代码来源:synchro_detail.ts

示例7: ngOnInit

 ngOnInit() {
   let path = this.location.path();
   let query = new URL(this.location.path(), '/', true).query as AppQueryParams;
   if (query.u) {
     this.tokenService.redirectLogin().subscribe();
   }
   if (query.showerr) {
     console.log('Errors will be shown');
     this.location.replaceState(removeURLParameter(path, 'showerr').url);
     config.showErr = true;
   }
 }
开发者ID:empirefox,项目名称:ec-front,代码行数:12,代码来源:app.component.ts

示例8: constructor

 constructor(private authService:AuthService, private location:Location, private router:Router) {
     if (authService.isAuthenticated()) {
         this.location.replaceState('/');
         this.router.navigateByUrl('protected');
     }
     
     this.authService.subscribe((val) => {
         if (val.authenticated) {
             this.location.replaceState('/');
             this.router.navigateByUrl('protected');
         }
     });
 }
开发者ID:n-pilipovic,项目名称:mailclient,代码行数:13,代码来源:login.component.ts

示例9: constructor

  constructor(private af: AngularFire, private router: Router, private location: Location) {
    // http://stackoverflow.com/questions/34331478/angular2-redirect-to-login-page
    if (!af.auth.getAuth()) {
      this.location.replaceState('/');
      this.router.navigate(['Login']);
    }

    this.sub = af.auth.subscribe(auth => {
      if (!auth) {
        this.location.replaceState('/');
        this.router.navigate(['Login']);
      }
    });
  }
开发者ID:Denhai,项目名称:everyday-butter,代码行数:14,代码来源:authenticated.directive.ts

示例10: replaceState

 private replaceState() {
     this.location.replaceState( "/billing/assessment-line/detail/" + this.model.id + ";activeTab=" + this.activeTab
         + ";pageMap=" + encodeURIComponent( JSON.stringify( this.pageMap ) ) );
 }
开发者ID:xeredi,项目名称:portico,代码行数:4,代码来源:assessment-line-detail.component.ts


注:本文中的@angular/common.Location.replaceState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。