Answer the question
In order to leave comments, you need to log in
Am I approaching the architecture of the angular2 application correctly?
there are components and each component has its own service. I make all requests to api in the service. and I render the data directly from the service to the shtml:
<div *ngFor="user of service.items">{{user.name}}</div>
ngOnInit() {
this.active_route.params // текущий роут
.subscribe((params) => {
this.service.key_id = params.id; // Ид редактируемого элемента
this.service.refresh(); // обновление переменной service.items
});
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question