Not sure when to use ng-view or ng-include
Asked Answered
J

1

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?

Joris answered 27/8, 2015 at 12:18 Comment(2)
possible duplicate of How to decide when to use ngView or ngInclude?Gourley
#20025601Lederhosen
L
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

Lasky answered 27/8, 2015 at 12:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.