本文整理汇总了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 ) ) );
}