Loop through array of strings - angular2

angular, angular-template, ngfor

Solution

You have to declare the variable `number` with `let`.

   <li *ngFor="let number of numberOptions">
      {{number}}
   </li>

Problem

Yet very basic thing, but I am unable to figure out how to display array of strings in html template in angular2. .html ``` <ul> <li *ngFor="#number of numberOptions"> {{number}} </li> </ul> ``` .ts `this.numberOptions= ["I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X"];` The above trick is not working for me, text editor shows error for `#number` in `ngFor`. Is this deprecated in new versions? or am I doing anything wrong here?

Original source

Related problems