UMass Transit's PVTA realtime app (name TBD)!
See our demo page for a live browser preview of the release candidate!
The app is a hybrid that uses Ionic.
All data is live, and comes from endpoints documented here.
To begin developing, follow these steps:
- Node.js 4.x and NPM
- Ionic, Angular, and Cordova:
npm install -g cordova ionic
-
Clone repository
-
In your clone's directory, run the following setup stuff:
-
npm install
-
bower install
The javascript and corresponding HTML is contained in www
.Start editing away!
- Viewing the results of your changes is easy:
Just run
ionic serve -c
from the root project directory.
Ionic will open your default browser and navigate to itself for you.
Note There's a branch, ionic2-base
for progress in porting PVTrAck to Ionic 2. Please merge all Ionic 2 changes into this branch. When (if) this branch becomes the main branch for development, it will be renamed as master
.
-
The project has been configured to be an Android and iOS project. If you want to build a copy for an emulator on your machine, or you'd like to run it on your phone, do the following:
a. Run
ionic state reset
, which will use your ionic.config.json and package.json to install the proper plugins and dependencies.b.
ionic build [ios OR android]
generates necessary files to run on a device.You must have
android: JDK (version 1.7 or 1.8) and the Android SDK installed. You must also create an Android Virtual Device.
ios: OS X, Xcode, and Xcode command line tools installed.
c.
ionic emulate {platform}
whereplatform
isandroid
orios
will open an emulator and run the app.Installing it on your phone can be tricky. Consult Ionic's page for basic info. Recommend online tutorials. To use a stable, approved version of pvta-multiplatform on your phone, see releases.
Ionic is what makes our app pretty and is built on top of Cordova and Angular. Although it looks like that's all it does, Ionic includes powerful JavaScript modules for simplifying TONS of view logic in our app.
The Ionic team made it easy to do things with the ionic {command}
syntax instead of switching between
Cordova and Angular calls.
The Ionic API is fine, but kind of sparse. Their forums are mediocre. Recommend random tutorials as a second resource if the API isn't sufficient (in many cases it IS).
Cordova provides plugins that bridge the gap between Web app and native app. Since ionic has aliases for the most common cordova commands, searching out Cordova features is currently on a need-to-know basis. (Read: use Google)
Their API is thorough but quirky. When seeking out Cordova documentation, remember that the Ionic team has written an Angular wrapper called ng-cordova, which is what we actually use.
-
The first time you boot an ionic server after installing all your dependencies, it's possible you'll run into errors. The error codes are long and mostly useless; the source of your problem is assuredly the very first line of the first error block in the trace.
-
If you haven't changed any code, it's an error with your dependency binaries. bower installs to
bower_components
, a subdirectory ofwww
.Ensure that this directory exists and is populated. run
npm install
andbower install
again.
-
-
If it worked before, but doesn't after you've begun editing, it's likely that you're using a dependency that you need to import in controllers that require it (or your code just has problems). Search google for "angular dependency injection examples."