beta-3 with angular 1.5.6 and higher doesn't bind component resolves
I decided to update angular from 1.5.5 to 1.5.8, but noticed that promises from resolves don't bind the promise result anymore. However, i noticed they are actually present in the $scope.$parent.$resolve if i check the $scope on my component.$onInit. After i did a rollback to angular 1.5.5 the bindings worked again.
State definition:
$stateProvider.state('dashboard', {
url: '/dashboard',
component: 'dashboard',
resolve: {
/* Makes sure the widgets for the current user are loaded */
widgets: ['authenticationService', 'dashboardService', function (authenticationService, dashboardService) {
return dashboardService.loadWidgetsAsync(authenticationService.user.id);
}],
/* Makes sure the app definitions are loaded */
apps: ['appService', function (appService) {
return appService.getAppDefinitionsAsync();
}]
}
});
Component definition:
angular.module('myApp')
.component('dashboard', {
bindings: {
widgets: '<', // binding for widgets
apps: '<' // binding for app definitions
},
controller: ['$scope', ' DashboardController],
templateUrl: '/app/views/dashboard/dashboard.html'
});
in angular 1.5 components, you should avoid using $scope. The resolves should be bound on the this object. For example:
function DashboardController() {
console.log(this.widgets)
}
heres a plunker http://plnkr.co/edit/AeBySYQSfoCCIe6dzVI8?p=preview
Closing because I think the question is answered, and no response.