fix(router): throw if config does not contain required fields
This commit is contained in:
parent
68ed8f1b6b
commit
259f872cea
|
@ -14,6 +14,15 @@ export class RouteRegistry {
|
||||||
|
|
||||||
config(parentComponent, config) {
|
config(parentComponent, config) {
|
||||||
|
|
||||||
|
if (!StringMapWrapper.contains(config, 'path')) {
|
||||||
|
throw new BaseException('Route config does not contain "path"');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!StringMapWrapper.contains(config, 'component') &&
|
||||||
|
!StringMapWrapper.contains(config, 'components')) {
|
||||||
|
throw new BaseException('Route config does not contain "component" or "components"');
|
||||||
|
}
|
||||||
|
|
||||||
var recognizer:RouteRecognizer;
|
var recognizer:RouteRecognizer;
|
||||||
if (MapWrapper.contains(this._rules, parentComponent)) {
|
if (MapWrapper.contains(this._rules, parentComponent)) {
|
||||||
recognizer = MapWrapper.get(this._rules, parentComponent);
|
recognizer = MapWrapper.get(this._rules, parentComponent);
|
||||||
|
|
Loading…
Reference in New Issue