Skip to content

Add support for template definition inside of view configuration (ui-router) #28

@avishnyak

Description

@avishnyak

ui-router supports defining templates as subviews.

See views.

This supports components, inline templates and inline URLs in 2 flavors (as a config object and as a string):

.state('userlist', {
  url: '/users',
  views: {
    body: {
      controller: "bodyCtrl",
      template: "<component-name></component-name>"  // inline-template as a config object
    },
    header: {
      controller: "headerCtrl",
      templateUrl: "header.html" // templateUrl as a config object
    },
    'top@menu': {
      component: "menuComponent"  // component name as a config object
    },
    footer: "footerComponent"  // component name as a string
  }
}

It seems that to accomodate this, the route infrastructure would need to be refactored to understand multiple templates per route. I can make the PR but would like to get your input first since this would be an architectural change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions