Template parse warnings:
"#" inside of expressions is deprecated. Use "Let" instead! ....
似乎有做小改版,趕緊來看看 release note ,內容如下:
Before:
- Outside of
ngFor
, a#...
meant a reference. - Inside of
ngFor
, it meant a local variable.
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. Uselet
instead.<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]="...">
- use
簡單說 # 的用法會讓人混淆,
搭配 ngFor 使用,是定義迴圈內的私有變數,
但放在 dom element attribute 位置時,指的又是此 dom element 的參考,
為避免混淆,所以 ngFor 改用 let 宣告私有變數,
就是這麼一回事,
了解前因後果後,
就不會想要翻桌,
狂罵改個屁呀!