0

I have this angular2 components:

export class CountryDetailsComponent extends LoadingPage implements OnInit {
  countryName: string;
  productionForm: FormGroup;

..
}

and

@Component({
  selector: 'error-messages',
  template: `<div style="color:#E82C0C; margin: 6px 0;" *ngIf="errorMessage !== null">{{errorMessage}}</div>`
})
export class ErrorMessagesComponent {
  @Input() control: FormControl;
  constructor() { }

and template:

              <div class="col-lg-10 ">
                <input class="price-format form-control" type="text"
                       [formControl]="productionForm.controls.priceFormat"
                       [(ngModel)]="productionConfig.priceFormat"
                       id="inputPriceFormat"
                       name="priceFormat">
                <error-messages [control]="productionForm.controls.priceFormat"></error-messages>
              </div>

but i get this error:

Can't bind to 'control' since it isn't a known property of 'error-messages'.
1. If 'error-messages' is an Angular component and it has 'control' input, then verify that it is part of this module.
2. If 'error-messages' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to suppress this message.
 ("nputPriceFormat"
                           name="priceFormat">
                    <error-messages [ERROR ->][control]="productionForm.controls.priceFormat"></error-messages>
                  </div>
          "): b@43:36

how should i fix this?

Elad Benda2
  • 13,852
  • 29
  • 82
  • 157
  • Have you tried this solution ? http://stackoverflow.com/a/39152110/4587148 – Sajan Oct 19 '16 at 08:56
  • @sajan what does this mean? `then verify that it is part of this module` I have in error-messages this import `import { FormGroup, FormControl } from '@angular/forms';` – Elad Benda2 Oct 19 '16 at 09:10

0 Answers0