Skip to content

Commit 259f872

Browse files
committed
fix(router): throw if config does not contain required fields
1 parent 68ed8f1 commit 259f872

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

modules/angular2/src/router/route_registry.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ export class RouteRegistry {
1414

1515
config(parentComponent, config) {
1616

17+
if (!StringMapWrapper.contains(config, 'path')) {
18+
throw new BaseException('Route config does not contain "path"');
19+
}
20+
21+
if (!StringMapWrapper.contains(config, 'component') &&
22+
!StringMapWrapper.contains(config, 'components')) {
23+
throw new BaseException('Route config does not contain "component" or "components"');
24+
}
25+
1726
var recognizer:RouteRecognizer;
1827
if (MapWrapper.contains(this._rules, parentComponent)) {
1928
recognizer = MapWrapper.get(this._rules, parentComponent);

0 commit comments

Comments
 (0)