I have the following ngOnInit method:
ngOnInit() {
this.countries = this.sharedService.getCountries();
this.shopService.getCurrentShopFromCache().then(shop => {
this.shop = shop;
this.myFormGroup = this.fb.group({
name: [this.shop.name[this.shop.defaultLanguage.code], [Validators.required]],
address: [this.shop.address.address],
city: [this.shop.address.city],
state: [this.shop.address.state],
country: [this.shop.address.country, [Validators.required]],
phone: [this.shop.phone],
email: [this.shop.email],
website: [this.shop.social.website],
twitter: [this.shop.social.twitter],
facebook: [this.shop.social.facebook],
instagram: [this.shop.social.instagram],
foursquare: [this.shop.social.foursquare]
});
}
);
}
I'm getting
formGroup expects a FormGroup instance. Please pass one in.
Where am I wrong?
UPDATE:
<form *ngIf="shop" class="m-form m-form--fit m-form--label-align-right" [formGroup]="myFormGroup" novalidate>
...