Template driven forms are simple forms which can be used to develop forms. Template driven forms are called template-driven as everything that we are going to use in the application is defined in the template that we are defining along with the component.
Questions tagged [angular-template-form]
74 questions
6
votes
2 answers
Why don't getters for form errors work in my Angular Reactive Form component template, but a direct reference does?
quick question. It's one of those small annoying bugs. I have an Angular reactive form in a lazy-loaded signup module. The code structure is as follows:
TS
get email() {
return this.myForm.get('email');
}
// This code works from within the…

George43g
- 565
- 10
- 20
6
votes
4 answers
Mixing Reactive Form with Template Form
I have built a big form with lots of input using Template Form. Now I have got a requirement to add a part of input dynamically. Since adding inputs dynamically seems easier with Reactive Form, I would like to change that specific part of inputs to…

suhailvs
- 20,182
- 14
- 100
- 98
5
votes
1 answer
Notification upon Form Reset Event?
Is there a way to get notified when a form is reset via the formReset method?
I have a directive that injects the form and I can get notified when the form is submitted or reset via a reset button but I cannot figure out a way to get notified when…

Adrian Brand
- 20,384
- 4
- 39
- 60
4
votes
1 answer
How to get selected Radio Button values from Mat-radio-group with For loop in Angular
I have a complex object i.e., like below
someName = [
{name: "John",id: "1",rating: ['0', '1', '2', '3', '4', '5']},
{name: "robert", id: "2", rating: ['0', '1', '2', '3', '4', '5']},
{name: "luv", id: "3", rating: ['0', '1', '2', '3', '4',…

kishore
- 356
- 1
- 3
- 20
3
votes
1 answer
When to use template driven & reactive forms in Angular
I have read a lot of articles about the differences about the 2 types of forms in angular but nowhere found practical examples. So, if I have a table, and only a checkbox to select rows, is there any good reason to use reactive form? I can't find…

Michalis
- 6,686
- 13
- 52
- 78
3
votes
1 answer
Listen for template driven form changes in Angular 10
I have a template driven form in my angular 10 app that I am trying to listen for changes to so that I can show an 'changed, please submit updates' message to the user.
HTML
3
votes
1 answer
angular custom component for both template and reactive form
I'm trying to create a custom component (a customized autocomplete field) but I want to work for both reactive forms and template forms
So sometimes the value will come through [(ngModel)] and sometimes i want to provide formControlName
Until now…

Dany Y
- 6,833
- 6
- 46
- 83
3
votes
1 answer
Pass parameter to Angular 7 template driven form custom validator
How can I pass a parameter to a custom validator written for a Template Driven Form in Angular 7?
I've got the following code put together from multiple other questions and blog posts, but most center around Reactive forms rather than tempalte.…

Danyx
- 574
- 7
- 34
3
votes
6 answers
ngbDatepicker set value
In my Angular application, template driven form, I have a date of birth field and added ngbDatepicker for that field as given.

Denuka
- 1,142
- 3
- 13
- 21
3
votes
2 answers
Angular ngFor radio buttons
I've got a few questions like 'what is something' and 4 radio buttons as answers. So it`s like 3 generated
- s in DOM. But the problem is, when I click some radio button, it selects the radio button in another question. How to fix this problem? Is…

Jack Rassel
- 43
- 7
2
votes
0 answers
How to use Angular 2 Reactive form with ng-content
I have "FormWrapper" Component like that
and AppComponent like that:
…

Beshoy Fayez
- 29
- 2
- 2
2
votes
0 answers
how can assign value "$event" to template variable?
since I use several similar mat-inputs inside a template form, I define an ng-template for these mat-inputs and refer to it via *ngTemplateOutlet and also pass related data to the template as bellow:

R. Nourmandi
- 157
- 12
2
votes
2 answers
angular dynamic input populates same value
Im trying to build a form wherein you can create another field of input on clicking an add button. The problem is that same value gets populated for each row input. As you can see from the below image, each row gets the same value. I think it is…

Jijo Robin
- 365
- 9
- 27
2
votes
1 answer
Angular - input wrapped in custom component not working in template driven form
Just like the title says, if I wrap an input in my custom component, it's not being picked up by Angular's template form. Here's the stackblitz
Here's some code from StackBlitz
app.component.html

roman m
- 26,012
- 31
- 101
- 133
2
votes
1 answer
how to validate template driven forms in angular number sign "#"
Hello guys? how can i Validate #permissionInput if there's a value, btw this is angular.

Ryan Arqueza
- 51
- 6