fix(router): error when it can't initialize property

This commit is contained in:
Manu Mtz.-Almeida
2018-04-29 17:24:18 +02:00
parent 19e5df941c
commit e56b2ee1a5

View File

@@ -53,14 +53,17 @@ export class Router {
@Event() ionRouteChanged!: EventEmitter<RouterEventDetail>;
componentWillLoad() {
async componentWillLoad() {
console.debug('[ion-router] router will load');
const tree = readRoutes(this.el);
this.routes = flattenRouterTree(tree);
this.redirects = readRedirects(this.el);
return this.writeNavStateRoot(this.getPath(), RouterDirection.None);
const changed = await this.writeNavStateRoot(this.getPath(), RouterDirection.None);
if (!changed) {
console.error('[ion-router] did not change on will load');
}
}
componentDidLoad() {