mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
Route emit
This commit is contained in:
@ -43,7 +43,9 @@ export class NavItem {
|
||||
this.Class = data.Class;
|
||||
this._item = data;
|
||||
|
||||
if(data.parms) {
|
||||
util.extend(this.params, data.params);
|
||||
}
|
||||
|
||||
this._loader.loadIntoExistingLocation(data.Class, this._elementRef).then(instance => {
|
||||
this.instance = instance
|
||||
|
@ -18,6 +18,7 @@ export class Router {
|
||||
|
||||
if(routeParams !== false) {
|
||||
route.exec(this.buildRouteParams(routeParams));
|
||||
this.emit(route.url)
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -25,6 +26,10 @@ export class Router {
|
||||
return this.noMatch();
|
||||
}
|
||||
|
||||
emit(path) {
|
||||
window.location.hash = path
|
||||
}
|
||||
|
||||
buildRouteParams(routeParams) {
|
||||
routeParams._route = {
|
||||
path: window.location.hash.slice(1)
|
||||
@ -50,6 +55,7 @@ export class Router {
|
||||
if((routeParams = route.match(path)) !== false) {
|
||||
console.log('OTHERWISE: route matched:', route.url);
|
||||
route.exec(routeParams)
|
||||
this.emit(route.url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user