How to decide when to use ngView or ngInclude?

Just trying to understand the exact difference in approaches to using ngView and ngInclude in AngularJS. When would it be right to use one over the other? Thank.

+45
javascript angularjs
Nov 16 '13 at 23:10
source share
1 answer

ngView works with routing and is mainly important for angular SPA. It is usually used to include the main content of your site, a bit between the header and footer, which changes every time the user clicks the link. Its integration with routing means changing the contents of ngView also changes the controller (depending on your configuration).

ngInclude is a common goal; you may not even need it. You sometimes use it inside a view to avoid repeating yourself in cases where multiple views require the same code.

+39
Nov 17 '13 at 9:46
source share
β€” -



All Articles