iron-router

Iron Router data fires 3 times

若如初见. 提交于 2019-12-06 12:27:46
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. This is a normal behavior, data like most route methods is run inside a reactive computation. In your data method you depend on this

Iron:router 1.0.9 Not working

二次信任 提交于 2019-12-06 10:23:01
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 Function.Route.dispatch (http://localhost:3000/packages/iron_router.js

Iron-router nested routes with multiple parameters

大兔子大兔子 提交于 2019-12-06 09:06:34
问题 I have two models: sites and articles . Each site can have multiple articles. I would like to view the article in the route like this: /siteName/articleFriendlyTitleUrl . At the moment I have helper method to make friendly urls like this: getFriendlyUrl = function(urlString){ urlString = urlString.toLowerCase(); urlString = str.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '-'); return urlString; } And my router.js file: this.route('showArticle', { path: '/article/:title'), layoutTemplate:

Meteor Iron Router does not get Current Path from Route

╄→尐↘猪︶ㄣ 提交于 2019-12-06 06:48:54
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 According to this iron-router/issues/289 there are problems when the path contains parameters. The suggestion

Meteor's Iron Router doesn't close modal dialog

蹲街弑〆低调 提交于 2019-12-06 03:47:40
问题 I'm using Meteor and Iron Router, and I have a modal dialog that won't hide the backdrop when it gets dismissed. To be more accurate, I want that after clicking the dismiss button, the iron router will redirect to another page. The redirection code does work, but the backdrop stays visible. If I remove the routing line - the modal is dismissed and so does the backdrop. Here is the modal's markup: <div class="modal fade" id="confirm-modal" tabindex="-1" role="dialog"> <div class="modal-dialog

meteor iron-router nested routes

醉酒当歌 提交于 2019-12-06 03:14:34
问题 I have two meteor collections with a one-to-many relationship: buildings and spaces On my building page, I want to show the spaces related to the building. For now, I did it this way: buildingsRoute.coffee BuildingController = RouteController.extend(template: "buildings") Router.map -> @route "building", path: "/buildings/:_id" waitOn: -> subs.subscribe "allBuildings" subs.subscribe "allSpaces" data: -> building: Buildings.findOne(@params._id) spaces: Spaces.find({building_id: @params._id})

Pause routing in Meteor's Iron Router while a page transition completes

冷暖自知 提交于 2019-12-06 02:53:34
问题 In my Meteor app I have some complex page animations that require a few seconds to complete (instructive animations take priority over page transition speed). There's an out state and an in state in the animation. For simplicity's sake, let's say I need to fade out one page, and then fade in the next, but that I want those fades to take multiple seconds. To do this I use Meteor's Iron Router to call some animation functions that manipulate the CSS. lib/router.js animateContentOut = function

Pushing new state for same URL in Iron-Router

泪湿孤枕 提交于 2019-12-05 22:51:15
Can I use Iron-Router in Meteor to push a new state onto the browser's history, without going to a new URL? I would like to show a modal but enable to user to hide it again using the back button. hharnisc AFAIK you can't push browser state "silently" with the Iron Router package. However you can use one of these methods or the HTML 5 History API package that wraps this package - https://github.com/devote/HTML5-History-API Dan Dascalescu Haven't tried this, but I think something based on Router.go(Router.current().request.url + '/modal')` might work. You define your route with an optional

IronRouter extending data option on route controller

不羁的心 提交于 2019-12-05 17:39:07
问题 Is there a way to extend the data option when using IronRouter and the RouteController , It seems like it gets overridden when I inherit from a super controller, the child controller doesn't extend the defined data properties. I have had similiar issues with the yieldTemplates option on a route and used a workaround (underscore _extends) but it didn't work in this case: ApplicationController = RouteController.extend({ data: function(){ return { user: Meteor.user() } } }); ChildController =

Creating active navigation state with Meteor and Iron Router

*爱你&永不变心* 提交于 2019-12-05 16:58:10
I want to add a class of 'active' to the nav list item that is currently being rendered by Iron Router. Here's my markup: <ul> <li> {{#linkTo route="option1"}} <span class="fa fa-fw fa-option"></span> Option 1 {{/linkTo}} </li><li> {{#linkTo route="option2"}} <span class="fa fa-fw fa-option"></span> Option 2 {{/linkTo}} </li> </ul> I've read through the guide and various articles but can't find this covered anywhere. Assuming I'll need some sort of helper? I think you might find meteor-iron-router-active useful, as it has helpers for the following: isActiveRoute isActivePath Here's how I do it