本文整理匯總了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('/');
}
}
示例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 ) ) );
} );
示例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 ) ) );
} );
示例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 ) )
);
} );
示例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']);
}
}
示例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));
}
示例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;
}
}
示例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');
}
});
}
示例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']);
}
});
}
示例10: replaceState
private replaceState() {
this.location.replaceState( "/billing/assessment-line/detail/" + this.model.id + ";activeTab=" + this.activeTab
+ ";pageMap=" + encodeURIComponent( JSON.stringify( this.pageMap ) ) );
}