如何修复 ngOnInit 中未定义的可观察订阅返回

时间:2021-07-12 01:36:24

标签: angularjs typescript observable redux-observable

 WebSocket.cpp  D  WebSocket thread start, helper instance: 0xc87ca8a0
                D  scheme: ws, host: 192.168.1.87, port: 7654
                D  NOTICE: Creating Vhost 'default' port -1, 1 protocols, IPv6 on
                D  NOTICE: created client ssl context for default
                D  NOTICE: lws_client_connect_2: 0xc867b880: address 192.168.1.87
                D  NOTICE: uplevelling AF_INET to AF_INET6
                D  WebSocket (0xce47b900) Unhandled websocket event: 32
                D  WebSocket (0xce47b900) Unhandled websocket event: 29
    jswrapper   D  JS: Created Camera: Profiler_Camera 1080x2160
WebSocket.cpp   D  NOTICE: lws_client_connect_2: 0xc867b880: address 192.168.1.87
                D  NOTICE: uplevelling AF_INET to AF_INET6
                D  WebSocket (0xce47b900) Unhandled websocket event: 24
                D  WARN: lws_client_handshake: got bad HTTP response '426 Upgrade Required'
                D  WebSocket (0xce47b900) onConnectionError, state: 0 ...
                D  WebSocket (0xce47b900) onConnectionClosed, state: 2 ...
                D  onConnectionClosed, WebSocket (0xce47b900) is closing by server.
                D  WebSocket (0xce47b900) onConnectionClosed DONE!
                D  WebSocket (0xce47b900) Unhandled websocket event: 50
                D  WebSocket (0xce47b900) Unhandled websocket event: 45
                D  WebSocket (0xce47b900) Unhandled websocket event: 33
                D  WebSocket (0xce47b900) onConnectionClosed, state: 3 ...
    jswrapper   D  JS: onerror: undefined


Then I tried some other android devices and got the same error above.

I don't know what went wrong here, any advice will be appreciated, thanks :)

我试图在 @Select(AppState.getModuleData('rooms', 'collections')) rooms$: Observable<Array<any>>; roomLists$ = new BehaviorSubject([]); ngOnInit() { this.rooms$.subscribe(x => { console.log(x)}); } 中调用 observable tasks$ 但它返回未定义的值我也尝试在 OnInit 中应用但仍未定义。

因为我试图做的是转移 ngAfterViewInit() 中的 data rooms$ 但是当我尝试 roomsLists$subscribe 时它返回 console< /p>

0 个答案:

没有答案