小编Ank*_*kit的帖子

Angular 2 - 如何全局获取Observable.throw

怎么样,我想全局处理http错误(特别是状态401).我知道我可以做那样的事情

getCompanies() {
    return this.http.get('https://angular2.apispark.net/v1/companies/')
       .map(res => res.json())
       .catch(res => {
           return Observable.throw(res.json());
       });
Run Code Online (Sandbox Code Playgroud)

如何在其他组件上获得此错误?

只是为了解释我想实现所有401错误将用户重定向到登录页面

rxjs angular

4
推荐指数
1
解决办法
5082
查看次数

$ rootScope.$ new()和$ rootScope.$ new(true)之间有什么区别?

任何人都可以帮助理解之间的差异$rootScope.$new()$rootScope.$new(true)?根据我的理解,它们应该是相同的,因为$rootScope没有父范围.

angularjs angularjs-scope

3
推荐指数
1
解决办法
1032
查看次数

标签 统计

angular ×1

angularjs ×1

angularjs-scope ×1

rxjs ×1