Loading code dynamically on the fly in Ionic


#1

Hello,

I have been developing Ionic Apps for some time and it came a new requirement by the client, to have components loaded dynamically on the fly. Like for example a game and it’s DLC’s (Downloadable content).

So the main idea would be to have a core application that could be pushed to the APP store, this app would have a login area, and upon the login that user would have access to certain modules configuration/permissions, eg. 1,4,5, so the app would know and download those modules and activate just those(they would not be in the core application(. would this be possible on Ionic? if yes how to or some tips

Best regards


#2

There is at least no out of the box functionality for this.


#3

Ok not out of the box, but can you see some constraints on why it cant be implemented? or i should look in a different way rather than ionic?


#4

Depending how many modules you have, you could look at using ionic deploy https://ionicframework.com/docs/pro/deploy/setup/#usage

If you used a separate channel for each module/configuration, you could then swap channels and download the required code for each channel. There’s an example on the page linked of using a beta channel.

It’s not ideal but could work for your scenario.


#5

Inject js in the webview through a custom plugin, so skip the angular part for some areas.

Or check a js framework that do this smoothly and use ionic4

Just a thought.