angular2 超时设置

import ‘rxjs/add/operator/timeout’;

this.http.post(‘myUrl’,
MyData, {headers: Myheaders})
.timeout(3000, new Error(‘timeout exceeded’))
.map(res => res.json())
.subscribe(
data => this.ret = data,
error => console.debug(‘ERROR’, error),
() => console.log(‘END’)
);

阅读更多
换一批

没有更多推荐了,返回首页