title: Angular 2 (Mock Ionic2) -- No provider for App
body: <p>I'm trying to create a <code>spec.ts</code> for my application. Sadly this is using the <a href="http://ionicframework.com/docs/v2/api/components/loading/LoadingController/" rel="nofollow">LoadingController</a> from <code>ionic-angular</code>. Now when I'm trying to configure the module, I will need to provide it with the LoadingController (since it's in the constructor of the module).</p>
  
  <p>The problem I'm currently running into is that the LoadingController wants to be provided with a <code>App</code> object/instance. (<code>_app: App</code> params)</p>
  
  <p>I was desperate so I asked Ionic themselves. <a href="https://github.com/driftyco/ionic/issues/8539" rel="nofollow">github #8539</a></p>
  
  <p>But they closed my question because it was a question and not an issue, although I'm having issues realizing it which they haven't responded to. It would be a shame if this is impossible/no one knows how, since it's a pretty cool feature and it affects not just the LoadingController, f.e. the AlertController and ToastController are affected by this as well.</p>
  
  <p>My testbed configuration atm:</p>
  
  <pre><code>TestBed.configureTestingModule({
      declarations: [EventsPage],
      schemas: [CUSTOM_ELEMENTS_SCHEMA],
      providers: [
        {provide: APICaller, useValue: mockAPICaller},
        {provide: NavController, useValue: mockNavController },
        {provide: LoadingController, useValue: ???????}, //it seems like everything I try to enter here fails.
      ],
      imports: [FormsModule]
    });
  </code></pre>
  
  <p>And the EventsPage constructor:</p>
  
  <pre><code>constructor(public apiCaller: APICaller, public navCtrl: NavController,
               public loadingCtrl: LoadingController){}
  </code></pre>
  
  <p><strong>EDIT: usage of LoadingController</strong></p>
  
  <pre><code>getEvents() {
      // setup a loadingscreen
       let loading = this.loadingCtrl.create({
        content: "Loading..."
      }); 
     // present the loadingscreen
      loading.present();
  
      // reset the noEvents boolean.
      this.noEvents = true;
  
      // call the api and get all events
      this.apiCaller.getEvents()
      .subscribe(response =&gt; {
        // response is list of events
        this.events = response;
        // if the event is not empty, set noEvents to false.
        if (this.events.length &gt; 0) {
          this.noEvents = false;
        }
        // close the loading message.
       loading.dismiss();
      });
    }
  </code></pre>
  
  <p>Which will then result in this loadingspinner (with different text)</p>
  
  <p><a href="https://i.stack.imgur.com/s70NW.png" rel="nofollow"><img src="https://i.stack.imgur.com/s70NW.png" alt="ionic&#39;s Loading"></a></p>