<!-- lang: js -->
module.factory('myInterceptor', ['$log', function($log) {
$log.debug('$log is here to show you that this is a regular factory with injection');
var myInterceptor = {
....
....
....
};
return myInterceptor;
}]);
<!-- lang: js -->
module.config(['$httpProvider', function($httpProvider) {
$httpProvider.interceptors.push('myInterceptor');
}]);
<div class="loading-modal modal" ng-if="loading"> <div class="loading"> <img src="<?=$this->module->getAssetsUrl()?>/img/loading.gif" alt=""/><span ng-bind="loading_text"></span> </div> </div>
.modal {
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
z-index: 99;
background: rgba(0, 0, 0, 0.3);
overflow: hidden;
}
.loading {
position: absolute;
top: 50%;
background: white;
#solution> .border-radius(8px);
width: 160px;
height: 72px;
left: 50%;
margin-top: -36px;
margin-left: -80px;
text-align: center;
img {
margin-top: 12px;
text-align: center;
}
span {
display: block;
}
}
app.config(["$routeProvider", "$httpProvider", function ($routeProvider, $httpProvider) {
$routeProvider.when('/', {
templateUrl: "/views/reminder/index.html",
controller: "IndexController"
});
$routeProvider.when('/create', {
templateUrl: "/views/reminder/item/create.html",
controller: "ItemCreateController"
});
$routeProvider.otherwise({redirectTo: '/'});
$httpProvider.interceptors.push('timestampMarker');
}]);
//loading
app.factory('timestampMarker', ["$rootScope", function ($rootScope) {
var timestampMarker = {
request: function (config) {
$rootScope.loading = true;
config.requestTimestamp = new Date().getTime();
return config;
},
response: function (response) {
// $rootScope.loading = false;
response.config.responseTimestamp = new Date().getTime();
return response;
}
};
return timestampMarker;
}]);
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有