From 259f872ceabc7d4754a4ee3a14f2d807db57d4cf Mon Sep 17 00:00:00 2001 From: Brian Ford Date: Fri, 1 May 2015 15:50:12 -0700 Subject: [PATCH] fix(router): throw if config does not contain required fields --- modules/angular2/src/router/route_registry.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/angular2/src/router/route_registry.js b/modules/angular2/src/router/route_registry.js index d1c7075dc7..5b7d9b8330 100644 --- a/modules/angular2/src/router/route_registry.js +++ b/modules/angular2/src/router/route_registry.js @@ -14,6 +14,15 @@ export class RouteRegistry { 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; if (MapWrapper.contains(this._rules, parentComponent)) { recognizer = MapWrapper.get(this._rules, parentComponent);