Simon Hunt

GUI --Added cleanup on scope destroy for sample and device views.

Change-Id: Ia1656eb3987f2f896fa7d6d2cec2860495ce36d7
......@@ -22,7 +22,9 @@
'use strict';
angular.module('ovDevice', [])
.controller('OvDeviceCtrl', ['$log', '$scope', '$location', 'RestService',
.controller('OvDeviceCtrl',
['$log', '$scope', '$location', 'RestService',
function ($log, $scope, $location, rs) {
var self = this;
self.deviceData = [];
......@@ -38,6 +40,11 @@
};
$scope.sortCallback();
// Cleanup on destroyed scope
$scope.$on('$destroy', function () {
});
$log.log('OvDeviceCtrl has been created');
}]);
}());
......
......@@ -24,6 +24,9 @@
// injected refs
var $log, tbs, flash;
// configuration
var tbid = 'sample-toolbar';
// internal state
var togFnDiv, radFnP;
......@@ -50,9 +53,14 @@
.style('color', '#369');
}
// define the controller
angular.module('ovSample', ['onosUtil'])
.controller('OvSampleCtrl', ['$log', 'ToolbarService', 'FlashService',
function (_$log_, _tbs_, _flash_) {
.controller('OvSampleCtrl',
['$scope', '$log', 'ToolbarService', 'FlashService',
function ($scope, _$log_, _tbs_, _flash_) {
var self = this,
toolbar,
rset;
......@@ -76,7 +84,7 @@
.append('p')
.style('font-size', '16pt');
toolbar = tbs.createToolbar('sample');
toolbar = tbs.createToolbar(tbid);
rset = [
{ gid: 'checkMark', cb: checkFn },
{ gid: 'xMark', cb: xMarkFn },
......@@ -91,6 +99,11 @@
checkFn();
// Clean up on destroyed scope
$scope.$on('$destroy', function () {
tbs.destroyToolbar(tbid);
});
$log.log('OvSampleCtrl has been created');
}]);
}());
......