我有一项服务负责在屏幕上显示加载栏。我像这样动态添加加载栏
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 !!
}
}
}];
});
但是完成功能确实有效。它确实从正文中删除了元素。有任何想法吗 ?