meteor

Multiple subscriptions in iron router

心已入冬 提交于 2019-12-20 09:42:37
问题 I have been working on an application using a comment function. That results in having to subscribe to both a collection which the comments are made on and the comments collection itself. Now it looks like this: <template name="bookView"> {{> book}} {{> comments}} </template> this.route('book', { path: '/book/:_id', template: 'bookView', waitOn: function() { return Meteor.subscribe('book');}, action: function () { if (this.ready()){ this.render(); } else this.render('loadingTemplate'); },

Meteor - automatically updating canvas with subscribed data?

本小妞迷上赌 提交于 2019-12-20 09:40:40
问题 I might be missing something, but it seems that Meteor's "magic" revolves around binding data to DOM elements, and updating text and HTML fragments via handlebars: http://docs.meteor.com/#reactivity This is great, however , when trying to write a meteor app that displays live data in a <canvas> element, I cannot figure out the "meteor way" to update my canvas when the live data changes, since the canvas is populated via JS code like: var g = canvas.getContext('2d') g.fillRect(x, y, w, h) and

unable to add roles to user with meteor using 'roles' package

可紊 提交于 2019-12-20 09:36:56
问题 I'm trying to use the 'roles' package available on Atmosphere but I can't get it to work with Accounts.onCreateUser(), I can get the example on github. When I register a user, I want to add a role to them, when I test whether the role is assigned, it's not picking it up. Here's my code /server/users.js Accounts.onCreateUser(function(options, user){ var role = ['admin']; Roles.addUsersToRoles(user, role); return user; }); /client/page.js Template.hello.events({ 'click input': function () { var

How does one actually use Markdown with Meteor

非 Y 不嫁゛ 提交于 2019-12-20 09:03:13
问题 I'm working on a project with Meteor, and I want it to use markdown, and it was very nice to see that there is a package to do that with. So I meteor added showdown, it worked, and now I can do something like {{#markdown}} #This is a header this is a paragraph {{/markdown}} and it works just fine. But now I want to actually put something more interesting in there. First thought was to sync it up with a textarea. I tried three things. First, I tried this: $('.preview').html('{{#markdown}}'+$('

file is being assigned a //# sourceMappingURL but already has one

回眸只為那壹抹淺笑 提交于 2019-12-20 08:27:51
问题 I just notice Firefox console outputs the following error for every single .js/.coffee file in my project (even the packages). -file- is being assigned a //# sourceMappingURL, but already has one Chrome's console doesn't show anything. I tried deleting all the .map files and clearing Firefox's cache but I'm still getting the errors. 回答1: It's a warning (not an error) and it is a bug ( https://bugzilla.mozilla.org/show_bug.cgi?id=1020846 fixed in FF 33) This warning/error also applies to other

How do I setup an api to access my meteor collection?

浪子不回头ぞ 提交于 2019-12-20 07:18:10
问题 Using another website, i would like to know how many documents match a query in my meteor application (through an api call of some sort?). What is the best way to achieve this? 回答1: The simplest way to do so is to add item to WebApp stack, for example: WebApp.connectHandlers.stack.splice (0, 0, { route: '/api/path', handle: function(req, res, next) { var count = Documents.find({}).count(); res.writeHead(200, { 'Content-Type': 'application/json', }); res.write(JSON.stringify({count: count}));

Meteor Template.onRendered or Template.rendered for using a jquery library?

霸气de小男生 提交于 2019-12-20 07:13:04
问题 I want to use chosen(a jquery library) with meteor and I just need to use this code: $('#ship').chosen(); I tried using .onRendered but I need to wait, if I want it to work Template.createTradeForm.onRendered(function(){ //Strange bug, need to wait here or it doesn't work.. setTimeout(function(){ $('#ship').chosen(); }, 2000); }); Same problem with this solution: Template.createTradeForm.rendered = function(){ //here again, I need to wait or it doesn't work setTimeout(function(){ $('#ship')

Cannot add package iron router for meteor on windows 8.1 pro

南楼画角 提交于 2019-12-20 06:45:01
问题 I installed meteor on windows from http://win.meteor.com/. I was trying to install iron router package for meteor on windows 8.1 by downloading following repositories git clone https://github.com/tmeasday/meteor-router.git After downloading i renamed the folder to iron-router. Then i downloaded other repositories git clone https://github.com/tmeasday/meteor-page-js-ie-support.git git clone https://github.com/tmeasday/meteor-HTML5-History-API.git git clone https://github.com/EventedMind/blaze

Updating array of objects in mongodb

独自空忆成欢 提交于 2019-12-20 06:37:20
问题 I'm trying to update an array of objects in my simple-schema. Currently, it removes everything in the database and leaves behind: "careerHistoryPositions": [] My simple-schema looks like: const ProfileCandidateSchema = new SimpleSchema({ userId: { type: String, regEx: SimpleSchema.RegEx.Id }, careerHistoryPositions: { type: Array, optional: true }, 'careerHistoryPositions.$': { type: Object, optional: true }, 'careerHistoryPositions.$.uniqueId': { type: String, optional: true },

Meteor mongodb $inc with update

冷暖自知 提交于 2019-12-20 06:36:51
问题 I have this mongo collection and vars: items:{ type_one: 0, type_two: 0 } var valueOne = 1; var nameItem = type_one; I try to update a value, but not work. I tried this: Collection.update({createdBy: user_id}, {$inc: { items.$.nameItem: valueOne}} ); Collection.update({createdBy: user_id}, {$inc: { "items.$.nameItem": valueOne}} ); Collection.update({createdBy: user_id}, {$inc: { "items."+nameItem: valueOne}} ); Collection.update({createdBy: user_id}, {$inc: { "items."+nameItem: 1}} ); var