【发布时间】:2025-11-21 10:50:01
【问题描述】:
我是 Meteor 和 AngularJs 的新手。我正在尝试关注https://github.com/lvbreda/Meteor_angularjs 上的示例应用程序,但到目前为止我还没有让它工作。
我在这段代码中收到错误“未定义应用程序”:
app.controller('MeteorCtrl', ['$scope', '$meteor', function ($scope, $meteor) {
Uncaught ReferenceError: app is not defined
$scope.todos = $meteor("todos").find({});
$meteor("todos").insert({
name: "Do something",
done: false
});
我尝试将上面的内容重写为:
var MeteorCtrl = function ($scope, $meteor) {
$scope.todos = $meteor("todos").find({});
$meteor("todos").insert({
name: "Do something",
done: false
})
};
仍然抛出错误'错误:未知提供者:$meteorProvider
https://github.com/bevanhunt/meteor-angular-leaderboard 上唯一的其他meter+angularjs 示例似乎已过时。
有人可以使用https://github.com/lvbreda/Meteor_angularjs 的包发布一个简单但完全有效的可下载meteor+angularjs 示例吗?
【问题讨论】:
-
我自己的应用程序遇到了同样的问题,通过将我的应用程序基于 github.com/Urigo/meteor-angular-socially 的代码修复。我的文件扩展名为 .tpl 而不是 .ng.html,文件夹结构略有不同,并且使用了一些 npm 模块,所以不确定是什么真正为我解决了问题。
标签: angularjs meteor angular-meteor