Open
Description
What is the best way to use same object for mongose schema and angular controler?
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
var sharedObject = {
name: String,
info: String,
active: Boolean
};
var MissionSchema = new Schema(sharedObject);
module.exports = mongoose.model('Mission', MissionSchema);
AND
angular.module('myApp')
.controller('MyCtrl', function ($scope, $http, socket, sharingService) {
var sharedObject = sharingService('myObjectSchema');
generateForm(sharedObject);
});
Any helpful info appreciated, thanks :)