I have some issue my website development. It's MEAN stack and I am going to show data on table
routing node.js
var Property = mongoose.model('Property');
var Schema = mongoose.Schema;
var ObjectId = Schema.ObjectId; //Have also tried Schema.Types.ObjectId, mongoose.ObjectId
// Property Routing Management
router.get('/property', function(req, res, next) {
Property.find({}, function(err, properties) {
if (err) {
return next(err);
}
return res.json(properties);
})
});
Angular Controller.
angular.module('MetronicApp').controller('EditPropertyController', [
'$scope',
's_property',
'$state',
'$location',
function($scope, s_property, $state, $location) {
s_property.getAllProperties();
$scope.properties = s_property.all_properties;
}]);
Service
angular.module('MetronicApp')
.factory('s_property', [
'$http',
'$window',
's_auth',
function($http, $window, s_auth) {
var service = {
all_properties: [],
current_property: {}
};
service.getAllProperties = function() {
return $http.get('/api/v1/property').then(function(res, err) {
service.all_properties = res.data;
return res.data;
})
}
return service;
}
]);
HTML
<tr class="odd gradeX" ng-repeat="property in properties">
<td ng-bind="property.propertyAddress"></td>
<td ng-bind="property.propertyCity"></td>
<td ng-bind="property.status"></td>
<td class="center" ng-bind="property.joinedDate"></td>
<td ng-bind="property.user"></td>
</tr>
colloection and documents are exist on MongoDB.
But table does not show data. I appreciate your answers.
via M. Jason
No comments:
Post a Comment