I am using the same controller in several HTML pages in my project.
My problem is that each page links to the other and instead of them all using the same exact controller they duplicate it each time the next page is opened and each page is using its own controller, which means, all the data saved in the previous controller will not apply on the next page with the new duplicated controller.
I recently acknowledged that each controller has its own ID (
<div ng-controller="myCtrl"> <div ng-switch on="condition"> <div ng-switch-when="condition_output_1"> <div ng-include="'html_page_1_url.html'"></div> </div> <div ng-switch-when="condition_output_2"> <div ng-include="'html_page_1_url_2.html'"></div> </div> </div> </div>
html_page_2_url.html or any html
myCtrl this will remian same for all.
To transfer data between controllers.. You can use