meteor

meteor js iron router: apply CSS change whenever route changes

↘锁芯ラ 提交于 2019-12-28 13:57:59
问题 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

meteor js iron router: apply CSS change whenever route changes

跟風遠走 提交于 2019-12-28 13:57:50
问题 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

Creating new Meteor collections on the fly

两盒软妹~` 提交于 2019-12-28 13:57:30
问题 Is it possible to create new Meteor collections on-the-fly? I'd like to create foo_bar or bar_bar depending on some pathname which should be a global variable I suppose (so I can access it throughout my whole application). Something like: var prefix = window.location.pathname.replace(/^\/([^\/]*).*$/, '$1'); var Bar = new Meteor.Collection(prefix+'_bar'); The thing here is that I should get my prefix variable from URL, so if i declare it outside of if (Meteor.isClient) I get an error:

Deploy meteor to own domain

 ̄綄美尐妖づ 提交于 2019-12-28 13:37:39
问题 I've been trying to deploy my meteor app onto my subdomain (meteor.youhock.sg) but it doesn't seem to be working. I've tried the steps stated on their documentations such as setting up subdomain dns zone to origin.meteor.com and mrt deploy meteor.youhock.sg Am I missing something? Thanks in advance 回答1: You can only use mrt deploy onto *.meteor.com. If you want to continue using their servers, do a CNAME to the subdomain you hosted. From the docs: You can deploy to any available name under

Connect two Meteor applications using DDP

僤鯓⒐⒋嵵緔 提交于 2019-12-28 10:07:32
问题 I have two applications that I need to synchronise. One of them will receive data from users and the other will display the data. Both applications will work on different servers. They could be disconnected at some times and they need to continue working until reconnect, so I will replicate the data from the first application on the second application. On Meteor documentation I found DDP.connect(url) but I'm not sure how to use it. I found many questions and examples connecting non Meteor

Connect two Meteor applications using DDP

走远了吗. 提交于 2019-12-28 10:07:25
问题 I have two applications that I need to synchronise. One of them will receive data from users and the other will display the data. Both applications will work on different servers. They could be disconnected at some times and they need to continue working until reconnect, so I will replicate the data from the first application on the second application. On Meteor documentation I found DDP.connect(url) but I'm not sure how to use it. I found many questions and examples connecting non Meteor

Can Meteor Templates access Session variables directly?

流过昼夜 提交于 2019-12-28 09:14:38
问题 In my Meteor app I find myself writing a lot of things like: Templates.myTemplate1.isCurrentUser = function() { return Session.get("isCurrentUser"); }; Templates.myTemplate2.isCurrentUser = function() { return Session.get("isCurrentUser"); }; I need many different templates (I'm using handlebars) to access the same simple value stored inside Session. Is there a way to avoid writing the same function over and over again? Thanks 回答1: As meteor is currently using handlebars as default templating

How to make an API call using meteor

守給你的承諾、 提交于 2019-12-28 07:40:22
问题 Ok here is the twitter API, http://search.twitter.com/search.atom?q=perkytweets Can any one give me any hint about how to go about calling this API or link using Meteor Update:: Here is the code that i tried but its not showing any response if (Meteor.isClient) { Template.hello.greeting = function () { return "Welcome to HelloWorld"; }; Template.hello.events({ 'click input' : function () { checkTwitter(); } }); Meteor.methods({checkTwitter: function () { this.unblock(); var result = Meteor

Keep meteor running on amazon EC2

只谈情不闲聊 提交于 2019-12-28 06:39:51
问题 I have a simple meteor app that I'm running on an Amazon EC2 server. Everything is working great. I start it manually with my user via meteor in the project directory. However, what I would like is for this app to Run on boot Be immune to hangups I try running it via nohup meteor & , but when I try to log out of the EC2 instance, I get the "You have running jobs" message. Continuing to log out stops the app. How can I get the app to start on startup and stay up (unless it crashes for some

How to increment a field in mongodb?

萝らか妹 提交于 2019-12-28 04:27:05
问题 I have the following Mongo DB document structure: { _id: channelId, title: channelTitle, pubDate: channelPubdate, items: [ { title: newsTitle, desc: newsDescription, link: newsLink, pubDate: Date, clicks: 0 }, {/*One more*/}, {/*...*/} ] } I have troubles incrementing the "clicks" field in the Collection (updating the field of a document embedded in an array). I tried this in an event handler (client): News.update({ _id : Session.get("channelId"), "items.link" : this.link }, { $inc: { "items