6
我有一個服務,負責在屏幕上顯示一個加載欄。我動態添加加載條這樣角元素刪除不起作用?
coreModule.provider('$loading', function() {
this.$get = ['$document', function ($document) {
var element = angular.element('<div id="loading" class="loading">' + '<img src="../styling/img/loading.gif" alt="loading .... ">' + '</div>');
return {
inProgress:function (message) {
$document.find('body').append(element);
},
finish:function() {
// $document.find('body').remove(element); <- does not work
// $document.find('body').remove('#loading'); <- neither this one does !!
}
}
}];
});
但是完成功能不工作的。它確實將元素從身體中移除。有任何想法嗎 ?
我是否還必須使用$ destroy來殺死範圍? – whamsicore