我试图在slug不与API匹配时重定向用户。
我的app.routes.ts
@Injectable()
export class RegionResolver implements Resolve<any>{
constructor(private regionsService: RegionsService) { }
resolve(route: ActivatedRouteSnapshot): Observable<any> {
return this.regionsService.getRegion(route.params['region-slug']);
}
}
解析器(region.resolver.ts):
@Injectable()
export class RegionsService {
constructor(private router: Router) { }
getRegion(slug: string) {
return Observable.create(observer => {
setTimeout(() => {
observer
.next(regions.find((region) => region.slug == slug))
.complete();
}, 1000);
});
}
}
为我服务的区域服务(region.service.ts):
this.router.navigate(['/']);
我如何处理错误以放置:insert into table1 select * from table2 where
row(id,address,city,state) not in (select * from table1);
以及我想要实现此目的(在解析器类中没有)? THX