meteor

Using this.added in Meteor

陌路散爱 提交于 2019-12-25 04:20:45
问题 I'm trying to transform a publication, and this is my code: Meteor.publish('appointments.waiting', function () { var self = this, count = 0; Appointments.find().forEach(function (appointment) { var patients = Patients.find({_id: appointment.patient_id}).fetch(); var first_name = patients[count].profile.first_name, middle_name = patients[count].profile.middle_name, surname = patients[count].profile.surname, name = surname + ', ' + first_name + ' ' + middle_name; self.added('appointments',

Tracker afterFlush error : Cannot read value of a property from data context in template rendered callback

守給你的承諾、 提交于 2019-12-25 04:12:21
问题 I'm making a simple Meteor app that can redirect to a page when user click a link. On 'redirect' template, I try get the value of property 'url' from the template instance. But I only get right value at the first time I click the link. When I press F5 to refresh 'redirect' page, I keep getting this error message: Exception from Tracker afterFlush function: Cannot read property 'url' of null TypeError: Cannot read property 'url' of null at Template.redirect.rendered (http://localhost:3000

Loading a Large Collection in a Meteor App

戏子无情 提交于 2019-12-25 03:57:41
问题 In a Meteor app, a large collection containing 1000 records is published to the client. However users loading the {{loginButtons} will experience a 3-5 second lag as it fully renders only after all the large collection loads. It appears that the div #login-buttons rendered by {{ loginButtons }} is rendered instantly on page load, but the div #login-dropdown-list is what's taking some time to start rendering. #login-dropodown-list template The site is using Meteor 0.7.0.1 with Iron Router.

Meteor filter for each

送分小仙女□ 提交于 2019-12-25 03:57:13
问题 i have a problem with filter and each. i want create a filter, that will change data according to that filter. <select id="filter"> <option value="all">all</option> <option value="one">one</option> <option value="two">two</option> </select> {{#each datas}} <span class="badge">{{Name}}</span> {{/each}} Template.mytemp.created = function(){ Session.set("activefilter", "all"); }; Template.mytemp.datas = function(){ var ac = Session.get("activefilter"); var result = new Array(); if(ac !=

Am I approaching making a “friend” collection the correct way?

大憨熊 提交于 2019-12-25 03:54:40
问题 I want to have the ability in my application for a user to befriend another user. A friend request is sent, and then the other person has the option to accept or not. I want there to be two different lists, the first list being the users friends, and the second being people who sent friend requests to him or her. Currently I have a friend collection: Friends = new Meteor.Collection("friends"); The way I am creating friends is: Template.friend.events({ 'click #addFriend': function(e, t) { var

Spacebar/Meteor : Nested {{#if}} and Global template helpers

爷,独闯天下 提交于 2019-12-25 03:52:15
问题 I am willing to set the header of my app, based on Session variables. Here is the Spacebars template : {{#if session 'header'}} <header id="page_header"> {{#if session 'header_left'}} <a class="left_btn" href="{{session 'header_left'}}">{{session 'header_left'}}<a> {{/if}} <h1>{{session 'header'}}</h1> {{#if session 'header_right'}} <a class="right_btn" href="{{session 'header_right'}}">{{session 'header_right'}}<a> {{/if}} </header> {{/if}} Here is how I defined the global "session" helper :

Spacebar/Meteor : Nested {{#if}} and Global template helpers

别来无恙 提交于 2019-12-25 03:51:12
问题 I am willing to set the header of my app, based on Session variables. Here is the Spacebars template : {{#if session 'header'}} <header id="page_header"> {{#if session 'header_left'}} <a class="left_btn" href="{{session 'header_left'}}">{{session 'header_left'}}<a> {{/if}} <h1>{{session 'header'}}</h1> {{#if session 'header_right'}} <a class="right_btn" href="{{session 'header_right'}}">{{session 'header_right'}}<a> {{/if}} </header> {{/if}} Here is how I defined the global "session" helper :

Template rendered callback

别说谁变了你拦得住时间么 提交于 2019-12-25 03:47:08
问题 I'm using jquery tabs in my code. I need to call $('ul.tabs').tabs(); after once the HTML is rendered. But this is throwing error "Type : d[0] is undefined". The code which is used is below. <template name="customersMapping"> <div class="col s9 blue-grey lighten-5" id="side-right"> <div class="row"> <div class="col s12"> <ul class="tabs" id="usersMappingTab"> {{#each customerClientMapping}} <li class="tab col s2"><a href="#{{_id}}_Tab">{{name}}</a></li> {{/each}} </ul> </div> {{#each

In Meteor how can I include a js file in another js file server side?

安稳与你 提交于 2019-12-25 03:45:29
问题 In Meteor is there a way to include a js file in another js file. Specifically, server side and most importantly at start up. The use case I am running into is for complicated Meteor.startups where I need to load quite a bit of data to the mongodb into a variety of collections. In order to have different test scripts I have to have more than one file each with duplicate data. So, is there anyway to have say a boostrap.js file that calls Meteor.startup and then is able to load different files

Meteor/Iron-Router: how to define routes using data from settings.json

本秂侑毒 提交于 2019-12-25 03:44:58
问题 For the URL to which a route applies I have a part defined in settings.json, like this baseUrl: '/private' My settings are published and accessible through the collections 'Settings' (on the client). So I tried the following: Meteor.subscribe('settings'); Deps.autorun(function () { var settings = Settings.findOne(): if (settings) { Router.map(function () { this.route('project', { path: settings.baseUrl + '/:projectId, controller: 'ProjectController' }); }); } }); The problem is that during