I'm having a very strange problem and would like it if someone understands my question, could you explain why that happens.
My application is a player and this is composed of some timeouts for start and end controls of the media (it plays video, images, canvas, and our own media)
My html index is very simple, composed only of this:
<html ng-app="app">
<head>
<title>app</title>
<meta charset="UTF-8">
</head>
<body ng-controller="bodyCtrl" ng-keyup="processKey($event.keyCode)">
<div ng-include="page"></div>
<div class="containerMenu" ng-show="menu.isOpenned">
<div ng-include="menu.templateUrl"></div>
<span us-spinner spinner-key="spinner-1"></span>
</div>
<div ng-include="'views/fonts.html'"></div>
<div ng-include="'views/debug.html'" ng-if="isDebug"></div>
</body>
</html>
My question is this: When I insert a page inside the include <div ng-include="page"></div>
what happens to the controller that was already there?
For example: I have the A page and the B page, both have a controller. When I start my application I load the A page. Logic comes and logic is going to need to load the B page.
The A page performs a timeout when an image is displayed:
var playImage = function(media) {
setTimeout(start, (media.duration * 1000));
}
var start = functon() {
//vai pegar a proxima imagem e mandar exibir
}
For some reason, I need to exit the A controller that is responsible for the display and go to the B page that is the menu controller. And then I change the include again to the A page. Is it possible that because of the timeout, I have 2 instances or 2 logics running simultaneously on the controller A ?