Load index.html from server, or redirect to indexfromserver.html

Background:

I’m loading my entire AngularJS Cordova/Ionic web-app from the server. This is amazing. I can change the app without going through Apple.

Questions:

Q1) How can I use js-files.zip, loaded from server, in my index.html file?
Q2) How can I effectively load index.html startup logic from my server?

Problems:

On some older devices, loading time is too high if I load all my .js files from my server, so I want to be able to configure that logic (in index.html) also from the server.

The only thing I’m not loading from the server is the content of index.html

So, how can I essentially load index.html from a server?

If i try to do that

  1. Pulling, say, indexfromserver.html using ajax and doing html rewrite of index.html with document.write(res), then there are AngularJS problems:

E.g., module missing errors (*1 below), because the following isn’t in index.html until after the ajax response rewrites index.html:

<body ng-app="myapp" ng-controller="MainCtrl">

1.1) I can include the necessary modules in the initial local index.html, but then if I rewrite index.html, I’ll get these errors/warnings about classList null in ionic (ask me for details), deviceready not fired, and angularjs loading more than once

  1. I can redirect index.html to, say, indexfromserver.html, but then all my $http responses are rejected promises.

Regarding 2) I’ve been told I should be able to add a controller for indexfromserver.html or specify $urlRouterProvider.otherwise(’/app/indexfromserver’);

This hasn’t fixed the $http requests from being rejected.

I don’t understand exactly how index.html is involved in making $http work correctly, as it doesn’t have a controller and isn’t the ‘otherwise’ route provided. I only see mention of index.html in config.xml so far.

Request:

Can someone please post a snippet of a typical example how an AngularJS Cordova/Ionic app could effectively use index.html logic that’s loaded from a server?

Otherwise, can someone show/explain if/how I can use js-files.zip from server, and uncompress and use in index.html?

Details/Notes:

(*1)
Uncaught Error: [$injector:modulerr] Failed to instantiate module myapp due to:
Error: [$injector:nomod] Module ‘myapp’ is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.2.17/$injector/nomod?p0=myapp