When it comes to creating an object class in Angular 2, the common dilemma is whether to initialize values inline or within a constructor. But what exactly is the difference between the two approaches?
export class Foo {
id: string;
name: string = '';
url: string = '';
}
versus
export class Foo {
id: string;
name: string;
url: string;
constructor() {
this.name = '';
this.url = '';
}
}