diff --git a/modules/angular2/src/router/route_recognizer.ts b/modules/angular2/src/router/route_recognizer.ts index d63bbf8079..e3af241502 100644 --- a/modules/angular2/src/router/route_recognizer.ts +++ b/modules/angular2/src/router/route_recognizer.ts @@ -52,7 +52,8 @@ export class RouteRecognizer { if (config instanceof AuxRoute) { handler = new SyncRouteHandler(config.component, config.data); - let path = config.path.startsWith('/') ? config.path.substring(1) : config.path; + let path = + StringWrapper.startsWith(config.path, '/') ? config.path.substring(1) : config.path; var recognizer = new PathRecognizer(config.path, handler); this.auxRoutes.set(path, recognizer); return recognizer.terminal; @@ -140,11 +141,11 @@ export class Redirector { toSegments: string[] = []; constructor(path: string, redirectTo: string) { - if (path.startsWith('/')) { + if (StringWrapper.startsWith(path, '/')) { path = path.substring(1); } this.segments = path.split('/'); - if (redirectTo.startsWith('/')) { + if (StringWrapper.startsWith(redirectTo, '/')) { redirectTo = redirectTo.substring(1); } this.toSegments = redirectTo.split('/'); diff --git a/modules/angular2/src/router/url_parser.ts b/modules/angular2/src/router/url_parser.ts index b1f71e8a30..a09f38ecdf 100644 --- a/modules/angular2/src/router/url_parser.ts +++ b/modules/angular2/src/router/url_parser.ts @@ -1,5 +1,11 @@ import {StringMap, StringMapWrapper} from 'angular2/src/core/facade/collection'; -import {isPresent, isBlank, RegExpWrapper, CONST_EXPR} from 'angular2/src/core/facade/lang'; +import { + isPresent, + isBlank, + StringWrapper, + RegExpWrapper, + CONST_EXPR +} from 'angular2/src/core/facade/lang'; import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions'; /** @@ -71,10 +77,10 @@ function matchUrlSegment(str: string): string { export class UrlParser { private _remaining: string; - peekStartsWith(str: string): boolean { return this._remaining.startsWith(str); } + peekStartsWith(str: string): boolean { return StringWrapper.startsWith(this._remaining, str); } capture(str: string): void { - if (!this._remaining.startsWith(str)) { + if (!StringWrapper.startsWith(this._remaining, str)) { throw new BaseException(`Expected "${str}".`); } this._remaining = this._remaining.substring(str.length);