Assume that: http://localhost:7030/profile/5732fe4c56575e05089469dd
How can i get the information from this id 5732fe4c56575e05089469dd in $http url ?
here's the code :
Nodejs :
router.get(':id/api/data.json', function(req, res, next) {
console.log(req.params.id);
var userId = req.params.id;
User.findById({_id:userId}, function (err, doc) {
if (err) throw err
if (doc){
res.json({
doc: doc,
userID:userId
});
}
});
});
Angular
$http.get("/profile/api/data.json").then(function (response) {
console.log(response.data);
});
something like this : $http.get("url + id + data.json");
How can i access this id from server to angular
Thanks