erikringsmuth / app-router

Router for Web Components
https://erikringsmuth.github.io/app-router/
MIT License
610 stars 83 forks source link

Add a `before-data-binding` event to hook into the model #45

Closed erikringsmuth closed 9 years ago

erikringsmuth commented 9 years ago

Add a before-data-binding event to hook into the model before it is bound to the custom element or template.

<app-route ... on-before-data-binding="{{updateRouteModel}}"></app-route>

The event handler

updateRouteModel: function(event) {
  // event.detail looks like this
  {
    path: '/new-path',
    route: newRoute,
    oldRoute: oldRoute,
    model: {
      // path variables and query parameters
      // modify or add properties here before data binding happens
    }
  }
}

Then you could modify the model with any values.

erikringsmuth commented 9 years ago

Released with 2.1.0