Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. Argument passed in must be a single String of 12 bytes or a string of 24 hex characters
  2.  
  3. ngOnInit():void{
  4.  
  5. this.route.params.subscribe(params => console.log(params['id']));
  6.  
  7. this.route.params.switchMap((params: Params) => this.noteService.getSingleNote(params['id']))
  8. .subscribe(note=> this.note = note);
  9.  
  10. }
  11.  
  12. getSingleNote(id:string){
  13. return this.http.get('http://localhost:3000/api/note/:id')
  14. .map(res=>res.json());
  15. }
  16.  
  17. router.get('/note/:id', function(req, res, next){
  18.  
  19. db.stories.findOne({_id: mongojs.ObjectId(req.params.id)},function(err, story){
  20. if(err){
  21. res.send(err);
  22. }
  23. res.json(story);
  24. });
  25.  
  26. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement