Hello,
I would like to do most of my application logic in my app.ts where I bootstrap the ‘MyApp’ component:
export class MyApp {
private rootPage:any;
public value:any;
constructor(private platform:Platform, public cusaApp: CusaApp) {
this.rootPage = TabsPage;
this.value = 'this is a test value';
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();
});
}
/*End of Class MyApp */
}
ionicBootstrap(MyApp, [MyApp], {
tabbarPlacement: ‘bottom’
})
I tried importing MyApp as a provider in other components, but I get an error:
browser_adapter.js:77ORIGINAL EXCEPTION: TypeError: Cannot read property ‘parameters’ of undefined
I believe it is from this line of code where I try to import my main app.ts file:
import {MyApp} from ‘…/…/app’;
@Component({
templateUrl: ‘build/pages/home/home.html’,
providers:[MyApp]
})
export class HomePage {
public value:any;
constructor(private navController: NavController , public myApp: MyApp ) {
console.log(myApp.value);
}
When I was working with Ionic Beta 6, it was possible to do this. However, now I’ve updated to
"ionic-angular": “2.0.0-beta.10”,
Is there anyway for me to import my app.ts into other components?
Any help would be greatly appreciated.