Hello,
I,m back, furthermore new to ionic and web stuff and will learn more.
An exsample shows how to get the instance from html with # and bring it into .ts File.
<ion-card>
<ion-card-content>
<ion-item>
<ion-label>Toppings</ion-label>
<ion-select [(ngModel)]="toppings" multiple="true" #tops>
<ion-option>Bacon</ion-option>
<ion-option>Black Olives</ion-option>
<ion-option>Extra Cheese</ion-option>
</ion-select>
</ion-item>
<button ion-button (click)="openIt(tops)">Open</button>
</ion-card-content>
</ion-card>
and in .ts
openIt(tops) {
tops.open();
}
Works like descripted, also with my components. Fine.
My questions are:
a) If I add my component to html without #example , how I get the instance of my component from a .ts file?
b) How I add ‘#example’ to a component, that is created by code?
c) If a) isn’t working, how I add ‘#exsample’ to existing instance of my component?
d) What is the best way to access an instance of my component from any place.
Thanks in advance, anna-liebt.