Resolver Emitting Error ` ERROR Error: “[object Object]” `

前端 未结 8 1824
你的背包
你的背包 2020-12-13 23:50

I\'m having a problem with regards of implementing a resolver on my routes as it has no issue until I include InitialDataResolver on my routing module.

相关标签:
8条回答
  • 2020-12-14 00:24

    This lack of detailed error occurred when using Mozilla Firefox. so what you need to do is to switch over to Google Chrome to see the specific error.

    UPDATED:

    You can also Store the error as Global Variable

    then you can type temp0.message to see the actual error message

    0 讨论(0)
  • 2020-12-14 00:31

    This error comes due to wrong router declaration. Also exact error never going to come in Firefox. Check route file in chrome. #angularjs-route

    0 讨论(0)
  • 2020-12-14 00:32

    In console you can store errors like

    ERROR Error: "[object Object]"

    as global variable

    and then get error message from object temp0.message

    0 讨论(0)
  • 2020-12-14 00:42

    Mainly this error is found when using database object from '@angular/fire'

    this can be fixed by using this.db.object('/' + ....).subscribe(...)

    0 讨论(0)
  • 2020-12-14 00:44

    one-time solution : find function defaultErrorLogger in dist/vendor.bundle.js and add:

    for (var _i = 1; _i < arguments.length; _i++) {
        values[_i - 1] = arguments[_i];
    }
    console.log(arguments);
    console.error.apply(console, values); code here
    

    then refresh page without recompiling

    0 讨论(0)
  • 2020-12-14 00:48
    resolve(route: ActivatedRouteSnapshot,
          state: RouterStateSnapshot): Observable<any> {
        return Observable.create((observer: Observer<any>) => {
    
          this.appInitService.init()
              .subscribe(data => {
                this.appInitService.preload();
                observer.next(data);
                observer.complete();
              });
    
        }).map(item => !!item)
    }
    

    The code above will work for you.

    if your rxjs version is 6.x you will use .pipe(map(item => !!item))

    0 讨论(0)
提交回复
热议问题