[Newbie] Variables

let say i want to display a string in page.html:
<h1>{{stringvariable}}</h1>

-> what is the correct way to declare the stringvariable in page.ts ?
thx

let stringvariable …

Wrong. Template expressions can only access controller object properties, not lexical variables. To OP: RTFM.

Wrong way? because it’s working fine…

question: string;

constructor() {
this.question= ‘What do you wish?’;
}

is working, but how can I handle array-variables like:

questionarray = ["1","What do you wish?", "A", "B", "C"];
question=this.questionarray[1];

in a correct way? thx

It’s really worth going through the whole Tour of Heroes. This topic is covered in chapter 2.

will do that, thx! :slight_smile: