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)

2
  • 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. Commented Mar 13, 2017 at 7: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 Commented Mar 13, 2017 at 19:23

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.