* Loads a template from the a URL via `$http` and `$templateCache`. * * @param {string|Function} url url of the template to load, or a function * that returns a url. * @param {Object} params Parameters to pass to the url function. * @return {string|Promise. } The template html
(url: string | Function, params: any)
| 103 | * for that string. |
| 104 | */ |
| 105 | fromUrl(url: string | Function, params: any) { |
| 106 | if (isFunction(url)) url = (<any>url)(params); |
| 107 | if (url == null) return null; |
| 108 | |
| 109 | if (this._useHttp) { |
| 110 | return this.$http |
| 111 | .get(url, { cache: this.$templateCache, headers: { Accept: 'text/html' } }) |
| 112 | .then(function (response) { |
| 113 | return response.data; |
| 114 | }); |
| 115 | } |
| 116 | |
| 117 | return this.$templateRequest(url); |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | * Creates a template by invoking an injectable provider function. |
no test coverage detected