Search code examples
angularjsionic-frameworkngcordova

Error: [$injector:unpr] Unknown provider: $cordovaFileProvider <- $cordovaFile <- DashCtrl


Created a test project to try $cordovaFile from ngCordova, But after injecting $cordovaFile to one of the controllers and running xcode project, I see Unknown provider error.

.controller('DashCtrl', function($scope,$cordovaFile) {})

I really don't see a way for this error to pop-up.

Explained the commands what I ran on terminal below:

Created a new project using:

1. ionic start writefile
2. platform ios is added by default (using mac)
3. cordova plugin add cordova-plugin-file - added file plugin using ngcordova source
4. ionic build ios
5. Ran the project using xcode to run on simulator.

Debugging the issue, but posting on community which might help me in solving quicker.


Solution

  • First install the plugin using

    bower install -SF ngCordova
    

    Include ng-cordova.js from dist directory from the included ngCordova library, in your index.html

    Then include 'ngCordova' in your app

    angular.module('myApp', ['ngCordova'])