我不知道如何在从AngularJS升级到ng2的应用中执行通配符路径路由。混合AngularJS和Angular 2路由时的通配符路径
一般来说,混合的路由这样的两种:
的第一步具有双重路由器的设置是添加包含每个路由器一个出口的角根 组件。 AngularJS将使用ng-view的 ,而Angular将使用router-outlet。当用户使用它的 路由器时,另一个插座将是空的。
import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: ` <router-outlet></router-outlet> <div ng-view></div> `, }) export class AppComponent { }
https://angular.io/docs/ts/latest/guide/upgrade.html#!#dividing-routes-between-angular-and-angularjs
在角2可以指定这样一个通配符路径:
{路径: '**',组分:PageNotFoundComponent}
在AngularJS可以有这样的通配符路径:
$routeProvider
.otherwise({
template: '<page-not-found></page-not-found>',
});
当我把所有东西放在一起并且路径没有处理时,如何避免两台路由器发出<page-not-found>
?