iron-router

How to make onBeforeAction call wait until a function call inside finishes in meteor.js?

风流意气都作罢 提交于 2019-12-11 13:05:18
问题 I have a synchronized onBeforeAction method with meteor.js Router.onBeforeAction(function() { var self; self = this; authToken = Session.get('authToken'); if (!authToken) { this.redirect('login'); this.next(); } else { Meteor.call('validateAuthToken', authToken, function (error, result)) { if (result) { self.next(); } else { self.redirect('login'); self.next(); } } } }); I need to validate an authentication token stored in Session by invoking a server call. But this method always throws an

Do RouteControllers need to be defined in server code for iron-router@1.0.0-pre3

ε祈祈猫儿з 提交于 2019-12-11 09:12:36
问题 While attempting to migrate from Meteor 0.8.3 & IR 0.8.2 to Meteor 0.9.3.1 & IR 1.0.0-pre3 I'm running into a problem with RouteControllers. I have the following js in the '/both' folder of the project: Router.route('scene.index', { path: '/', controller: 'SceneController' }); And the SceneController js in the '/client' tree: SceneController = RouteController.extend({ template: 'SceneView' ... }); When attempting to access the route from the client, I get the following error: Error:

Trying to Migrate to Iron-Router from Router

安稳与你 提交于 2019-12-11 08:56:24
问题 I am trying to migrate from router to iron-router but having a problem with my entire page not rendering correctly. The only template that is rendering is what is produced from the "> yield". Any of the other code in my HTML, file is not rendered. I would like everything on the page to remain static. But I want the template in yield to change based on the url. What am I missing in the configuration to make it behave that way? HTML: <head> <title>carpool</title> <meta name="viewport" content=

Appropriate way of using yield with region

孤街醉人 提交于 2019-12-11 05:23:31
问题 I am newbie to meteor.js. I was curios what is the best practice of using yield with region. Should I use all my yield/yield with region in layout.html, or can I also use them in sub-templates. For example, I have two templates(contacts, and about). Contacts has side bar menu and according to the selection, the area next to sidebar will be changed dycamically, but in about template, I do not have sidebar menu. So should I define my contacts template like below? <template name="contacts"> {{

Material Design Lite layout has changed after installing Iron:router

谁说我不能喝 提交于 2019-12-11 04:35:26
问题 I created a meteor project and added krazyeom:material-design-lite package. Then I created 2 simple html files, one that contains <head>...</head> and another that contains <body>...</body> My design looks something like this: After I added the iron:router and only replaced <body> with <template name="layout"> and </body> with </template> . Router.route('/', {name: 'layout'}); It looks like this: As you can see the design is now not 100% height; and if I resize to mobile resolution, it doesn

Meteor: Modify collection on a route change using Iron Router

久未见 提交于 2019-12-11 04:17:23
问题 So I'm working on a forum type app. When the user navigates to a post, the url will be www.myapp.com/post/POSTID . I'm using Iron Router to handle the routing. Upon entering AND leaving this post, I want to update a collection to indicate that the user has seen the post. I know that in Iron Router, if you modify one of the underlying subscriptions that the route is subscribed to, you run into an infinite reactivity loop. I was trying to update the collection in action() before, but got an

Does using Meteor with React mean that you don't have to use IronRouter or FlowRouter?

◇◆丶佛笑我妖孽 提交于 2019-12-11 04:04:33
问题 I've been exploring more about Meteor with React but one question that hasn't been answered going through their documentation is whether React removes the need for a router or rather if it simply removes the need to bind the collection to the Router and abstracts that essentially rendering the router to only that function; routing. Does this make sense? What i'm trying to figure out is if IronRouter will suffice with my Meteor+React app or if I should move to the FlowRouter paradigm if I'm

Meteor: App does not work on 0.9.1.1 version

风流意气都作罢 提交于 2019-12-11 04:01:51
问题 Getting errors like [Error] TypeError: 'undefined' is not a function (evaluating 'Template.__create__') (anonymous function) (iron-dynamic-template.js, line 416) (anonymous function) (iron-dynamic-template.js, line 433) [Error] TypeError: 'undefined' is not an object (evaluating 'Parent.prototype') [Error] TypeError: 'undefined' is not a constructor (evaluating 'new Iron.Layout({template: this.options.layoutTemplate})') [Error] ReferenceError: Can't find variable: Template [Error]

Infinite Scrolling in Iron Router based on Discover Meteor

强颜欢笑 提交于 2019-12-11 03:45:41
问题 I can't seem to get the infinite scrolling to work from Commit 12-5. It says just to mrt add iron-router-progress and everything should work, but my page keeps refreshing. Here's what I'm working with: PostsListController = RouteController.extend({ template: 'blog', increment: 20, limit: function() { return parseInt(this.params.postsLimit) || this.increment; }, waitOn: function() { return Meteor.subscribe('posts', this.limit()); }, posts: function() { return Posts.find({}, { limit: this.limit

Why iron-router does not render carousel?

故事扮演 提交于 2019-12-11 03:06:32
问题 it works perfectly when I make it like this <body> {{> carousel}} </body> <Template name="carousel"> ....here the code of carousel... </Template> but when I use iron-router to render the Template; it does not render carousel <body> {{rendreRouter}} </body> <Template name="carousel"> ....here the code of carousel... </Template> Router.map(function () { this.route('carousel',{ path: '/' }); }); 回答1: I'm coming to the conclusion that the documentation you're reading is not in sync with the code