Access the methods of an Ionic Component, placed inside a custom component?


#1

How do I get a handle for an Ionic Component, that is inside of a custom component?

Any component should be found using IonicApp.getComponent(‘id’) – but if I place an ion-content inside a custom component, which then is used in the app.html, it seems to be not registering itself into the app?

The custom component is importing things from ionic:

import {Component} from 'angular2/angular2';
import {IonicApp, Content} from 'ionic/ionic';

@Component({
    selector: 'test-list',
    templateUrl: 'app/test-list/test-list.html',
    directives: [Content]
})
export class TestList {
    constructor(ionicApp: IonicApp) {
        this.ionicApp = ionicApp;
    }
    someMethod(){
        // throws Error, getComponent does not find the content component:
        this.ionicApp.getComponent('the-id-of-the-ion-content').scrollTo...
    }
}

test-list.html:

<ion-content id="the-id-of-the-ion-content">...

How to use Ionic components inside custom components/directives
#2

I think the issue is resolved in alpha-54, I have no issues in importing the Content.