cordova-plugin-screen-orientation icon indicating copy to clipboard operation
cordova-plugin-screen-orientation copied to clipboard

OnChange event not working

Open mitesh-shah opened this issue 5 years ago • 3 comments

I am using this plugin and I wanted to get the event when user rotates the screen. But, I get below error. Error core.js:15724 ERROR TypeError: Invalid event target at setupSubscription (fromEvent.js:50) at Observable._subscribe (fromEvent.js:24) at Observable.push../node_modules/rxjs/_esm5/internal/Observable.js.Observable._trySubscribe (Observable.js:43) at Observable.push../node_modules/rxjs/_esm5/internal/Observable.js.Observable.subscribe (Observable.js:29) at new TestPage (test.page.ts:10) at createClass (core.js:22160) at createDirectiveInstance (core.js:22029) at createViewNodes (core.js:23255) at callViewAction (core.js:23571) at execComponentViewsAction (core.js:23490)

My code this.screenOrientation.onChange().subscribe( () => { console.log(this.screenOrientation.type); } );

I am using this plugin in conjunction with Angular 7 & ionic 4

mitesh-shah avatar Jan 08 '20 08:01 mitesh-shah

Thanks a lot for your issue, however the issue template exists for a reason 😉 It helps us to debug the issue further and to provide a solution much faster. With important information missing, we unfortunately can't help you.

Therefore, please edit this issue accordingly or close and create a new one and make sure to provide all the required information.

timbru31 avatar Jan 08 '20 09:01 timbru31

Also, this seems like an Angular/Ionic issue. Please verify that the event listening via a plain window.addEventListener works.

timbru31 avatar Jan 08 '20 09:01 timbru31

Thanks a lot for your issue, however the issue template exists for a reason 😉 It helps us to debug the issue further and to provide a solution much faster. With important information missing, we unfortunately can't help you.

Therefore, please edit this issue accordingly or close and create a new one and make sure to provide all the required information.

@timbru31 Thank you for your kind reply :slightly_smiling_face: . I will check with the window listener that you have mentioned in another comment.

mitesh-shah avatar Jan 08 '20 10:01 mitesh-shah

Closing as stale.

breautek avatar Sep 22 '22 02:09 breautek