iron-router

Using Iron Router to waitOn subscription that's dependent on data from a doc that will come from another subscription

♀尐吖头ヾ 提交于 2019-11-28 11:12:50
I'm having trouble configuring the waitOn portion of a route where one of the subscription's parameters is determined by the value from a doc that comes from a different subscription. The collections in play are Candidates and Interviews. An interview will have one and only one candidate. Here's some sample data: candidate = { _id: 1 firstName: 'Some', lastName: 'Developer' //other props }; interview = { _id: 1, candidateId: 1 //other props }; The route is configured as follows. this.route('conductInterview', { path: '/interviews/:_id/conduct', //:_id is the interviewId waitOn: function () {

meteor js iron router: apply CSS change whenever route changes

末鹿安然 提交于 2019-11-28 09:28:32
I have homepage, contact page, and several other product related pages in my app. The goal is to apply a background image to ONLY specifc routes: /homepage and /contact . If user navigates away from either route, apply some css change. I am hacking this together now with a helper on my homepage, like so: Template.homepage.rendered = function () { var route = Router.current(); if ( route.path == '/' ) { document.body.className = "showBackgroundImage"; } }; Partial win here, since this will activate the css, but I need to deactivate when route changes. I have also tried the following within my

Meteor: Why is Iron Router's onBeforeAction called multiple times?

随声附和 提交于 2019-11-28 08:29:52
问题 When I visit a route in my browser I expect Iron Router to call onBeforeAction once before loading the route. But it looks like it is being called 3 times when first loading the route. This is an issue for me because I want to put code that redirects the user if they do not have access to that document. onBeforeAction: -> console.log 'called once' #Called 3 times when first loading the route! thread = Research.findOne(@params._id) console.log thread # This is undefined at first run thread =

Meteor: User Profile Page with Iron Router

扶醉桌前 提交于 2019-11-28 07:46:11
I'm struggling to create a user profile page, using Iron Router, which is located at localhost:3000/:username . The profile page should have the following characteristics: Public view - anyone can see basic information about the user Private view - if the client visits his or her own profile page while signed-in, his or her sensitive user data is shown and they have edit capabilities Loading view - while the user profile data is being fetched, show a loading screen Not found view - if invalid username is entered into the URL, return a not-found page. The public view and private view should

Meteor v 1.0 and Iron:Router

﹥>﹥吖頭↗ 提交于 2019-11-28 07:29:49
Is anyone else getting the following error from Iron-Router since upgrading Meteor to version 1.0? Please post here if you know how to resolve this issue. Route dispatch never rendered. Did you forget to call this.next() in an onBeforeAction ? Router.map(function () { Router.route('profileShow', { waitOn: function () { if (Meteor.user()) { Meteor.subscribe('userData'); } else { this.next(); } }, data: function () { if (Meteor.user()) { return {profile: Meteor.user().profile}; } } }); }); There was a non backwards-compatible change in the newest version of Iron Router. The migration guide says:

When using a regex in iron router, how to access the match?

烈酒焚心 提交于 2019-11-28 06:51:18
问题 Rather than having five different routes, I am trying to combined five different paths into a single function, but I still need to know which path it matched. So if I set up my route using a regex: Router.route(/^\/(accounts)|(contacts)|(forecasts)|(analytics)|(activities)/, function() { // which one did it match? console.log("matched "+this.params) //this returns an array of five params } how do I refer to the matched parameter inside the function? this.params returns an array of five params

Meteor data-context with iron-router

筅森魡賤 提交于 2019-11-28 05:57:19
问题 I am new to Meteor and I'm trying to set the data context in a page that displays one passage. I need to access the data in passage_item.js Template.passageItem.rendered but no context is set at that point. I think I need something like {{#with passage}} but "passage" does not exist in one_passage.html. Here are some code snippets. Thanks. router.js Router.map(function() { this.route('passagesList', {path: '/'}); this.route('onePassage', { path: '/passages/:_id', data: function() { return

Meteor infinite redirect instead of render 404

纵然是瞬间 提交于 2019-11-28 05:43:00
问题 I have a simple iron-router config in my /lib/router.coffee: Router.configure notFoundTemplate: "notFound" Router.map -> @route "app", path: "/" template: "app" When entering on / it's works, but if I try go to /abc then it redirects me at /#!abc, after that it redirects me at /abc and so repeated endlessly (I see these changes in the address bar of a browser, in the browser log redirection from / to /abc and back). I never see a 404 error. Has anyone encountered such behavior? I use Meteor

Meteor, where to put d3 code?

假如想象 提交于 2019-11-28 02:06:49
问题 I use meteor, iron-router, and d3. d3 is used to reactively display a pie chart based on the data, which I calculate in the data function of iron-router. So, I want to the d3 to run when the dom is in place. However, I don't know where I should put the d3 code. I used to put it in the data function that I generate the data. However, sometimes the data function is computed while the dom is not ready (so d3 cannot draw the chart). I would want to run d3 after the dom is completely rendered, and

Meteor with iron-router cant get slick carousel working

早过忘川 提交于 2019-11-28 01:30:21
I am using iron-router, i have a route "models" which has a list of items. When the user clicks one of these items a new route "model" is used, the name of the selected item is passed as a param and used to load data about that model from the database. I want to use slick carousel, using an array of images returned from the database (based on the param). <div id="carousel"> {{#each images}} <div class="item"> <img src="/images/{{this}}" alt=""> </div> {{/each}} </div> Where should I call the slick init? Generally speaking, you should initialize plugins in a template's onRendered callback. In