當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。