new $templateFactory()
Service. Manages loading of templates.
- Source:
- templateFactory.js, line 1
Requires
- module:$http
- module:$templateCache
- module:$injector
Methods
-
fromConfig(config, params, locals) → {string|Promise.<string>}
-
Creates a template from a configuration object.
Parameters:
Name Type Argument Description configObject Configuration object for which to load a template. The following properties are search in the specified order, and the first one that is defined is used to create the template:
Properties
Name Type Description templatestring | Function html string template or function to load via fromString.
templateUrlstring | Function url to load or a function returning the url to load via fromUrl.
templateProviderFunction function to invoke via fromProvider.
paramsObject Parameters to pass to the template function.
localsObject <optional>
Locals to pass to
invokeif the template is loaded via atemplateProvider. Defaults to{ params: params }.- Source:
- templateFactory.js, line 12
Returns:
The template html as a string, or a promise for that string, or
nullif no template is configured.- Type
- string | Promise.<string>
-
fromString(template, params) → {string|Promise.<string>}
-
Creates a template from a string or a function returning a string.
Parameters:
Name Type Description templatestring | Function html template as a string or function that returns an html template as a string.
paramsObject Parameters to pass to the template function.
- Source:
- templateFactory.js, line 41
Returns:
The template html as a string, or a promise for that string.
- Type
- string | Promise.<string>
-
fromUrl(url, params) → {string|Promise.<string>}
-
Loads a template from the a URL via
$httpand$templateCache.Parameters:
Name Type Description urlstring | Function url of the template to load, or a function that returns a url.
paramsObject Parameters to pass to the url function.
- Source:
- templateFactory.js, line 55
Returns:
The template html as a string, or a promise for that string.
- Type
- string | Promise.<string>
-
fromUrl(provider, params, locals) → {string|Promise.<string>}
-
Creates a template by invoking an injectable provider function.
Parameters:
Name Type Argument Description providerFunction Function to invoke via
$injector.invokeparamsObject Parameters for the template.
localsObject <optional>
Locals to pass to
invoke. Defaults to{ params: params }.- Source:
- templateFactory.js, line 72
Returns:
The template html as a string, or a promise for that string.
- Type
- string | Promise.<string>