EXCEPTION: No provider for ElementRef! (Content -> ElementRef)


#1

How can I add the Content provider to my App?

If I register the provider in a specific component it works fine, but when I register it in the ionicBootstrap I get the following error:

EXCEPTION: No provider for ElementRef! (Content -> ElementRef)

here is my App.ts:

import {Component} from "@angular/core";
import {ionicBootstrap, Platform, Content} from "ionic-angular";
import {StatusBar} from "ionic-native";

import {BackendService} from "./backend/backend.service";

import {LoginComponent} from "./pages/login/login.component";

@Component({
    template: "<ion-nav [root]='rootPage'></ion-nav>"
})
export class App {
    // We tell our app which is the first page (main, root, or wahtever you like to call it...)
    private rootPage: any = LoginComponent;

    constructor(private platform: Platform) {
        this.initializeApp();
    }

    private initializeApp() {
        this.platform.ready().then(() => {
            // Okay, so the platform is ready and our plugins are available.
            // Here you can do any higher level native things you might need.
            StatusBar.styleDefault();
        });
    }
}

ionicBootstrap(App, [BackendService, Content], {});

RC0 Upgrade : No Provider for ElementRef
#2

Content is a component, not an injectable. It’s not something you can use a provider.


#3

Why does it work when I inject it in the constructor of other components? It only does not work when I use in the ionicBootstrap.

Nevertheless, if this is not the way to use it, do you have any sample of how to use Content?


#4

Yes, we have examples.


#5

That is brilliant. Thank you very much.