iron-router

Meteor infinite redirect instead of render 404

我的梦境 提交于 2019-11-29 11:56:37
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 v1.0.2.1. There is my meteor list: alethes:lodash 0.7.1 appcache 1.0.3 coffeescript 1.0.5 ground

Route to the new data submitted by Meteor autoform using iron router?

大憨熊 提交于 2019-11-29 10:14:20
I'm using Meteor with AutoForm & Iron Router. I have an autoform for inserting a data, and I want to redirect to the page of the data I added after a successful insert. How should I do it? Here is the For: {{#autoForm collection="Products" id="add" type="insert"}} <h4 class="ui dividing header">Products Information</h4> {{> afQuickField name='name'}} {{> afQuickField name='info'}} <button type="submit" class="ui button">Insert</button> {{/autoForm}} Iron Router: Router.route('/products/:_id', { name: 'page', data: function() { return Products.findOne(this.params._id);} }); Callbacks/Hooks

Meteor, where to put d3 code?

冷暖自知 提交于 2019-11-29 08:47:39
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 the function can access the result of the data function. I tried to use hooks onAfterAction, but it

Meteor: iron-router => waitOn without subscribe

会有一股神秘感。 提交于 2019-11-29 08:41:41
i want a loading template to appear before the site has all data to be rendered. And after the serverside Method gives me the Data(from an API [async]) via Meteor.call i want to load the correct layout. I tried many ways found on Google which describe similar but not exatcly the same problem. Including the way to define a function with ready handle, also doesn´t work. I can´t get it running. i don´t want to use Collections because this is user specific Data.( i think this is not efficient to make a collection for each user [no logged in users], or do i miss something) Is this possible? Here my

Materialize: dropdown in “if” statement doesn't work

▼魔方 西西 提交于 2019-11-29 08:01:52
I tried to implement a dropdown list that is only visible when the user is signed in. The dropdown list works when outside the "if" statement but not inside. The buttons "Foo" and dropdown button are shown, however it doesn't "dropdown". header.html <!-- Header --> <template name="header"> <nav> <div class="nav-wrapper"> <a class="brand-logo" href="{{pathFor 'home'}}">Logo</a> <ul id="nav-mobile" class="right hide-on-med-and-down"> {{#if currentUser}} <!-- dropdown1 trigger --> <li> <a class="dropdown-button" href="#!" data-activates="dropdown1"> <i class="mdi-navigation-more-vert"></i> </a> <

How to check for Route through route name in template with Meteor and Iron Router

╄→гoц情女王★ 提交于 2019-11-28 20:24:55
What can I use in a template to figure out the route name that is associated with the route that I am currently on? For example if I configured a route like so in iron-router this.route('quick', { path: '/wow/:_id', template: 'create_question' }); So if I am on the route /wow/123 how can I get the router's name in my template, in this case how can I get quick in my template? I'm simply looking for a function, I am sure I can use a handlebars helper to get the rest done. I just need a function to call. iron-router > 1.0 var routeName = Router.current().route.getName(); iron-router < 1.0 var

Redirecting not logged-in users with iron-router… Again

蹲街弑〆低调 提交于 2019-11-28 18:21:28
I am fighting with the common need for redirecting a user to a login page if he is not logged-in (Meteor v0.8.0 on Windows 7). There are several similar questions on stackoverflow, but no answer seems to work for me. Won't work #1: render() From the documentation : onBeforeAction: function () { if (!Meteor.user()) { // render the login template but keep the url in the browser the same this.render('login'); // stop the rest of the before hooks and the action function this.stop(); } }, Two issues here: 1- The documentation is outdated. There is no this.stop() function anymore. As stated here ,

Redirect after Login using Meteor and Iron Router

北城余情 提交于 2019-11-28 17:55:24
I'm using the built in loginButtons options with Meteor and I would like to redirect after a user logs in. Using the built in web snippets means I can't use the callback with Meteor.loginwithPassword and I can't see any hooks inside Iron-Router to do the redirect. Any suggestions? Charlie Morris Meteor often renders so quickly that the page is being loaded before the user has been defined. You need to use Meteor.loggingIn() to account for the situation in which you are in the process of logging in. This code works for me: this.route('myAccount', { path: '/', onBeforeAction: function () { if (!

How to get the query parameters in Iron-router?

人盡茶涼 提交于 2019-11-28 17:53:17
I am trying to get the query parameters in the url. There doesn't seem to be an easy way to do this... which leaves me with the feeling that I must have missed a something in the doc. iron router >= 1.0 A route's query parameters are available as properties of this.params.query . If your URL looked like: /posts/5?sort_by=created_at then this.params.query.sort_by would equal 'created_at' . iron router < 1.0 A route's query parameters are available as properties of this.params . If your URL looked like: /posts/5?sort_by=created_at then this.params.sort_by would equal 'created_at' . Just call

How do I access HTTP POST data from meteor?

时光怂恿深爱的人放手 提交于 2019-11-28 12:11:44
I have an Iron-router route with which I would like to receive lat/lng data through an HTTP POST request. This is my attempt: Router.map(function () { this.route('serverFile', { path: '/receive/', where: 'server', action: function () { var filename = this.params.filename; resp = {'lat' : this.params.lat, 'lon' : this.params.lon}; this.response.writeHead(200, {'Content-Type': 'application/json; charset=utf-8'}); this.response.end(JSON.stringify(resp)); } }); }); But querying the server with: curl --data "lat=12&lon=14" http://127.0.0.1:3000/receive Returns {} . Maybe params doesn't contain post