I am working on an angular-meteor app and trying to loop through my database to display its data dynamically but am unable to.
Heres my controllers, routes, collections and views.
client/scripts/controllers/stocks.controller.js
angular
.module('stockAiApp')
.controller('StocksCtrl', StocksCtrl);
function StocksCtrl($scope, $reactive) {
$reactive(this).attach($scope);
this.helpers({
nasdaq() {
return Nasdaqs.find({});
},
nyse() {
return Nyses.find({});
},
amex() {
return Amexs.find({});
}
});
////////////
}
client/scripts/routes.js
.state('tab.stocks', {
url: '/stocks',
views: {
'tab-stocks': {
templateUrl: 'client/templates/stocks.html',
controller: 'StocksCtrl as stocks'
}
}
})
client/templates/stocks.html
<ion-item
ng-repeat="stock in stocks.nasdaq"
class="item"
type="item-text-wrap"
href="#">
<p>{{stock.Symbol}},
{{stock.Name}},
{{stock.sector}}</p>
</ion-item>
lib/collections.js
Nyses = new Mongo.Collection('nyses');
Nasdaqs = new Mongo.Collection('nasdaqs');
Amexs = new Mongo.Collection('amexs');
尝试将.fetch()与find()方法一起使用
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.