我是Meteor新手,我正在尝试使用angular-meteor
构建在线报告应用程序,但在尝试发布
时遇到问题> 并使用参数订阅
。
在lib/collections.js中,
TestReport = new Mongo.Collection('test_report');
在server/publications.js中,
Meteor.publish('testReportDetail', function(reportID) {
check(reportID, String);
return TestReport.findOne({_id: reportID});
});
在client/test_report_detail.js中,
angular.module('myapp').controller('myCtrl', function($scope, $reactive, $stateParams) {
$reactive(this).attach($scope);
this.subscribe('testReportDetail', $stateParams.reportID);
this.helpers({
reportDetail: function() {
return TestReport.find({_id: $stateParams.reportID});
}
});
});
当客户端浏览器尝试访问报告详细信息时,它会在控制台中收到错误
类型错误:fn 不是函数
有什么想法吗...?
最佳答案
我刚刚发布的新 1.3.1 版本中修复了 this.subscribe
,请再次检查 - https://github.com/Urigo/angular-meteor/releases
关于javascript - 使用 Meteor-Angular 进行参数订阅,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34355110/