How to fix ng-invalid for nested template?Nested forms in Angular 2 JS (RC4 and newer)angular2 - validating FormControlName in child component of parent FormGroupGet a hold of a FormControl instance by querying a component's templateAngular2 reactive forms, how to pass FormGroup and FormArray to sub componentHow to use formControlName and deal with nested formGroup?Add/remove reactive form validators to dynamically created inputsAdding reactivate validators to form with inputs in child components in tabsNested child component validation in angular 4 template driven formsMake parent FormGroup invalid until nested FormGroups Valid - Custom Validator for a FormGroupAngular 6 - Looping through ng-template in child component with having reactive forms
Need to read my home electrical Meter
Can a wizard copy a spell without first identifying it?
Public transport tickets in UK for two weeks
Manager questioning my time estimates for a project
Dad jokes are fun
The art of clickbait captions
Determine this limit
Shorten or merge multiple lines of `&> /dev/null &`
Why are GND pads often only connected by four traces?
On San Andreas Speedruns, why do players blow up the Picador in the mission Ryder?
Which European Languages are not Indo-European?
My players want to grind XP but we're using milestone advancement
Find permutation with highest organization number (OEIS A047838)
Mysterious procedure calls without parameters - but no exceptions generated
What was the idiom for something that we take without a doubt?
Expected maximum number of unpaired socks
What could a self-sustaining lunar colony slowly lose that would ultimately prove fatal?
Why did the person in charge of a principality not just declare themself king?
Why is the Eisenstein ideal paper so great?
Where is Jon going?
How to melt snow without fire or body heat?
How to patch glass cuts in a bicycle tire?
How to cut a climbing rope?
Beginner looking to learn/master musical theory and instrumental ability. Where should I begin?
How to fix ng-invalid for nested template?
Nested forms in Angular 2 JS (RC4 and newer)angular2 - validating FormControlName in child component of parent FormGroupGet a hold of a FormControl instance by querying a component's templateAngular2 reactive forms, how to pass FormGroup and FormArray to sub componentHow to use formControlName and deal with nested formGroup?Add/remove reactive form validators to dynamically created inputsAdding reactivate validators to form with inputs in child components in tabsNested child component validation in angular 4 template driven formsMake parent FormGroup invalid until nested FormGroups Valid - Custom Validator for a FormGroupAngular 6 - Looping through ng-template in child component with having reactive forms
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a form which includes nested templates (child forms). Everything renders, but only the inputs in the parent form are valid. All the inputs in the child templates/forms are ng-invalid
. Because they are invalid, the placeholders in the inputs are not showing, and instead an unsightly [object Object]
shows where the placeholder should be.
Among other attempts:
1. To isolate the problem, I've eliminated validation in the nested form altogether, in which case the inputs in the child template do become ng-valid
and their placeholders render properly, (but note the container <app-sub-enroll-form>
remains ng-invalid
). Because eliminating validation solves the ng-invalid
problem for the inputs
, this suggests that the problem lies somewhere in the validation process, but I can't see where it could be, as the process is virtually identical for the child template vs. the parent template (both use the identical TemplateValidationService
Service). Somewhere in the child template the validation binding must be incorrect?
2. In the nested template, instead of setting the form
to a newly created FormGroup
, I tried adding the new controls to the existing FormGroup
using this.form.addControl
, but received console error that _this.form
was undefined.
3. I've tried making the nested template a <form>
, and also just a <table>
, but this had no effect.
Parent Template
<form #myForm="ngForm" [formGroup]="form">
<h3>Form</h3>
<table>
<tr *ngFor="let key of memberKeys">
<td>key</td>
<ng-container *ngIf="topLevel(member[key]); else subTable">
<td><input type="text" name="key" placeholder="Enter key Here" formControlName="key"/></td>
</ng-container>
<ng-template #subTable>
<app-sub-enroll-form [objEnroll]="member[key]" [formGroup]="form"></app-sub-enroll-form>
</ng-template>
</tr>
</table>
<button type="submit">Submit</button>
</form>
Child Template
<form [formGroup]="form">
<table style="margin-left: 5%;">
<tr *ngFor="let key of objKeys">
<td>key</td>
<td><input type="text" name="key" placeholder="Enter key Here" formControlName="key"/></td>
</tr>
</table>
<form>
Parent Component
export class EnrollFormComponent implements OnInit {
formControls = ;
form: FormGroup;
@Input() member: Member = new Member("");
memberKeys = Object.keys(this.member);
constructor(private templateVal: TemplateValidationService )
// console.log(this.memberKeys);
ngOnInit()
this.memberKeys.forEach((key) =>
let validators = [];
this.templateVal.handleValidation(key, validators);
this.formControls[key] = new FormControl(this.member[key], validators);
)
this.form = new FormGroup(this.formControls);
Child Component
export class SubEnrollFormComponent implements OnInit PhoneData
Template Validation Service:
export class TemplateValidationService
constructor()
handleValidation(key: string, validators: Array<any>)
validators.push(this.noSpecialChars);
noSpecialChars(c: FormControl) ":<>?()]/);
return REGEXP.test(c.value) ?
validateEmail:
valid: false
: null;
I'm hoping to eliminate the ng-invalid
issue (allowing placeholders to render properly) while keeping validation in the nested template. Many thanks in advance if any ideas!
angular
add a comment |
I have a form which includes nested templates (child forms). Everything renders, but only the inputs in the parent form are valid. All the inputs in the child templates/forms are ng-invalid
. Because they are invalid, the placeholders in the inputs are not showing, and instead an unsightly [object Object]
shows where the placeholder should be.
Among other attempts:
1. To isolate the problem, I've eliminated validation in the nested form altogether, in which case the inputs in the child template do become ng-valid
and their placeholders render properly, (but note the container <app-sub-enroll-form>
remains ng-invalid
). Because eliminating validation solves the ng-invalid
problem for the inputs
, this suggests that the problem lies somewhere in the validation process, but I can't see where it could be, as the process is virtually identical for the child template vs. the parent template (both use the identical TemplateValidationService
Service). Somewhere in the child template the validation binding must be incorrect?
2. In the nested template, instead of setting the form
to a newly created FormGroup
, I tried adding the new controls to the existing FormGroup
using this.form.addControl
, but received console error that _this.form
was undefined.
3. I've tried making the nested template a <form>
, and also just a <table>
, but this had no effect.
Parent Template
<form #myForm="ngForm" [formGroup]="form">
<h3>Form</h3>
<table>
<tr *ngFor="let key of memberKeys">
<td>key</td>
<ng-container *ngIf="topLevel(member[key]); else subTable">
<td><input type="text" name="key" placeholder="Enter key Here" formControlName="key"/></td>
</ng-container>
<ng-template #subTable>
<app-sub-enroll-form [objEnroll]="member[key]" [formGroup]="form"></app-sub-enroll-form>
</ng-template>
</tr>
</table>
<button type="submit">Submit</button>
</form>
Child Template
<form [formGroup]="form">
<table style="margin-left: 5%;">
<tr *ngFor="let key of objKeys">
<td>key</td>
<td><input type="text" name="key" placeholder="Enter key Here" formControlName="key"/></td>
</tr>
</table>
<form>
Parent Component
export class EnrollFormComponent implements OnInit {
formControls = ;
form: FormGroup;
@Input() member: Member = new Member("");
memberKeys = Object.keys(this.member);
constructor(private templateVal: TemplateValidationService )
// console.log(this.memberKeys);
ngOnInit()
this.memberKeys.forEach((key) =>
let validators = [];
this.templateVal.handleValidation(key, validators);
this.formControls[key] = new FormControl(this.member[key], validators);
)
this.form = new FormGroup(this.formControls);
Child Component
export class SubEnrollFormComponent implements OnInit PhoneData
Template Validation Service:
export class TemplateValidationService
constructor()
handleValidation(key: string, validators: Array<any>)
validators.push(this.noSpecialChars);
noSpecialChars(c: FormControl) ":<>?()]/);
return REGEXP.test(c.value) ?
validateEmail:
valid: false
: null;
I'm hoping to eliminate the ng-invalid
issue (allowing placeholders to render properly) while keeping validation in the nested template. Many thanks in advance if any ideas!
angular
I can't see from your code what is actually wrong, but i have a suggestion on how you could debug it properly: afterthis.form = new FormGroup(this.formControls);
writewindow['form'] = this.form
now you can access the form group from the browser console and inspect it. Look at the controls error property and see what is set. if the control is invalid an error should be set: angular.io/api/forms/AbstractControl#errors
– x4rf41
Mar 24 at 2:50
Many thanks. Where do I access the control error property? I looked in the Web Console under Inspector, Console, and Debugger, but didn't see where I can find the control error property. Tks!
– Crowdpleasr
Mar 24 at 3:06
window['form'] = this.form
this creates a global variable for the form. So you can just typeform
in the console and then you can inspect the form controls
– x4rf41
Mar 24 at 3:11
Tks. Strangely, errors is ` null` and status isVALID
.
– Crowdpleasr
Mar 24 at 3:20
add a comment |
I have a form which includes nested templates (child forms). Everything renders, but only the inputs in the parent form are valid. All the inputs in the child templates/forms are ng-invalid
. Because they are invalid, the placeholders in the inputs are not showing, and instead an unsightly [object Object]
shows where the placeholder should be.
Among other attempts:
1. To isolate the problem, I've eliminated validation in the nested form altogether, in which case the inputs in the child template do become ng-valid
and their placeholders render properly, (but note the container <app-sub-enroll-form>
remains ng-invalid
). Because eliminating validation solves the ng-invalid
problem for the inputs
, this suggests that the problem lies somewhere in the validation process, but I can't see where it could be, as the process is virtually identical for the child template vs. the parent template (both use the identical TemplateValidationService
Service). Somewhere in the child template the validation binding must be incorrect?
2. In the nested template, instead of setting the form
to a newly created FormGroup
, I tried adding the new controls to the existing FormGroup
using this.form.addControl
, but received console error that _this.form
was undefined.
3. I've tried making the nested template a <form>
, and also just a <table>
, but this had no effect.
Parent Template
<form #myForm="ngForm" [formGroup]="form">
<h3>Form</h3>
<table>
<tr *ngFor="let key of memberKeys">
<td>key</td>
<ng-container *ngIf="topLevel(member[key]); else subTable">
<td><input type="text" name="key" placeholder="Enter key Here" formControlName="key"/></td>
</ng-container>
<ng-template #subTable>
<app-sub-enroll-form [objEnroll]="member[key]" [formGroup]="form"></app-sub-enroll-form>
</ng-template>
</tr>
</table>
<button type="submit">Submit</button>
</form>
Child Template
<form [formGroup]="form">
<table style="margin-left: 5%;">
<tr *ngFor="let key of objKeys">
<td>key</td>
<td><input type="text" name="key" placeholder="Enter key Here" formControlName="key"/></td>
</tr>
</table>
<form>
Parent Component
export class EnrollFormComponent implements OnInit {
formControls = ;
form: FormGroup;
@Input() member: Member = new Member("");
memberKeys = Object.keys(this.member);
constructor(private templateVal: TemplateValidationService )
// console.log(this.memberKeys);
ngOnInit()
this.memberKeys.forEach((key) =>
let validators = [];
this.templateVal.handleValidation(key, validators);
this.formControls[key] = new FormControl(this.member[key], validators);
)
this.form = new FormGroup(this.formControls);
Child Component
export class SubEnrollFormComponent implements OnInit PhoneData
Template Validation Service:
export class TemplateValidationService
constructor()
handleValidation(key: string, validators: Array<any>)
validators.push(this.noSpecialChars);
noSpecialChars(c: FormControl) ":<>?()]/);
return REGEXP.test(c.value) ?
validateEmail:
valid: false
: null;
I'm hoping to eliminate the ng-invalid
issue (allowing placeholders to render properly) while keeping validation in the nested template. Many thanks in advance if any ideas!
angular
I have a form which includes nested templates (child forms). Everything renders, but only the inputs in the parent form are valid. All the inputs in the child templates/forms are ng-invalid
. Because they are invalid, the placeholders in the inputs are not showing, and instead an unsightly [object Object]
shows where the placeholder should be.
Among other attempts:
1. To isolate the problem, I've eliminated validation in the nested form altogether, in which case the inputs in the child template do become ng-valid
and their placeholders render properly, (but note the container <app-sub-enroll-form>
remains ng-invalid
). Because eliminating validation solves the ng-invalid
problem for the inputs
, this suggests that the problem lies somewhere in the validation process, but I can't see where it could be, as the process is virtually identical for the child template vs. the parent template (both use the identical TemplateValidationService
Service). Somewhere in the child template the validation binding must be incorrect?
2. In the nested template, instead of setting the form
to a newly created FormGroup
, I tried adding the new controls to the existing FormGroup
using this.form.addControl
, but received console error that _this.form
was undefined.
3. I've tried making the nested template a <form>
, and also just a <table>
, but this had no effect.
Parent Template
<form #myForm="ngForm" [formGroup]="form">
<h3>Form</h3>
<table>
<tr *ngFor="let key of memberKeys">
<td>key</td>
<ng-container *ngIf="topLevel(member[key]); else subTable">
<td><input type="text" name="key" placeholder="Enter key Here" formControlName="key"/></td>
</ng-container>
<ng-template #subTable>
<app-sub-enroll-form [objEnroll]="member[key]" [formGroup]="form"></app-sub-enroll-form>
</ng-template>
</tr>
</table>
<button type="submit">Submit</button>
</form>
Child Template
<form [formGroup]="form">
<table style="margin-left: 5%;">
<tr *ngFor="let key of objKeys">
<td>key</td>
<td><input type="text" name="key" placeholder="Enter key Here" formControlName="key"/></td>
</tr>
</table>
<form>
Parent Component
export class EnrollFormComponent implements OnInit {
formControls = ;
form: FormGroup;
@Input() member: Member = new Member("");
memberKeys = Object.keys(this.member);
constructor(private templateVal: TemplateValidationService )
// console.log(this.memberKeys);
ngOnInit()
this.memberKeys.forEach((key) =>
let validators = [];
this.templateVal.handleValidation(key, validators);
this.formControls[key] = new FormControl(this.member[key], validators);
)
this.form = new FormGroup(this.formControls);
Child Component
export class SubEnrollFormComponent implements OnInit PhoneData
Template Validation Service:
export class TemplateValidationService
constructor()
handleValidation(key: string, validators: Array<any>)
validators.push(this.noSpecialChars);
noSpecialChars(c: FormControl) ":<>?()]/);
return REGEXP.test(c.value) ?
validateEmail:
valid: false
: null;
I'm hoping to eliminate the ng-invalid
issue (allowing placeholders to render properly) while keeping validation in the nested template. Many thanks in advance if any ideas!
angular
angular
asked Mar 24 at 1:06
CrowdpleasrCrowdpleasr
163110
163110
I can't see from your code what is actually wrong, but i have a suggestion on how you could debug it properly: afterthis.form = new FormGroup(this.formControls);
writewindow['form'] = this.form
now you can access the form group from the browser console and inspect it. Look at the controls error property and see what is set. if the control is invalid an error should be set: angular.io/api/forms/AbstractControl#errors
– x4rf41
Mar 24 at 2:50
Many thanks. Where do I access the control error property? I looked in the Web Console under Inspector, Console, and Debugger, but didn't see where I can find the control error property. Tks!
– Crowdpleasr
Mar 24 at 3:06
window['form'] = this.form
this creates a global variable for the form. So you can just typeform
in the console and then you can inspect the form controls
– x4rf41
Mar 24 at 3:11
Tks. Strangely, errors is ` null` and status isVALID
.
– Crowdpleasr
Mar 24 at 3:20
add a comment |
I can't see from your code what is actually wrong, but i have a suggestion on how you could debug it properly: afterthis.form = new FormGroup(this.formControls);
writewindow['form'] = this.form
now you can access the form group from the browser console and inspect it. Look at the controls error property and see what is set. if the control is invalid an error should be set: angular.io/api/forms/AbstractControl#errors
– x4rf41
Mar 24 at 2:50
Many thanks. Where do I access the control error property? I looked in the Web Console under Inspector, Console, and Debugger, but didn't see where I can find the control error property. Tks!
– Crowdpleasr
Mar 24 at 3:06
window['form'] = this.form
this creates a global variable for the form. So you can just typeform
in the console and then you can inspect the form controls
– x4rf41
Mar 24 at 3:11
Tks. Strangely, errors is ` null` and status isVALID
.
– Crowdpleasr
Mar 24 at 3:20
I can't see from your code what is actually wrong, but i have a suggestion on how you could debug it properly: after
this.form = new FormGroup(this.formControls);
write window['form'] = this.form
now you can access the form group from the browser console and inspect it. Look at the controls error property and see what is set. if the control is invalid an error should be set: angular.io/api/forms/AbstractControl#errors– x4rf41
Mar 24 at 2:50
I can't see from your code what is actually wrong, but i have a suggestion on how you could debug it properly: after
this.form = new FormGroup(this.formControls);
write window['form'] = this.form
now you can access the form group from the browser console and inspect it. Look at the controls error property and see what is set. if the control is invalid an error should be set: angular.io/api/forms/AbstractControl#errors– x4rf41
Mar 24 at 2:50
Many thanks. Where do I access the control error property? I looked in the Web Console under Inspector, Console, and Debugger, but didn't see where I can find the control error property. Tks!
– Crowdpleasr
Mar 24 at 3:06
Many thanks. Where do I access the control error property? I looked in the Web Console under Inspector, Console, and Debugger, but didn't see where I can find the control error property. Tks!
– Crowdpleasr
Mar 24 at 3:06
window['form'] = this.form
this creates a global variable for the form. So you can just type form
in the console and then you can inspect the form controls– x4rf41
Mar 24 at 3:11
window['form'] = this.form
this creates a global variable for the form. So you can just type form
in the console and then you can inspect the form controls– x4rf41
Mar 24 at 3:11
Tks. Strangely, errors is ` null` and status is
VALID
.– Crowdpleasr
Mar 24 at 3:20
Tks. Strangely, errors is ` null` and status is
VALID
.– Crowdpleasr
Mar 24 at 3:20
add a comment |
1 Answer
1
active
oldest
votes
Many thanks to @x4rf41 for suggesting use of the debugger. Now that I have that tool at my disposal, I see that whereas I had thought I was passing a string to the validation handler in the child forms, I was actually passing an object, so the validation handler was correct in marking the input as ng-invalid
. To fix this, I needed to add an extra dimension when creating the form control: this.formControls[key] = new FormControl(this.objEnroll[key][1], validators)
(as opposed to the previous: this.formControls[key] = new FormControl(this.objEnroll[key], validators)
. Embarrasing oversight, but now that I know how to use the debugger, hopefully in the future I'll catch these types of errors before posting to the community. Many thanks to everyone for their patience and help as I get up to speed on this stuff!
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55319850%2fhow-to-fix-ng-invalid-for-nested-template%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Many thanks to @x4rf41 for suggesting use of the debugger. Now that I have that tool at my disposal, I see that whereas I had thought I was passing a string to the validation handler in the child forms, I was actually passing an object, so the validation handler was correct in marking the input as ng-invalid
. To fix this, I needed to add an extra dimension when creating the form control: this.formControls[key] = new FormControl(this.objEnroll[key][1], validators)
(as opposed to the previous: this.formControls[key] = new FormControl(this.objEnroll[key], validators)
. Embarrasing oversight, but now that I know how to use the debugger, hopefully in the future I'll catch these types of errors before posting to the community. Many thanks to everyone for their patience and help as I get up to speed on this stuff!
add a comment |
Many thanks to @x4rf41 for suggesting use of the debugger. Now that I have that tool at my disposal, I see that whereas I had thought I was passing a string to the validation handler in the child forms, I was actually passing an object, so the validation handler was correct in marking the input as ng-invalid
. To fix this, I needed to add an extra dimension when creating the form control: this.formControls[key] = new FormControl(this.objEnroll[key][1], validators)
(as opposed to the previous: this.formControls[key] = new FormControl(this.objEnroll[key], validators)
. Embarrasing oversight, but now that I know how to use the debugger, hopefully in the future I'll catch these types of errors before posting to the community. Many thanks to everyone for their patience and help as I get up to speed on this stuff!
add a comment |
Many thanks to @x4rf41 for suggesting use of the debugger. Now that I have that tool at my disposal, I see that whereas I had thought I was passing a string to the validation handler in the child forms, I was actually passing an object, so the validation handler was correct in marking the input as ng-invalid
. To fix this, I needed to add an extra dimension when creating the form control: this.formControls[key] = new FormControl(this.objEnroll[key][1], validators)
(as opposed to the previous: this.formControls[key] = new FormControl(this.objEnroll[key], validators)
. Embarrasing oversight, but now that I know how to use the debugger, hopefully in the future I'll catch these types of errors before posting to the community. Many thanks to everyone for their patience and help as I get up to speed on this stuff!
Many thanks to @x4rf41 for suggesting use of the debugger. Now that I have that tool at my disposal, I see that whereas I had thought I was passing a string to the validation handler in the child forms, I was actually passing an object, so the validation handler was correct in marking the input as ng-invalid
. To fix this, I needed to add an extra dimension when creating the form control: this.formControls[key] = new FormControl(this.objEnroll[key][1], validators)
(as opposed to the previous: this.formControls[key] = new FormControl(this.objEnroll[key], validators)
. Embarrasing oversight, but now that I know how to use the debugger, hopefully in the future I'll catch these types of errors before posting to the community. Many thanks to everyone for their patience and help as I get up to speed on this stuff!
answered Mar 24 at 5:43
CrowdpleasrCrowdpleasr
163110
163110
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55319850%2fhow-to-fix-ng-invalid-for-nested-template%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I can't see from your code what is actually wrong, but i have a suggestion on how you could debug it properly: after
this.form = new FormGroup(this.formControls);
writewindow['form'] = this.form
now you can access the form group from the browser console and inspect it. Look at the controls error property and see what is set. if the control is invalid an error should be set: angular.io/api/forms/AbstractControl#errors– x4rf41
Mar 24 at 2:50
Many thanks. Where do I access the control error property? I looked in the Web Console under Inspector, Console, and Debugger, but didn't see where I can find the control error property. Tks!
– Crowdpleasr
Mar 24 at 3:06
window['form'] = this.form
this creates a global variable for the form. So you can just typeform
in the console and then you can inspect the form controls– x4rf41
Mar 24 at 3:11
Tks. Strangely, errors is ` null` and status is
VALID
.– Crowdpleasr
Mar 24 at 3:20