0

If I use a ng-view nested in an element that has a controller defined, will that controller interfere with the controllers that are loaded by ng-view (html file loaded)?

In my initial tests nothing happened, but I'm still in doubt if I tested it wrongly if it really allows it.

<div class="container-fluid" ng-controller="ExampleController">
    <ng-view></ng-view>
</div>
isherwood
  • 58,414
  • 16
  • 114
  • 157
Tom
  • 641
  • 2
  • 8
  • 21
  • could you show us your js code? – BartoszTermena Nov 27 '18 at 18:26
  • 1
    The `` directive creates a new scope that inherits properties from its parent scope. If there is an `ng-controller` directive in the parent hierarchy, it will inherit properrties from the scope of that controller. For more information, see [AngularJS Developer Guide - scope hierarchies](https://docs.angularjs.org/guide/scope#scope-hierarchies). – georgeawg Nov 27 '18 at 18:34
  • 1
    See also, [What are the nuances of scope prototypal / prototypical inheritance in AngularJS?](https://stackoverflow.com/questions/14049480/what-are-the-nuances-of-scope-prototypal-prototypical-inheritance-in-angularjs). New AngularJS developers often do not realize that `ng-repeat`, `ng-switch`, `ng-view`, `ng-include` and `ng-if` all create new child scopes. – georgeawg Nov 27 '18 at 18:38

0 Answers0