|
@@ -61,16 +61,22 @@ function (angular) {
|
|
|
link: function($scope, elem, attr) {
|
|
link: function($scope, elem, attr) {
|
|
|
// once we have the template, scan it for controllers and
|
|
// once we have the template, scan it for controllers and
|
|
|
// load the module.js if we have any
|
|
// load the module.js if we have any
|
|
|
|
|
+ var newScope = $scope.$new();
|
|
|
|
|
|
|
|
// compile the module and uncloack. We're done
|
|
// compile the module and uncloack. We're done
|
|
|
function loadModule($module) {
|
|
function loadModule($module) {
|
|
|
$module.appendTo(elem);
|
|
$module.appendTo(elem);
|
|
|
elem.wrap(container);
|
|
elem.wrap(container);
|
|
|
/* jshint indent:false */
|
|
/* jshint indent:false */
|
|
|
- $compile(elem.contents())($scope);
|
|
|
|
|
|
|
+ $compile(elem.contents())(newScope);
|
|
|
elem.removeClass("ng-cloak");
|
|
elem.removeClass("ng-cloak");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ newScope.$on('$destroy',function(){
|
|
|
|
|
+ elem.unbind();
|
|
|
|
|
+ elem.remove();
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
$scope.$watch(attr.type, function (name) {
|
|
$scope.$watch(attr.type, function (name) {
|
|
|
elem.addClass("ng-cloak");
|
|
elem.addClass("ng-cloak");
|
|
|
// load the panels module file, then render it in the dom.
|
|
// load the panels module file, then render it in the dom.
|