I'm currently facing issues with bootstrapping certain files in my application. Specifically, I am working on extending the Ionic2 tabs example.
Within my codebase, I have a Service and a User file, both annotated with @injectable. I am aiming for a single instance throughout the entire app, so my approach revolves around bootstrapping it. I have included Platform in the providers, but I am uncertain whether I should have one instance for the entire app or per component?
import {App, Platform} from 'ionic-angular';
import {bootstrap} from 'angular2/platform/browser';
import {TabsPage} from './pages/tabs/tabs';
import {User} from './User.ts';
import {Service} from './Service.ts';
import {Type} from 'angular2/core';
@App({
template: '<ion-nav [root]="rootPage"></ion-nav>',
providers: [Platform]
})
export class MyApp {
rootPage: Type = TabsPage;
constructor(platform: Platform, user: User) {
platform.ready().then(() => {
user.start();
});
}
}
bootstrap(MyApp, [
Service,
User
]);
Upon inspection, I noticed two errors appearing in the console
Cannot resolve all parameters for 'Platform'(?). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'Platform' is decorated with Injectable.
followed by
Uncaught TypeError: Cannot read property 'getOptional' of undefined
As an illustration, here is an excerpt from my service
import {Injectable} from 'angular2/core';
@Injectable()
export class Service {
//
}