New Loading service Ionic 2

Hey all,

I encounter a problem using the new Ionic Loading service (in Ionic Beta-6)

I import it like this :

import {Page, Loading, NavController, NavParams, Alert} from 'ionic/ionic';

But when I try to create a new Loading :

public ionicLoader = Loading.create();

I have the following error :

ORIGINAL EXCEPTION: TypeError: Cannot read property 'create' of undefined

Am I doing something wrong ?
Thanks by advance

Try importing from ‘ionic-angular’

import {Page, Loading, NavController, NavParams, Alert} from 'ionic-angular';

I have the following error :

Module build failed: Error: Cannot resolve module 'ionic-angular'

Because in my Package.json, I am using the following (from the Ionic template I used) :

"angular2": "2.0.0-beta.15",
"ionic": "2.0.0-beta.6",

Do I have to change it to ionic-angular ?

The dependencies of the ionic starters is currently:

  "dependencies": {
    "angular2": "2.0.0-beta.15",
    "es6-shim": "^0.35.0",
    "ionic-angular": "2.0.0-beta.6",
    "ionic-native": "^1.1.0",
    "ionicons": "3.0.0",
    "rxjs": "5.0.0-beta.2"


If you started your project using

ionic start YOURPROJECTNAME --ts --v2

(assuming you’re using Typescript)

then your package.json should look the same as above.


Thanks a lot for your help.

I started my project 2 months ago, and I was still using an old version I think. I updated all my dependencies with the new templates (and used .ts files instead of js ones), and it works fine now :slight_smile:

@remiprivet I’ll also recommend you to also take a look at the guide for updating to beta.6 to make sure that you’re not missing something, because there were some changes here and there.

Yeah I saw it and made the changes, thanks :slight_smile:
The project seems longer to compile and re-compile when a modification occurs, but it works.

This is because of the source-maps generation, as described in browserify-typescript:

Setting options.browserifyOptions.debug to false will disable sourcemaps and drastically speed up your rebuilds when watching.