Reputation:
Suppose I have index.html which has mainCtrl as its controller. If I use an ng-include in index.html to include partial html code that is saved on a separate page, does the included page have the mainCtrl or do I need to specify it again on that page?
Upvotes: 0
Views: 1003
Reputation: 318
This directive creates new scope.
You can also find a good example in the below link.
Source: https://docs.angularjs.org/api/ng/directive/ngInclude
Upvotes: 0
Reputation: 1585
If including it inside element which has mainCtrl then yes it will automatically share parent scope (mainCtrl), otherwise no.
Upvotes: 1
Reputation: 1011
mainCtrl and it's scope will be also available in your included part.
Upvotes: 0