直接在Component类中初始化组件的属性与在ngOineit方法中初始化组件属性有什么不同?
Example :个
@Component({})
export class AppComponent {
property: string = 'some initial value'
}
**VS**
@Component({})
export class AppComponent implements OnInit{
property: string;
ngOninit(): void {
this.property = 'some initial value';
}
}