本文整理汇总了TypeScript中@angular/common.Location.back方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Location.back方法的具体用法?TypeScript Location.back怎么用?TypeScript Location.back使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/common.Location
的用法示例。
在下文中一共展示了Location.back方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: onClose
onClose(){
if(this.lh.is){
this.location.back()
}else{
this.router.navigate(['/auth/map']);
}
}
示例2: canActivate
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
if(!localStorage.getItem('username')){
return true;
}
this._location.back();
return false;
}
示例3: save
save(){
this.service.save({
firstname : this.firstname,
lastname : this.lastname
});
this.location.back();
}
示例4: switch
.subscribe(action => {
const { path, query: queryParams, extras = {} }: RouterMethodCall = action.payload;
let commands: any[] = Array.isArray(path) ? path : [path];
switch (action.type) {
case routerActions.GO:
router.navigate(commands, Object.assign({}, extras, { queryParams }));
break;
case routerActions.REPLACE:
router.navigate(commands, Object.assign({}, extras, { queryParams, replaceUrl: true }));
break;
case routerActions.SEARCH:
let urlTree: UrlTree = router.parseUrl(router.url);
urlTree.queryParams = queryParams;
router.navigateByUrl(urlTree, extras);
break;
case routerActions.SHOW:
router.navigate(commands, Object.assign({}, extras, { queryParams, skipLocationChange: true }));
break;
case routerActions.BACK:
location.back();
break;
case routerActions.FORWARD:
location.forward();
break;
}
});
示例5: if
.subscribe(data => {
// Login denied
if (!data.success) {
if (data.status === 1) {
this.flashMsg.show('Wrong username!', { cssClass: 'notification is-danger' });
} else if (data.status === 2) {
this.flashMsg.show('Wrong password!', { cssClass: 'notification is-danger' });
} else {
this.flashMsg.show(data.msg, { cssClass: 'notification is-danger' });
}
this.username = '';
this.password = '';
return;
}
// Login allowed
if (data.success && data.status === 0) {
this.auth.storeToken(data.token, data.user);
return this.location.back();
} else {
this.flashMsg.show('Error', { cssClass: 'notification is-danger' });
}
});
示例6: save
// check to make sure first/lastname variables not empty
// if true push new object with them to personList []
// re-save serialized version of that array
// then go back in navigation stack
save() {
if (this.firstname != "" && this.lastname != "") {
this.personList.push({firstname: this.firstname, lastname: this.lastname});
localStorage.setItem("people", JSON.stringify(this.personList));
this.location.back();
}
}
示例7: save
save() {
if(this.firstname != "" && this.lastname != "") {
var people: Array<Object> = JSON.parse(applicationSettings.getString("people", "[]"));
people.push({firstname: this.firstname, lastname: this.lastname});
applicationSettings.setString("people", JSON.stringify(people));
this.location.back();
}
}
示例8: save
save(){
if(this.firstname != '' && this.lastname != ''){
this.personList.push({firstname: this.firstname, lastname: this.lastname});
ApplicationSettings.setString('people', JSON.stringify(this.personList));
this.location.back();
}else{
console.log('Not able to save');
}
}
示例9: save
save() {
if(this.firstname != "" && this.lastname != "") {
this.database.createDocument({
"firstname": this.firstname,
"lastname": this.lastname
});
this.location.back();
}
}
示例10: updateInstitution
public updateInstitution() {
let institution = Object.assign(this.institution, this.institutionFormGroup.value);
institution.regionType = this.getRegionType(institution.place);
institution.totalBusyPersonalNumber = (institution.busyDoctorNumber || 0) + (institution.middleBusyPersonalNumber || 0) + (institution.otherBusyPersonalNumber);
institution.totalIndividualsPersonalNumber = (institution.individualsDoctorNumber || 0) + (institution.middleIndividualsPersonalNumber || 0) + (institution.otherIndividualsPersonalNumber || 0);
institution.totalRegularPersonalNumber = (institution.regularDoctorNumber || 0) + (institution.middleRegularPersonalNumber || 0) + (institution.otherRegularPersonalNumber || 0);
this.institutionService.update(institution.id, institution);
this.location.back();
}