bang-ng-utils
v0.0.15
Published
bang ng utils
Downloads
4
Readme
bang-ng-utils
use
import {HttpService,DispatchAction,getCookie,setCookie} from 'bang-ng-utils';
new HttpService(this.httpClient).get(url,entity//实体映射类,prams//传递值,headers//自定义头部信息,默认无须设置)
new HttpService(this.httpClient).post(url,entity//实体映射类,prams//传递值,headers//自定义头部信息,默认无须设置)
new DispatchAction<ContainerStore>(this).init(()=>{
this.test=observablePromise<Hero[]>() //设置初始Pending 用于拆分数据状态,如Pending,resolved等,常见应用场景loading
}).set(heroService.getHeroes(),(data)=>{heroService.getHeroes()//返回一个Observable rxjs ,第二个参数成功回调函数 在此我们约定所有服务端数据结构都是从 observablePromise函数出来
this.test=observablePromise(data)
});