Tuesday, 25 April 2017

Can I use Angular to retreive data from Mongodb?

I'm trying to get data from my MongoDB displayed in my HTML page. Is it possible to get this done by Angular or do I need a templating engine for this? I'm using Express on Node platform.

I've already managed to get my POST done with Angular.

Here is my server call to MongoDB:

router.get('/getdata', function(req, res, next){
  UserData.find()
    .then(function(doc){
      console.log('Data successfully retrieved');
      res.render('index', {items: doc});
    });
});

Now only my index page is a template(Jade). The rest of my pages are routed with Angular and are regular HTML pages. I thought there was a way to display MongoDB data with Angular in HTML using these quotes , but I dont't know how this works



via Larsmanson

No comments:

Post a Comment