@toddmotto, for developers, such as myself, who aren't comfortable moving forward with an alpha release of ui-router, there is an alternative route-to-component approach. Starting with 0.3.0 a developer now has access to $resolve. While it requires being more verbose, it offers the following approach:
const todo = angular
.module('todo', [])
.component('todo', TodoComponent)
.service('TodoService', TodoService)
.config(($stateProvider, $urlRouterProvider) => {
$stateProvider
.state('todos', {
url: '/todos',
// full component html with binding attributes
template: '<todo todo-data="$resolve.todoData"></todo>',
resolve: {
todoData: PeopleService => PeopleService.getAllPeople();
}
});
$urlRouterProvider.otherwise('/');
})
.name;
Yeah! This is an alternative (and super easy upgrade too). Stable for the component routing won't be too far away so makes sense to mention it now to prepare. The alpha is super stable btw too!
@toddmotto, for developers, such as myself, who aren't comfortable moving forward with an alpha release of
ui-router
, there is an alternative route-to-component approach. Starting with 0.3.0 a developer now has access to$resolve
. While it requires being more verbose, it offers the following approach: