VALID
Status. Do not understand as to why this is happening.
@model
decorator but it doesn't work.
@ajayojha This do not work:
export class TenantContractGeneralInformation {
@disable({conditionalExpression:function(control:AbstractControl){return true; }})
@prop()
ContractNumber: string = '';
@disable({conditionalExpression:function(control:AbstractControl){return true; }})
@prop()
ExternalContractNumber: string = '';
AccountGUID: string = '';
@required({ message: "FIELD_REQUIRED" })
WorkerCity: string = '';
Any intended reason behind this? How do we mark fields as disabled if we want to without a second property.
Guys this is my model
@required({ message: "FIELD_REQUIRED" })
@date({ message: "INVALID_DATE", allowISODate: true })
@minDate({ value: new Date().toDateString(), message: "INVALID_DATE", allowISODate: true, fieldName:'ContractStartDate', operator: ">" })
ContractExpiryDate: Date;
and template:
<div class="col-4">
<div class="form-group">
<label for="ContractStartDate"
class="control-label">{{ "TENANT_CONTRACT.GENERAL_INFORMATION.CONTRACT_START_DATE" | translate }}</label>
<div class="form-group mycustom">
<input type="text" autocomplete="none" class="form-control" placeholder='{{"SELECT_DATE" | translate}}'
name="ContractStartDate" ngbDatepicker #dpContractStartDate="ngbDatepicker"
formControlName="ContractStartDate"
/>
<div class="input-group-prepend">
<button class="btn" (click)="dpContractStartDate.toggle()" type="button">
<i class="far fa-calendar-alt"></i>
</button>
</div>
</div>
<small class="text-danger" *ngIf="generalInformationGroup.controls.ContractStartDate.errors">
{{ generalInformationGroup.controls.ContractStartDate.errorMessage ||
generalInformationGroup.controls.ContractStartDate.errors.date.message ||
generalInformationGroup.controls.ContractStartDate.errors.mindate.message | translate }}</small>
</div>
</div>
I keep getting the invalid date error. can't apply min date validation
Can't bind to 'rxwebform' since it isn't a known property of 'form'
Guys its not working here also.
var docsControls = this.contractForm.controls["TenantContractDocuments"] as FormArray;
docsControls.clear();
docsControls = new FormArray([]);
this.contractForm.controls["TenantContractDocuments"] = <RxFormArray> docsControls;
documentsArray.forEach((element: DocumentModel) => {
let docGroup = this.formBuilder.formGroup(DocumentSubmission);
let document = element as DocumentSubmission;
docGroup.patchValue(document);
docsControls.push(docGroup);
});
I don't know why when I try to get the this.contractForm.modelInstance
under TenantContractDocuments
I find there is an array but without any values
modelInstance
property to access the value of model object it will bind the value if there exist a value assigned to the particular property, for more clearity have a look at this stackblitz
modelInstance
and paste the model to my API