我有一项服务,负责在屏幕上显示加载栏.我像这样动态添加加载栏
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 !!
}
}
}];
});
Run Code Online (Sandbox Code Playgroud)
然而,完成功能确实起作用.它确实从身体中移除了元素.有任何想法吗 ?
joa*_*mbl 10
您可以使用element.remove()- 请参阅http://docs.angularjs.org/api/angular.element了解可用的jQueryLight方法.
| 归档时间: |
|
| 查看次数: |
20107 次 |
| 最近记录: |