javascript - Angular UI router - can't get my data in component after resolve -
i have router configured 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 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 see data.data.artist
valid , accessible log during resolving process, inside component input
undefined
j don't understand why happening?
have tried resolving promise in controller?
model.input.then(function(res) { console.log(res); }
Comments
Post a Comment