ich mehrere $timeout
Ausdrücke in Modal-Controller haben
App.controller('ModalCtrl', function ($scope, $timeout) {
for (var i = 0; i < 10; i++) {
(function() {
var timer = $timeout(function() {
console.log('timer')
}, 1000);
})()
}
})
Ich brauche alle Timer zu löschen, wenn die modale Aufruf:
App.controller('MainCtrl', function ($scope, $modal, $timeout) {
$scope.showMap = function() {
var modal = $modal.open({
templateUrl: 'modalap.html',
controller: 'modalCtrl',
})
modal.result.then(function() { //fires when modal is resolving
}, function() { //fires when modal is invoking
});
} })
Wie kann ich das tun ?
PS Entschuldigung für fehlerhafte Codeformatierung. Ich weiß nicht warum, aber ich kann es nicht besser formatieren. Ich kopierte Code here:
wie kann man einen Controller wie das injizieren? –