iron-router

Configuring Iron Router in Meteor - React

别等时光非礼了梦想. 提交于 2019-12-03 20:36:12
Using Meteor 1.2.0.1 and React. My simple app works great but now I needed iron router . app layout: client\ app.jsx lib\ router.jsx server views\ home.jsx layout.jsx home.jsx: Home = React.createClass({ render() { return ( <div> <h3>Hello World</h3> <p>from home</p> </div> ); } }); layout.jsx: Layout = React.createClass({ render() { return ( <div> {this.props.children} </div> ); } }); routes.jsx: Router.route('/', () => { let page = ( <Layout> <Home/> </Layout> ); React.render(page, document.body); }); Surely enough, in my app.jsx , works great as it displays to the body of the html but the

Passing query parameters using Router.go in iron router

不想你离开。 提交于 2019-12-03 17:15:40
问题 I am trying to pass query parameters in Router.go like below: var filter = 'abc'; var path = Router.current() && Router.current().path; Router.go(path, {query: {filter: filter}}); But this does not change the url, it stills loads current path without query string only. But if I add the query parameter manually to path like: Router.go(path+'?filter='+filter); this works fine. But since I am trying to load same page with some filtered data. So clicking filter button repeatedly appends the

Previous page location on IronRouter

余生颓废 提交于 2019-12-03 16:51:18
Is there a way to get the previous page location before going to the next page in IronRouter? Is there an event I can use to fetch this information? Thanks in advance. You can achieve the behavior you want by using hooks. // onStop hook is executed whenever we LEAVE a route Router.onStop(function(){ // register the previous route location in a session variable Session.set("previousLocationPath",this.location.path); }); // onBeforeAction is executed before actually going to a new route Router.onBeforeAction(function(){ // fetch the previous route var previousLocationPath=Session.get(

Using onResetPasswordLink, onEnrollmentLink, and onEmailVerificationLink methods properly in Meteor

情到浓时终转凉″ 提交于 2019-12-03 12:35:40
I was wondering if someone would be kind enough to provide a meteorpad or code example of using one of the methods listed above properly in Meteor (with iron:router). I'm struggling to understand how exactly these methods interact with my app, and it seems these methods are new enough that there isn't much good documentation on how to use them correctly. Thanks! http://docs.meteor.com/#/full/Accounts-onResetPasswordLink Ok, so I am going to post what I ended up learning and doing here so others can use it as a reference. I'll do my best to explain what is happening as well. As can be seen in

Page transitions in meteor?

醉酒当歌 提交于 2019-12-03 09:29:25
I've got a meteor mobile app structurally working; I really need to stitch the views together with some page transitions. I looked at the iron-transitioner project but it looks like development has ceased? (last commit 6 months ago, still using Spark engine) I've also looked at a few UI 'mobile frameworks' (Ratchet, Framework7) but I couldn't get them to play nicely with the meteor server. I'm wondering if anyone knows of any other simple (left/right) page transition package / script that I could try? It's just to give my UI some (expected) slickness really. What about some jQuery with

understand new mongo id and use it with iron-router

…衆ロ難τιáo~ 提交于 2019-12-03 09:16:38
i have a simple post route that looks for the post _id . The problem is that the pathFor helper creates a path like this: ObjectID("52e16453431fc2fba4b6d6a8") I guess the mongoDB insertion as been changed and now the _id object holds another object inside it called _str . Here is my route: this.route("post", { path: "/post/:_id", waitOn:function(){ NProgress.start(); Meteor.subscribe("Teams"); }, before: function () { NProgress.done(); }, data: function () { return Posts.findOne({_id: this.params._id}); } }); Currently, it creates an href like : post/ObjectID("52e16453431fc2fba4b6d6a8")

MeteorJS + Iron-Router: How can I call the next item in the collection using pathFor?

我的未来我决定 提交于 2019-12-03 09:07:22
I did a lot of research before posting this question and couldn't find the answer. I'm sure it's a simple task, but it's going over my head for some reason. I have a "posts" type page that lists all items in my collection, and a "single post" page to display the contents of the selected post. I have two pagination arrows for going to the previous item and next item. How can I grab the URL for the previous/next posts and display it in my template? Any help would be appreciated, thanks! I created sample application which exactly do what you need. Please check it : https://github.com/parhelium

Meteor breadcrumb

瘦欲@ 提交于 2019-12-03 08:52:56
How do I implement a reactive breadcrumb with Meteor and iron-router? Now I'm looking for the current path, triggered by a reactive session variable and then adding each link that corresponds to that route inside the DOM with jQuery . You can call Router.current().path inside a helper function and it will return the current path. Then split the path on / and return the array to your breadcrumbs template. The function is reactive, so updates will propagate: Template.breadcrumbs.path = function() { return Router.current().path.split( "/" ); } With Meteor 1.0 and Iron.Router it would be: Template

Passing query parameters using Router.go in iron router

自古美人都是妖i 提交于 2019-12-03 06:22:44
I am trying to pass query parameters in Router.go like below: var filter = 'abc'; var path = Router.current() && Router.current().path; Router.go(path, {query: {filter: filter}}); But this does not change the url, it stills loads current path without query string only. But if I add the query parameter manually to path like: Router.go(path+'?filter='+filter); this works fine. But since I am trying to load same page with some filtered data. So clicking filter button repeatedly appends the filter string again and again to path. What is the correct way of passing query string using iron router?

Meteor, Iron:Router Passing Multiple Properties on Router.go

和自甴很熟 提交于 2019-12-03 00:07:10
My dilemma is that I would like to pass multiple object properties to an iron:router route in Meteor. The reasoning is that I would like to pass it a property to name my url with and a property to find a collection item with. They are completely independent of each other and I can't use the url property because it is not a value in the collection item. This is what I have: Template.items.events({ 'click': function () { itemName = this.name.replace(/ /g,'') Router.go('itemDetails', {itemName: itemName}) } }); The problem is that although the Router handles this fine and sends me to the correct