4

I'd like to write an Angular2 application that consumes a REST API backend. However I'm worried about the number of req/sec that such a request will generate, due to Angular "watches" or equivalent change detection algorithm

Should I limit from the beginning the watches (data binding? change detection algorithm?) to one big request per page, there other ways to deal with the problem in Angular or should I consider a different architecture from the beginning (eg. web sockets)

Glasnhost
  • 223
  • 1
  • 6
  • Did you mean Angular 1? Watches don't exist in Angular 2 (It uses Zone.js instead); I would typically expect an HTTP Request from an Angular 2 app to be triggered from the `ngOnInit` lifecycle hook, which is called once when the component is loaded. – Ben Cottrell Mar 13 '17 at 07:12
  • oh thanks you are right, my wrong, rephrased the question a little bit, no watches in Angular2, but I imagine that similarly any data binding must generate an API request. The application is like a dashboard, there is little UX/UI interaction but data shown should change dynamically, according to DB status....Anyway, I'm reading more about change detection in Angular2 – Glasnhost Mar 13 '17 at 19:23

0 Answers0