* Registers a handler for a given url matching. * * If the handler is a string, it is * treated as a redirect, and is interpolated according to the syntax of match * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise). * * If the handler is a funct
(what: RegExp | UrlMatcher | string, handler: string | IInjectable)
| 165 | * Note: the handler may also invoke arbitrary code, such as `$state.go()` |
| 166 | */ |
| 167 | when(what: RegExp | UrlMatcher | string, handler: string | IInjectable): this { |
| 168 | if (isArray(handler) || isFunction(handler)) { |
| 169 | handler = UrlRouterProvider.injectableHandler(this.router, handler); |
| 170 | } |
| 171 | |
| 172 | this.router.urlService.rules.when(what, handler as any); |
| 173 | return this; |
| 174 | } |
| 175 | |
| 176 | /** |
| 177 | * Disables monitoring of the URL. |
no test coverage detected