MCPcopy
hub / github.com/angular-ui/ui-router / fromUrl

Method fromUrl

src/templateFactory.ts:105–118  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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.

Callers 2

fromConfigMethod · 0.95

Calls 1

isFunctionFunction · 0.50

Tested by

no test coverage detected