iron-router

How do you render multiple templates with one route controller using iron-router?

房东的猫 提交于 2019-12-11 02:58:09
问题 URL to current version of my project Here is the code for my project Background: I am making a blog using meteor and iron-router. I want to use a single controller for several different "category pages," which filter a list a blog articles in the yield region. The Problem: The article list does not get rerendered when the URL changes. I.e. the article list is not reactive. Interestingly, if I navigate back to the home page, the correct article list shows up. The Question: How do I make that

Meteor deploy Iron:Router “oops looks like there's no route on the client or the server for url”

╄→尐↘猪︶ㄣ 提交于 2019-12-11 02:30:59
问题 When I deploy using "meteor deploy mysite.com" or "meteor deploy mysite.meteor.com" I get the error: "oops looks like there's no route on the client or the server for url". I don't have this issue on localhost. I don't see anything unusual on "meteor logs mysite.com" Basically, if the user is not logged in then the page should be redirected to the welcome page. Here is a snippet of the code. Any ideas? Router.onBeforeAction(function () { if (!Meteor.user() && !Meteor.loggingIn()) { this

Iron Router onBeforeAction isn't being called

℡╲_俬逩灬. 提交于 2019-12-11 02:28:27
问题 I have a /user route set up, which is supposed to render the login template if the current user isn't logged in. The entire router has a waitOn that waits for the currentUser subscription to finish. The problem is that when I go to /user it simply renders the dataNotFound template instead. Here's the snippets of code that are relevant to this situation. I've been careful to show you them in the order they're defined in my lib/router.js file. Router.plugin('dataNotFound', {notFoundTemplate:

Bootstrap navbar stays expanded on route change

∥☆過路亽.° 提交于 2019-12-11 01:08:28
问题 I've got a Meteor project which uses iron-router. In my project I have a bootstrap navbar and unfortunately whenever I navigate to a route while the navbar is expanded (due to the screen being min width), the navbar remains expanded when I go to a new route. Is there a way to set the navbar to collapse again upon changing routes like it would with a usual page refresh? Edit: Navbar Template: <template name="navigation"> <nav class="navbar navbar-default"> <div class="container-fluid"> <div

Limit Google Sign-In to .edu accounts in Meteor

最后都变了- 提交于 2019-12-10 21:27:37
问题 I'm trying to limit my Google + Sign-In Button to only allow @something.edu accounts to sign in. How would I go about doing this. This is my code so far: Template.googleLogin.events({ 'click #gLogin': function(event) { Meteor.loginWithGoogle({}, function(err){ if (err) { throw new Meteor.Error("Google login didn't work!"); } else { Router.go('/home') } }); } }) Template.primaryLayout.events({ 'click #gLogout': function(event) { Meteor.logout(function(err){ if (err) { throw new Meteor.Error(

Template can't find my named iron-router route

我怕爱的太早我们不能终老 提交于 2019-12-10 20:31:21
问题 In a meteor project using iron-router, a pathFor in my template can't find a named route. I think I've adhered to the syntax in the guides. Here's the spacebars code: <a href="{{pathFor 'tag.show' _id=this._id }}" class="tag" id="{{title}}">{{title}}</a> And here's the iron-router code: Router.route('/tags/:_id', function() { this.layout('layout'); this.render('tags'); this.render('tagDetail', { to: 'topDrawer', data: function() { return Tags.findOne({ _id: this.params._id }); } }); }, { name

How to write Iron-router nested template?

别来无恙 提交于 2019-12-10 16:33:32
问题 I have 2 templates: 1) mainLayout.html -> general layout which must be used by all pages. (e.g. page title, navbar, footer) Router.configure({ layoutTemplate: 'mainLayout' }) <template name="mainLayout"> {{> header}} <div class="container-fluid"> {{> yield}} </div> </template> 2) specialLayout.html -> custom layout which is inheriting main-layout.html but with additional template (e.g. side/tab menu) How should I define specialLayout ? Note that specialLayout should have the title, navbar,

Iron:router 1.0.9 Not working

此生再无相见时 提交于 2019-12-10 10:57:28
问题 I have recently installed a new meteor project, and added iron:router 1.0.9 But when i add route configurations i get a blank page and a console error of: Exception in callback of async function: ReferenceError: EJSON is not defined at MiddlewareStack.concat (http://localhost:3000/packages/iron_middleware-stack.js?ff70621b6c5f6a406edc60600c4b76126dae21d6:303:25) at RouteController._runRoute (http://localhost:3000/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:542:17) at

Meteor Iron Router does not get Current Path from Route

一曲冷凌霜 提交于 2019-12-10 10:44:55
问题 In a Template Helper I get the current path from Iron.Router (iron:router) as follows: Router.current().route.path(this); This works fine, unless the route path does contain parameters (e.g. /client/:_id/edit) . In that case the path() function returns null . How do I get the current path within a Template Helper, when the route contains parameters? There are posts around covering the issue but the solution mentioned there seem not to fit. I'm using Meteor 1.1.5 with iron:router1.0.7 回答1:

Iron Router data fires 3 times

隐身守侯 提交于 2019-12-10 10:37:10
问题 I have this route set up with a loding template on Router.Config Router.onBeforeAction('loading'); this.route('clients', { path: '/clients', template: 'clientsAll', waitOn: function () { return Meteor.subscribe('clientsAll'); }, data: function () { if (this.ready()) { console.log("Data"); return Clients.find().fetch(); } } }); Everything works fine it displays the loading template before rendering the template, but on the log it shows data being fired twice. 回答1: This is a normal behavior,