Search Posts

Category: global

Accesing field outside of callback gives undefined in angular

I have a problem my data structure looks as follows: var mongoose = require(‘mongoose’); var Schema = mongoose.Schema; var schema = new Schema({ name: {type:String, required:true}, domain: {type:String, required:true}, kingdom: {type:String, required:true}, description: {type:String, required:true}, usages:[ {type : mongoose.Schema.ObjectId, ref : ‘Usage’} ], }); module.exports = mongoose.model(‘Flower’,schema,’flowers’); In database usages looks as follows: “usages”: [ { “$oid”: “59785b0c267c14036038324b” } ], after i populate page with data from http get: var app = angular.module(“flowerDataApp”, []); app.controller(‘dataPopulateController’, […]