I am learning Angular4 and going through the tutorial examples.
https://angular.io/docs/ts/latest/tutorial/toh-pt1.html
I have the below code in the tutoria
export class AppComponent {
title = 'Tour of Heroes'; // here you assign a value to var.
hero: Hero = {
id: 1,
name: 'Windstorm'
};
}
export class Hero {
id: number; // <= here you are declaring a var to be a string but without value
name: string;
}
you don't need to declare primitives if you assign there value immediately (number, string, boolean).