本文整理汇总了TypeScript中meteor/templating.Template类的典型用法代码示例。如果您正苦于以下问题:TypeScript Template类的具体用法?TypeScript Template怎么用?TypeScript Template使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Template类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
Template['newTemplate'].rendered = function () {
};
Template['newTemplate'].destroyed = function () {
};
Template['newTemplate'].events({
'click .something': function (event: Meteor.Event, template: Blaze.TemplateInstance) {
}
});
Template.registerHelper('testHelper', function () {
return 'tester';
});
var instance = Template.instance();
var data = Template.currentData();
var data = Template.parentData(1);
var body = Template.body;
/**
* From Match section
*/
var Chats = new Mongo.Collection('chats');
Meteor.publish("chats-in-room", function (roomId: string) {
// Make sure roomId is a string, not an arbitrary mongo selector object.
check(roomId, String);
示例2: helloOnCreated
/**
* Created by Manas on 7/4/2016.
*/
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import './main.html';
Template.hello.onCreated(function helloOnCreated() {
// counter starts at 0
this.counter = new ReactiveVar(0);
});
Template.hello.helpers({
counter() {
return Template.instance().counter.get();
},
});
Template.hello.events({
'click button'(event, instance) {
// increment the counter when button is clicked
instance.counter.set(instance.counter.get() + 1);
},
});