Where is the controller placed using $routeProvider?
-
21-12-2019 - |
Question
With ng-controller="myController"
you know exactly what DOM element is associated with the controller, because it's put directly into your HTML:
<div ng-controller="myController">
with $routeProvider
, I don't know what DOM element is associated with the controller. Is the controller injected into the uppermost element on the DOM? According to the documentation, the controller is a JavaScript constructor function, and the controller is associated with the newly created scope. But I don't know where that newly created scope is?
Is the controller simply part of $routeProvider, and $routeProvider is an object?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow