clean up groups-builder directive

This commit is contained in:
Mads Rasmussen
2015-08-19 16:08:14 +02:00
parent e8c3c0b1ed
commit 80b52614fe

View File

@@ -577,12 +577,17 @@
}
scope.$watch('model', function(newValue, oldValue) {
var unbindModelWatcher = scope.$watch('model', function(newValue, oldValue) {
if (newValue !== undefined && newValue.groups !== undefined) {
activate();
}
});
// clean up
scope.$on('$destroy', function(){
unbindModelWatcher();
});
}
var directive = {