* Gets the controller for a view configuration. * * @returns {Function|Promise. } Returns a controller, or a promise that resolves to a controller.
(context: ResolveContext)
| 143 | * @returns {Function|Promise.<Function>} Returns a controller, or a promise that resolves to a controller. |
| 144 | */ |
| 145 | getController(context: ResolveContext): IInjectable | string | Promise<IInjectable | string> { |
| 146 | const provider = this.viewDecl.controllerProvider; |
| 147 | if (!isInjectable(provider)) return this.viewDecl.controller; |
| 148 | const deps = services.$injector.annotate(provider); |
| 149 | const providerFn = isArray(provider) ? tail(<any>provider) : provider; |
| 150 | const resolvable = new Resolvable('', <any>providerFn, deps); |
| 151 | return resolvable.get(context); |
| 152 | } |
| 153 | } |