meteor-blaze

Running a function AFTER a meteor template is updated

自闭症网瘾萝莉.ら 提交于 2019-12-04 21:34:28
问题 I have a meteor template rendering some html that I need to perform a jquery function on. Right now, I've set up a dependency so that every time the data (a list of objects) tied to that template changes, the function runs. I'm not at all sure this is the best way to do what I'm trying to do, but it does run the function every time I add/delete/rearrange objects, so that's a start. However , the function seems to be running before the template is re-rendered, so the previous set of blocks get

Can I pass the this._id value from one template helper to another with Meteor?

妖精的绣舞 提交于 2019-12-04 19:04:50
I have the following templates (.html) with their respected managers (.js files): adminManageCategories adminAddCategory adminUpdateCategory Consider the following: <template name="adminManageCategories"> {{#each category}} <div class="clickme">{{title}}</div> {{/each}} {{> adminUpdateCategory}} </template> Notice the {{> adminUpdateCategory}} is outside of the iteration. This is also a form, and I want to keep it on the same page. And admin_manage_categories.js Template.adminManageCategories.events({ "click .clickme": function(event) { event.preventDefault(); console.log(this._id); } });

Meteor #each loop ready

拜拜、爱过 提交于 2019-12-04 15:44:54
问题 I wonder is there any way to know if #each loop is "ready". By "ready" I mean it rendered all nodes and inserted into the DOM. I don't even speak about onRendered callback (old rendered ). I tried <template name="myTemplate"> <div class="some-class"> {{#if Template.subscriptionsReady}} {{#each messages}} <div>{{text}}</div> {{/each}} <script> $(".some-class").trigger("LOOP_READY") </script> {{/if}} </div> </template> Template.myTemplate.onRendered(function(){ this.$(".some-class").on("LOOP

How to IF NOT inside of {{ #each }} template

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 15:18:32
问题 How can I render this Meteor Blaze Template ? I would like to use the negative of the IF, but I don't find anywhere how to use it. <ul> {{#each pages}} {{#if (--NOT--) isCover }} <li> some content {{value}} </li> {{/if}} {{/each}} </ul> Previous research not found solution https://github.com/meteor/meteor/wiki/Using-Blaze Check for equality in Spacebars? Note: if I use only the if statement is working without problem, also I could do and else but I would like to have it only with the if(

Page transitions in meteor?

戏子无情 提交于 2019-12-04 13:24:05
问题 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

Blaze: Logic (Not, Or, And…) in {{#if}} statement

做~自己de王妃 提交于 2019-12-04 08:17:51
Is there a way to do logic operation in {{#if}} statement? I was hoping for something like: {{#if A && B}} some html {{/if}} I couldn’t find documentation about logic in blaze, so I guess it’s not supported. I just wanted to be sure. Sorry for the rather stupid question... As Billy Bob suggests, you would need parameterized helpers. Here are two global helpers you could use in any context: Template.registerHelper('and',(a,b)=>{ return a && b; }); Template.registerHelper('or',(a,b)=>{ return a || b; }); Then you could use these with: {{#if and a b}} a and b are both true-ish {{/if}} {{#if or a

Accessing template helper dictionary in Meteor event handler

拟墨画扇 提交于 2019-12-04 07:37:37
In Meteor, I'm sending two objects from my db to a template: Template.myTemplate.helpers({ helper1: function() { var object1 = this; // data context set in iron:router...path is context dependent // modify some values in object1 return this; }, helper2: function() { return Collection2.find({_id: this.object2_id}); } }); This template also has an event handler to modify the two objects above. I am trying to access helper1 and helper2 from above, but if I call the data context of the template, I only get access to the unmodified version of object1. How do I access the helpers defined above?

#each string in an array with blaze in Meteor

那年仲夏 提交于 2019-12-04 04:54:20
I have an array of usernames that I am rendering in a list like so: {{#each contacts}} <div class="name">{{this}}</div> {{/each}} This works just fine, but then I try to get the username from an event: 'click .name': function(e,t){ console.log(this) } I get this frustrating object String {0: "c", 1: "h", 2: "a", 3: "r", 4: "l", 5: "i", 6: "e", length: 7, [[PrimitiveValue]]: "charlie"} which makes it very challenging to do string comparisons with. Any ideas why this is even a problem or what to do about it? In general in Javascript, context has to be an object rather than a primitive ( link ).

ng-repeat + filter like feature in Meteor Blaze/Spacebars

最后都变了- 提交于 2019-12-03 16:38:43
I am from AngularJS background, recently start learning Meteor. In AngularJS, I may have something like: <div ng-repeat="person in persons | filter:search"> <h4>{{person.name}}</h4> <b>{{person.age}}</b> </div> search object can be bound (2-way bound) to HTML textbox. Whenever the textbox changed, the filter will be automatically updated. How to do so in Meteor? I am not familiar with AngularJS, but here is an example of how you would accomplish this with Meteor. This example shows a list of persons, along with an HTML number input that you can use to filter by age the displayed list. client

Jquery-UI sortable list not playing nice with reactive updates in Meteor template

我的未来我决定 提交于 2019-12-03 15:03:31
问题 I'm trying to implement a sortable list of objects with JQuery-UI in the manner described at http://differential.com/blog/sortable-lists-in-meteor-using-jquery-ui. However, rather than sort a list of separate documents, I'm sorting a list of objects embedded within a single document. That is, I have a document like so: { name: "Name of this Rolodex", cards: [{name: "...", rank: 0, id: "some-unique-id"}, {name: "...", rank: 1, id: "some-other-unique-id"}, ... ] } And I just want to make the