Ionic Native Plugins not loading correctly


#1

I’m using Ionic v4 beta 13, and I’m running into an issue with plugins not registering before they’re being called.

My app opens into a page that requires the Ionic Native File plugin, to display a list of folders within a certain directory on the user’s device. I have JavaScript functions that use that Native File plugin, and I want them run automatically, but no matter whether those functions are called from the constructor, ngOnInit, ngAfterViewInit or ngAfterContentInit, they fail and I see console messages saying that the plugins aren’t installed.

But if I wait for the page to load, see those error messages in the console, and THEN try to run those functions manually (triggered with a button click), they work just fine.

So how do I make sure that my plugins register as installed before running the JS functions that use them?