Methods
Meteor.methods({
'test' : function(test: string) {
return test;
}
})
Component
My Class extends MeteorComponent
show: string;
constructor() {
this.call('test', 'txt', (err, res) => {
this.show = res
});
}
view
<span>{{show}}</span>
it shows nothing, as I expect it will show 'txt'.
Just add an explanation for @Martin C.'s answer.
In Angular2-Meteor 0.5.6 (not published to NPM yet), you should be able to use
autoBind
.https://github.com/Urigo/angular2-meteor/issues/279
Unlike
autorun
,call
has no parameter to tell it to run inside theNgZone
, so Angular's change-detection won't kick in.You'll need to write it this way: