Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unknown provider: $ionicAppProvider

I get this error when I try to set GCM push's api key in app.js

Here is the code I use:

.config(['$ionicAppProvider', function($ionicAppProvider) {
    // Identify app
    $ionicAppProvider.identify({
        // The App ID for the server
        app_id: 'MY_APP_ID',
        // The API key all services will use for this app
        api_key: 'MY_API_KEY',
        //The GCM project number
        gcm_id: 'MY_GCM_PROJECT_NUMBER'
    });
  }])
like image 911
matdev Avatar asked May 13 '15 09:05

matdev


1 Answers

It looks like you haven't installed the ionic-service-core module and setup your app with it. You'll need to do the following:

1) Install Ionic Service Core. Run ionic add ionic-service-core on the command line for your project

2) Add this script tag to index.html

<script src="lib/ionic-service-core/ionic-core.js"></script>

3) Add the ionic.service.core module to your app.js like so:

angular.module('starter', ['ionic',
  'ionic.service.core',
  'starter.controllers'])
like image 61
jcaruso Avatar answered Nov 19 '22 03:11

jcaruso