How to change text in template via a method


#1

hello guys,

i am new to ionic and app development. so i have a very simple question, but i could not find any answer in the docs.

i have a template file which contains text in a

<pre>

element, i would like to change the text inside this element over a method which i call via a button.

how can i access the pre element inside the .ts file?

thank you :slight_smile:


#2

It will be easier if you think about this the other way around: how do I pull information from my backing class (".ts file") into my template? The answer is property binding and interpolation, described here.


#3

Thank you. But how can I add a line break?

I tried <br> and \n but this did not solve my problem.