- In the example below, component’s property is initialize through variable assignment. Take a look at the code “name = ‘Calvin Hobbes'”. This approach is sometimes preferable because it makes code easy to read and also, there will be lesser code to write.
import {Component, View} from 'angular2/core'; @Component({ selector: 'user' }) @View({ template: '{{name}}' }) export class UserComponent { name = 'Calvin Hobbes'; }
- In the code below, the property is first declared and then initialized inside the constructor.
import {Component, View} from 'angular2/core'; @Component({ selector: 'user' }) @View({ template: '{{name}}' }) export class UserComponent { name: string; constructor() { this.name = 'Calvin Hobbes'; } }
- Generative Modeling in Machine Learning: Examples - March 19, 2023
- Data Analytics Training Program (Beginners) - March 18, 2023
- Histogram Plots using Matplotlib & Pandas: Python - March 18, 2023
nice blog too informative. looking and reading your points its so impressive. doing more blog like this. i really appreciated doing like this.