Reputation: 12092
Im getting the "waiting on local host" in Chrome and Firefox but doubt there is an issue with browsers with my laptop; the issue is with Iron Router. See my router.js:
Router.configure({
layoutTemplate: 'layout',
loadingTemplate: 'loading',
notFoundTemplate: 'notFound',
waitOn: function() { return Meteor.subscribe('jobs'); }
});
Router.route('/', {name: 'jobsList'});
Router.route('/jobs/:_id/', {
name: 'jobPage',
data: function() { return Jobs.findOne(this.params._id); }
});
// route to edit a job post
Router.route('/jobs/:_id/edit/', {
name: 'jobEdit',
data: function() { return Jobs.findOne(this.params._id); }
});
Router.route('/jobs/create', {name: 'jobCreate'});
var requireLogin = function() {
if (! Meteor.user()) {
if (Meteor.loggingIn()) {
this.render(this.loadingTemplate);
} else {
this.render('accessDenied');
}
} else {
this.next();
}
}
Router.onBeforeAction('dataNotFound', {only: 'jobPage'});
Router.onBeforeAction(requireLogin, {only: 'jobCreate'});
Going to /jobs/sgjdhdbhbbd
the page does not load, but if I change Router.route('/jobs/:_id/', {
to Router.route('/:_id/', {
, the page loads. I am lost. Are there any tweaks to try?
********EDIT********
I am also using Polymer if that helps.
Upvotes: 0
Views: 256
Reputation: 12092
Thank you all for your support. I should have mentioned I was using Polymer in the first my so my apologies.
The issue is with Polymer as discussed here. I have done what ThaumRystra said and all is well.
I have solved the issue by including a trailing forward slash on all polymer imports:
Replace:
rel="import" href="bower_components/paper-toast/paper-toast.html">
rel="import" href="bower_components/paper-fab/paper-fab.html">
With:
rel="import" href="/bower_components/paper-toast/paper-toast.html">
rel="import" href="/bower_components/paper-fab/paper-fab.html">
If you have an image src url, include the forward slash at the front and it will display.
Upvotes: 1
Reputation: 332
I think the problem comes from here:
Router.route('/jobs/create', {name: 'jobCreate'});
The "create" is used as "id" on your route 'jobCreate'
Just try something like this
Router.route('/jobs/view/:_id/', {
name: 'jobPage',
data: function() { return Jobs.findOne(this.params._id); }
});
// route to edit a job post
Router.route('/jobs/edit/:_id/', {
name: 'jobEdit',
data: function() { return Jobs.findOne(this.params._id); }
});
Router.route('/jobs/create/', {name: 'jobCreate'});
EDIT:
The source of problem is here:
Router.route('/jobs/:_id/', {
All path after /jobs/ is used as :id
Upvotes: 0