TemplateFactory | @uirouter/angularjs
Options
Menu

Class TemplateFactory

Service which manages loading of templates from a ViewConfig.

Hierarchy

  • TemplateFactory

Implements

Index

Methods

  • fromComponentProvider(provider: IInjectable, params: any, context: ResolveContext): Promise<any>
  • Creates a component's template by invoking an injectable provider function.

  • Creates a component's template by invoking an injectable provider function.

    Parameters

    • provider IInjectable
      :

      Function to invoke via locals

    • params any
    • context ResolveContext

    Returns Promise<any>

    :

    The template html as a string: "".


  • fromConfig(config: Ng1ViewDeclaration, params: any, context: ResolveContext): Promise<object>
  • Creates a template from a configuration object.

  • Creates a template from a configuration object.

    Parameters

    • config Ng1ViewDeclaration
      :

      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:

    • params any
      :

      Parameters to pass to the template function.

    • context ResolveContext
      :

      The resolve context associated with the template's view

    Returns Promise<object>

    :

    The template html as a string, or a promise for that string,or null if no template is configured.


  • fromProvider(provider: IInjectable, params: any, context: ResolveContext): Promise<any>
  • Creates a template by invoking an injectable provider function.

  • Creates a template by invoking an injectable provider function.

    Parameters

    • provider IInjectable
      :

      Function to invoke via locals

    • params any
    • context ResolveContext

    Returns Promise<any>

    :

    The template html as a string, or a promise for that string.


  • fromString(template: string | Function, params?: RawParams): any
  • Creates a template from a string or a function returning a string.

  • Creates a template from a string or a function returning a string.

    Parameters

    • template string | Function
      :

      html template as a string or function that returns an html template as a string.

    • params: Optional  RawParams
      :

      Parameters to pass to the template function.

    Returns any

    :

    The template html as a string, or a promise for that string.


  • fromUrl(url: string | Function, params: any): any
  • Loads a template from the a URL via $http and $templateCache.

  • Loads a template from the a URL via $http and $templateCache.

    Parameters

    • url string | Function
      :

      url of the template to load, or a function that returns a url.

    • params any
      :

      Parameters to pass to the url function.

    Returns any

    :

    The template html as a string, or a promise for that string.


  • makeComponentTemplate(uiView: IAugmentedJQuery, context: ResolveContext, component: string, bindings?: any): string
  • Creates a template from a component's name

  • Creates a template from a component's name

    This implements route-to-component. It works by retrieving the component (directive) metadata from the injector. It analyses the component's bindings, then constructs a template that instantiates the component. The template wires input and output bindings to resolves or from the parent component.

    Parameters

    • uiView IAugmentedJQuery
      :

      The parent ui-view (for binding outputs to callbacks)

    • context ResolveContext
      :

      The ResolveContext (for binding outputs to callbacks returned from resolves)

    • component string
      :

      Component's name in camel case.

    • bindings: Optional  any
      :

      An object defining the component's bindings: {foo: '<'}

    Returns string

    :

    The template as a string: "".


Generated using TypeDoc