Sample/Demo app : Ionic 1.X with Typescript & ngCordova type bindings bindings

Hi,

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 -

Steps :

  1. Created starter ionic app using the blank template
  2. Started to create basic app structure
  3. Added ngCordova and used device plugin
  4. Started to use ControllerAs syntax
  5. Moved the management of routes to modules instead of doing them in app.js
  6. Ported the application to start using typescript
  7. Started to use the ionic & ui-router typings from DefinitelyTyped
  8. Created the type bindings for ngCordova device plugin and used it in the app
  9. 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

Regards
Kapil

2 Likes