I'm having trouble with the combination in the topic, there must be a minor mistake somewhere that's causing this issue.
Controller:
class JobCtrl {
job: Object;
public $inject = ['$log', '$resource', 'ApiDataEndpoint', '$stateParams'];
constructor(public $log, public $resource, public ApiDataEndpoint, public $stateParams ) {
var JobRes = $resource(ApiDataEndpoint.url+'job/:id', {});
var jobCall = JobRes.get({ id: $stateParams.id},function(){
this.job = jobCall;
})
}
}
The route is defined as follows:
.state('app.job', {
url: '/jobs/:id',
views: {
'menuContent': {
templateUrl: 'templates/job.html',
controller: 'JobCtrl',
controllerAs: 'vm'
}
}
})
In my view, I have the following:
<p>
Name: {{vm.job.Name}}
</p>
However, the view does not update when the callback returns. It seems like there may be an asynchronous problem or a scope issue. While fetching the resource works perfectly, the view remains static. It appears that I am unable to set this job from within the callback. What could I be overlooking here?