Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Learning Ionic
  • Toc
  • feedback
Learning Ionic

Learning Ionic

By : Ravulavaru
4.4 (14)
close
Learning Ionic

Learning Ionic

4.4 (14)
By: Ravulavaru

Overview of this book

This book is intended for those who want to learn how to build hybrid mobile applications using Ionic. It is also ideal for people who want to explore theming for Ionic apps. Prior knowledge of AngularJS is essential to complete this book successfully.
Table of Contents (12 chapters)
close
11
Index

ngCordova


In the earlier example, we have integrated a couple of plugins and used their JavaScript API methods to interact with them. As you may have noticed, all the plugins reside in the global namespace. Unlike AngularJS's philosophy of dependency injection, Cordova's plugins reside in the global namespace and can be accessed from anywhere. This might be a problem when you are testing your application, built with the concept of dependency injection.

So, the Ionic team came up with a wrapper around the Cordova plugins, whereby you can inject the features as services. In the preceding example, instead of using device.model, we will inject a dependency named $cordovaDevice, and then access properties using the $cordovaDevice.getModel method.

The ngCordova library is not specific to Ionic; this can be used in conjunction with any Cordova app built using AngularJS.

The ngCordova library has 71 plugins at the time of writing this chapter.

For now, let's test-drive a few ngCordova plugins.

Setting...

bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete