【发布时间】:2021-11-24 03:05:51
【问题描述】:
app.component.ts
import { Component, VERSION } from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
name = 'Angular ' + VERSION.major;
str = () => {
console.log('123123');
};
}
app.component.html
<hello name="{{ name }}"></hello>
<p>
Start editing to see some magic happen :)
</p>
<p>{{str()}}</p>
当我重新加载浏览器并检查日志时。角度重新记录 4 次。如果您知道为什么会这样,请告诉我。
链接堆栈闪电战:https://stackblitz.com/edit/angular-ivy-zqjr2d?file=src%2Fapp%2Fapp.component.ts
【问题讨论】:
-
这个问题类似于enter link description here