Make Ionic App using current AngularJS-RequireJS webapp code


#1

Hello @max

I have already a webapp build on AngularJS and RequireJS. Its really big app and works good on browser. I was thinking of making a mobile app using ionic framework. Due to common angular code, I can reuse the code but not sure about the requirejs will work with ionic framework or not ?

Can you please guide or tell how, I can reuse the webapp code efficiently for an hybrid app ?

Thanks
Gaurav


Official guide for migration of native AngularJS app to ionic?
#2

There are some standards for all technology to write a code efficiently. We can break code into small functions and can use across project.

I would start by spinning up a standard ionic app using the command ionic start APPNAME. Then you can simply put your app into the APPNAME/www directory. Then edit your index.html and add this script tag in the head.

That is all that is really required to get your app built for mobile. You can test on Android by running ionic platform add android to install the dependencies for Android and then run ionic run android

If you want to build for iOS you will need to have a Mac (eww…) but it’s just as easy ionic platform add ios and then run ionic run ios to test on Apple, though there is a bit more setup I believe.

To get the added benefits of Ionic’s directives and other helpful utilities you can add the dependency to your main ionic module like below.

angular.module(‘APPNAME’, [‘ionic’, ‘ngCordova’])

.run(function($ionicPlatform, $cordovaSplashscreen) {
$ionicPlatform.ready(function() {

    if (window.cordova && window.cordova.plugins.Keyboard) {
        cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
    }
    if(window.navigator && window.navigator.splashscreen) {
        window.plugins.orientationLock.unlock();
    }
    if (window.StatusBar) {
       
        StatusBar.styleDefault();
    }
    if (window.cordova){
        
        $cordovaSplashscreen.hide();
    }
});

});

Contact for more: http://www.habilelabs.io/ionic/

Thanks