I have a router configured like this:
.state('home.view-profile', {
url: '/view-profile/:profileUrl',
template: '<view-profile input="$resolve.profileData"></view-profile>',
title: 'View Profile',
resolve: {profileData: function(artistService, $stateParams){
return artistService.getArtist($stateParams.profileUrl).then((data) => {
const timer = new Date();
console.log(timer.getSeconds() + ':' + timer.getMilliseconds());
console.log(data.data.artist);
return data.data.artist;
});
}
}
})
and the component
module.component('view-profile', {
templateUrl: 'view-profile/view-profile.component.html',
bindings: {
input: '='
},
controller: ['$state', '$scope', '$stateParams', function ($state, $scope, $stateParams) {
const model = this;
console.log('***************');
console.log(model.input);
}]
});
I could see that data.data.artist is valid and accessible from the log during resolving process, but inside the component the input is always undefined
J just don't understand why is this happening?
$resolveto your controller