Importing Bootstrapped Component


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.


/*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’;

templateUrl: ‘build/pages/home/home.html’,

export class HomePage {

public value:any;

constructor(private navController: NavController , public myApp: MyApp ) {


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.

This is a bad idea. Abstract whatever you are doing in MyApp into a service.

I’m aware I can do it as a service. It’s odd that I was able to do it before when it used the @app decorator.

Would you mind explaining why it’s a bad idea?

Because values like that are a model layer concept, whereas Ionic app classes, being components, live in the view layer. Components should only interact with one another via input and output properties: that makes the interface clearly defined. Services have APIs so it is similarly clear how to interact with them.

Thanks! That makes sense and it appears that what I’d like to do is impossible anyway