I have following custom component
<form-text
[(ngModel)]="dataItem.prop1">
</form-text>
How Can I get the property name from class in this case "prop1"?
@Component({
selector: 'form-text',
template: `
<div>
<label *ngIf="label" [attr.for]="identifier"></label>
<input
type="text"
[(ngModel)]="value"
/>
</div>
`,
providers: [{
provide: NG_VALUE_ACCESSOR,
useExisting: FormTextComponent,
multi: true,
}],
})
export class FormTextComponent extends ElementBase<string>{
@ViewChild(NgModel) model: NgModel;
constructor(@Optional() @Inject(NG_VALIDATORS) validators: Array<any>){
super(validators);
}
}
angular somehow knows which property it should update. I want to get the reference or name of this property. thanks
Aucun commentaire:
Enregistrer un commentaire