Hi when a user is directed to one page I want to perform a logic check to see if there are any entries in a collection that are missing an attribute and redirect the user if so. Here is sort of my idea of how the code should look but I can't seen to get the subscribe to work in the routes.js file
routes.js
.state('pendingVisits', {
url: '/pendingVisits',
templateUrl: ()=> {
if (Meteor.isCordova) {
return '/packages/visitry-mobile/client/visits/pending-visits/pending-visits.html';
} else {
return '/packages/visitry-browser/client/visits/pending-visits/pending-visits.html';
}
},
controller: 'pendingVisitsCtrl as pendingVisits',
resolve:{
feedback: function($location){
Meteor.subscribe('visits');
var v = Visits.findOne({feedbackId});
if(v){
$location.url('/visits/'+v._id+'/feedback');
}
}
}
});
Basically I'm trying to do something similar to Uber's UI where if there is no feedback for the last event I display the feedback page. Thanks for the help. Let me know if you need any more code or information.