* Creates a component's template by invoking an injectable provider function. * * @param provider Function to invoke via `locals` * @param {Function} injectFn a function used to invoke the template provider * @return {string} The template html as a string: "<component-name input1='::$res
(provider: IInjectable, params: any, context: ResolveContext)
| 140 | * @return {string} The template html as a string: "<component-name input1='::$resolve.foo'></component-name>". |
| 141 | */ |
| 142 | fromComponentProvider(provider: IInjectable, params: any, context: ResolveContext) { |
| 143 | const deps = services.$injector.annotate(provider); |
| 144 | const providerFn = isArray(provider) ? tail(<any[]>provider) : provider; |
| 145 | const resolvable = new Resolvable('', <Function>providerFn, deps); |
| 146 | return resolvable.get(context); |
| 147 | } |
| 148 | |
| 149 | /** |
| 150 | * Creates a template from a component's name |