Hello, I am currently transitioning a project from Angular 1 to TypeScript and Angular 2. One issue I'm facing is getting some property definitions into the Angular 2 component.
Below are the property definitions causing trouble:
import { Component } from 'angular2/core';
@Component({
selector: 'contact-detail',
templateUrl: 'app/contacts/contact-detail.template.html',
styleUrls: ['app/contacts/contact-detail.style.css']
})
export class ContactDetailComponent {
contactFormOptions = {};
contactFormOptions.initDateDefault = '';
contactFormOptions.followUpDateDefault = '';
contactBasicInfo: {};
contactBasicInfo.bdMonth = '0';
contactBasicInfo.bdDay = '0';
}
In Angular 1, defining object properties with dot notation (e.g.,
contactFormOptions.initDateDefault = '';
) worked fine. However, Typescript is throwing an error, expecting a semicolon instead of using dot notation for these properties. Can anyone shed light on why this is happening? What am I overlooking?
Thank you!