Am starting out in angular2 and have run into 2 different syntax but am not sure of the difference - or rather how they work.
i see this:
In beta.17 the syntax changed and only this form is valid anymore
<select class="form-control" required
[(ngModel)]="model.power"
ngControl="power" #power="ngForm" >
<option *ngFor="let p of powers" [value]="p">{{p}}</option>
</select>
See also https://github.com/angular/angular/blob/master/CHANGELOG.md#200-beta17-2016-04-28
BREAKING CHANGES
The reference
#...now always meansref-.Before:
- Outside of
ngFor, a#...meant a reference.- Inside of
ngFor, it meant a local variable.This pattern was confusing.
After:
<template #abc>now defines a reference to a TemplateRef, instead of an input variable used inside of the template.- Inside of structural directives that declare local variables, such as
*ngFor, usage of#...is deprecated. Useletinstead.<div *ngFor="#item of items">now becomes<div *ngFor="let item of items">var-...is deprecated.- use
#or aref-outside of*ngFor- for
ngFor, use the syntax:<template ngFor let-... [ngForOf]="...">