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