【发布时间】:2014-06-24 22:43:53
【问题描述】:
我是 Angular 和 nedb 的新手。我正在尝试将 nedb 中的数组用于 ng-repeat。 我不明白为什么我的代码不起作用
<div ng-repeat="hello in helloworld"></div>
...
hellodb.find({}).sort({helloworld: 1}).exec(function (err, docs){
$scope.helloworld = docs;
console.log($scope.helloworld);
});
如果我对与数据库内容相同的 json 文件做同样的事情
$http.get('helloworld.json').success(function(data) {
$scope.helloworld = data;
console.log($scope.helloworld);
});
控制台中的输出是一样的,ng-repeat有效
【问题讨论】:
标签: javascript node.js angularjs mongodb node-webkit