sandlz / hm-app-core

hm-app-core .

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

使用

安装

bower install hm-app-core@0.0.5 --save

服务

Storage

  • set (key , value)

  • get (key)

  • remove (key)

  • clear ()

HttpAuth

支持 POST、PUT、GET、DELETE等请求方式,支持自动刷新TOKEN.

请求示例:

angular.module('base.services')
.factory('WXService', function (HttpAuth, $q) {
return {
requestWXConfigParams: requestWXConfigParams
};

function requestWXConfigParams() {
var url = window.location.href.split('#')[0];
var deffered = $q.defer();
HttpAuth.get(
'http://192.168.8.68:8080/' + 'wxconfig?url=' + url
).success(function (data) {
if (data && data.data) {
deffered.resolve(data.data);
} else if (data) {
deffered.reject(data.msg);
}
}).error(function (error) {
deffered.reject(error);
});
return deffered.promise;
}

});

Conf

将HMConfig 放到Conf中.

angular.module('hmAppCore')
.constant('Conf', HMConfig);

About

hm-app-core .


Languages

Language:JavaScript 100.0%