Bind Ionic to your MobileFirst Project - ajgprieto/MobileFirstDemo GitHub Wiki
- In Ecplise, delete all the files in the
apps/MobileFirstDemoApp/common package
- Find the blank Ionic folder you created in the last tutorial.
- In the
www
folder, copy over all of the folders and files into thecommon
package of the MobileFirst project- At this point you can delete the Ionic project you just created (KILL IT WITH FIRE! 🔥)
- In the
apps/MobileFirstDemoApp/common/js
package, create awlInit.js
file- This file sets the initial state of the project.
- Copy paste code into file
- Open the index.html
- Remove
ng-app="starter"
from the body tag - Delete the following lines related to Cordova
<!-- cordova script script (this will be a 404 during development) --> <script src="cordova.js"></script>
- Add the following code to inside the header
<script src="js/wlInit.js"></script> <script src="js/home/home-module.js"></script> <script src="js/home/home controller.js"></script>
- Remove
- Create a
routes.js
file in the js folder- The routes file allows you to map all of your views to a state (a state is the whole page that the user sees; a state can be made up of one view or multiple views. Views are your html files)
- Routes can also bind views to controllers (controllers do all the User Interface logic)
- Copy and paste code into your new file:
- Create a home folder in
apps/MobileFirstDemoApp/common/js package
- Create a
home-controller.js
andhome-module.js
file- Controller controls your UI logic
- A module is used to organize multiple controllers. This is used to keep things clean and also to control the scope of variables, objects and functions so they can only be accessed from the modules they are a part of.
- Copy and paste the contents from the following files (Yay! You’re learning!)
- Create a
- Create a views folder in
apps/MobileFirstDemoApp/common
- Create a home folder
- Create a home.html file (this is your first view. Not as good looking as a beach front view at the Hilton, but hey, it's a start).
- Copy and paste
- Create a home.html file (this is your first view. Not as good looking as a beach front view at the Hilton, but hey, it's a start).
- Create a home folder
- Modify the app.js file
- Copy and paste
- Modify the style.css file
- Add
html, body { height: 100%; }