angular - How to integrate spring boot with angular2? -


i'm trying integrate spring boot angular2. service, renders list of cameras stored in database

@restcontroller @requestmapping(value ="/cameras") public class cameracontroller {  @resource     private cameraservice cameraservice;  @requestmapping(method = requestmethod.get)     public collection<camera> getallcameras() {          return this.cameraservice.getallcameras();     } 

i'm following tuto build angular2 app spring boot backend:https://www.youtube.com/watch?v=hhroyiyfmjc portion of angular2 part:

import { component, oninit } '@angular/core'; import  {http} '@angular/http'; import 'rxjs/add/operator/topromise'; @component({   selector: 'app-root',   templateurl: './app.component.html',   styleurls: ['./app.component.css'] }) export class appcomponent implements oninit{   title = 'app works!';   cameras=[{id:"1",name:"camera1", place:"home"}];   constructor(private http: http){    }   ngoninit(){     this.http.get("http://localhost:9000/cameras").     topromise().then(r => r.json()).then(r =>this.cameras= r);    } } 

normally should render list of cameras stored in database shows me default array:cameras=[{id:"1",name:"camera1", place:"home"}];i failed call backend service :( :))


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -