6

I have used recently the ng-view in partial view and it looks much like the use of ng-include. Is there a difference between the two: ng-view directive and ng-include or when is it better to use which?

Taiwotman
  • 885
  • 14
  • 27
  • 1
    possible duplicate of [How to decide when to use ngView or ngInclude?](http://stackoverflow.com/questions/20025101/how-to-decide-when-to-use-ngview-or-nginclude) – Rahil Wazir Aug 27 '15 at 12:33
  • http://stackoverflow.com/questions/20025101/how-to-decide-when-to-use-ngview-or-nginclude – saurabh landge Apr 17 '17 at 12:27

1 Answers1

5

Basicly ng-View creates a new View which works with States or Routing, saying this view gets his own Controller and Stuff like it would be a html file. And ng-include is if you have like a html template which u need to show on different views and include it to not duplicate code.

So for example you can ng-include your header html where you have your navigation, and you could ng-view a register form or smth where you need it to have its own Route/ State and Controller

stackg91
  • 584
  • 7
  • 25