Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Yes, in theory, Java-non-Java, Angular-non-Angular, the client communicates with the server via REST. The server provides the API, accepts requests from the client, and sends responses back to it. The client uses this API, sends requests and receives responses. You don't necessarily need a bunch of Angular2 and Java, start with a tour of heroes better from the Angular2 docs. Then, on the Java API side, you can do different things, there may be Java EE, Spring, Play, or something else. But the essence is the same - REST.
Here is an example of how to communicate in Angular2 via a REST
GET request to the backend:
getList(): Promise<Data[]> {
return this.http.get(Ваш url + '/getData')
.toPromise()
.then(response =>
response.json().data as Data[]);
}
@RequestMapping(name = "/getData")
public List<Data> getListData(){
List<Data> list = new ArrayList<>();
list.add( new Data());
list.add( new Data());
list.add( new Data());
list.add( new Data());
return list;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question