express - Using AngularJs and MongoDB/Mongoose -


i trying connect angularjs mongodb using mongoose. pass models used controllers, can $scope data. not sure if have go setting angular service, if so, can point me in right direction. thank you.

overview:

model:

var mongoose = require('mongoose'); var db = mongoose.createconnection('mongodb://localhost:3000/database'); var orderschema = new mongoose.schema({     routefrom : string,     routeto : string,     leaving: string }); var order = db.model('order', orderschema); module.exports = order; 

controller:

// of course 'require' not work idea function ordercontroller($scope) {   return $scope.orders = order.find({}); } 

you'll need interim step there. going directly angular mongo not work out. if want generic rest interface mongo can utilize angular's bundled $http services, take @ list of rest services on mongo's site.

mongo rest services

http://www.mongodb.org/display/docs/http+interface#httpinterface-restinterfaces

angular $http service:

http://docs.angularjs.org/api/ng.$http

there's lot of different options here, easiest way , going.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -