Please find a repo - https://github.com/ksachdeva/ngCordova-typescript-demo
that shows how to write an ionic 1.X application using typescript & ngCordova. This is essentially a port of demo application from ngCordova repo but using the more modular approach and of course using Typescript.
As I am writing this application I am creating the type definitions for various ngCordova plugins. At the time of writing this post I have created bindings for device & toast plugin.
The application uses recommended angular code organization guidelines as well.
If interested please see individual change sets as well. Here is how I have iterated to create the sample application -
- Created starter ionic app using the blank template
- Started to create basic app structure
- Added ngCordova and used device plugin
- Started to use ControllerAs syntax
- Moved the management of routes to modules instead of doing them in app.js
- Ported the application to start using typescript
- Started to use the ionic & ui-router typings from DefinitelyTyped
- Created the type bindings for ngCordova device plugin and used it in the app
- Created the type bindings for ngCordova’s toast plugin and use it in the app
The ngCordova bindings are part of this repo. I have submitted them (pull request) to DefinitelyTyped repo and once accepted they would be removed from the sample application.
The Readme of the repo has instructions on what to install and how to run.
in the next few days I would try to port most of the ngCordova’s plugins and use them in this demo application.
Hope you will it useful