As I attempt to halt all event listeners when the scope is destroyed, a certain error arises.
The following error is displayed:
TypeError: vm.$on is not a function;
Even using vm.on(..) does not resolve the issue
angular.module('app.layout')
.controller('DashboardController', DashboardController);
DashboardController.$inject = ['$interval','dataservice'];
function DashboardController($interval, dataservice) {
var vm = this;
vm.name = "DashboardController";
console.log('Init Dashboard Controller');
initEvents();
/*
...
*/
/////////////////////////////
function initEvents() {
vm.$on('$destroy', function() {
vm.stop();
console.log('DashboardController scope destroyed.');
})
}