Questions tagged forms

Explore the latest questions and answers asked by our top developers.

get input values by there class

I have a following angular component ts with an ability to add dynamic fields to a form: import {Component, ElementRef, OnInit, ViewChild} from ‘@angular/core’; import {Buildcompany} from "../../models/buildcompany.model"; import {BuildcompanyService} from "../../services/buildcompany.service"; import { FormGroup, FormControl, FormArray, FormBuilder } from ‘@angular/forms’ @Component({ selector: ‘app-add-buildcompany’, templateUrl: ‘./add-buildcompany.component.html’, styleUrls: [‘./add-buildcompany.component.css’], }) export class AddBuildcompanyComponent implements OnInit { […]

By Bogdan Onyshenko
Published
Categorized as angular, angular13, dom, forms, html Tagged , , , ,

Implementing branching logic for forms in angular

I am implementing a survey create Page with angular. I want to use branching logic, i.e., for every option when we click on branching , we should be able to give conditions such as next ques or 3rd ques and so on. So when an user is taking the survey and clicks on a particular […]

By Saran S
Published
Categorized as angular, branch, forms, survey Tagged , , ,

create key value object using angular forms

I have a following output from an api: { "id": 81, "shortname": "testing", "fullname": "test", "address": "addrtest", "telephone": "380979379992", "website": "www.site.com", "sociallinks": { "facebook": "fb.com" }, "foundationyear": "1991", "rating": 1.0 }, All of it is fine. But now I try to add some data using Angular. Problem is with a social links column. It is […]

By Bogdan Onyshenko
Published
Categorized as angular, forms, json Tagged , ,

Angular reactive form – Disabling a required form control makes the form valid even if no value is given

I have created an angular reactive form like below component.html <form [formGroup]="loginForm" (ngSubmit)="onSubmit()"> <h5 class="card-title text-center">Login</h5> <div class="form-group"> <label class="text-success" for="exampleInputEmail1" >Email address</label > <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" formControlName="email" placeholder="Enter email" /> </div> <div class="form-group"> <label class="text-danger" for="exampleInputPassword1" >Password</label > <input type="password" class="form-control" id="exampleInputPassword1" formControlName="password" placeholder="Password" /> </div> <button type="submit" class="btn btn-primary">Login</button> </form> component.ts […]

By Nitheesh
Published
Categorized as angular, forms, javascript Tagged , ,

Angular. Error Cannot read properties of null (reading ‘addFormGroup’)

I have a component with a form: <form [formGroup]="Nsfg.invoiceFormGroup"> <div formGroupName="namespace"> <div class="accordion" id="accordionTrikititta"> <newFacturaE></newFacturaE> <fileHeaderComponent [invoiceFormGroup]="Nsfg.invoiceFormGroup"> </fileHeaderComponent> … As my form grows I need to split it in different components: First one ‘fileHeaderComponent’ In my child component I have in the Html: <div formGroupName="FileHeader"> <div class="form-inline"> …. then I receive an error: ERROR TypeError: […]

By Jos Luis Iriarte
Published
Categorized as angular, forms, parent-child Tagged , ,

Dynamically set input ngModel-name based on @Input()-binding

I am migrating an Angular-Application to AngularJS and stumbled upon a problem which I dont know how to solve or if its even feasable in Angular. Theres a form which contains custom components with input-fields. So far I learned that with template-driven forms in Angular you have to add a parameter to an input like […]

By Vortilion
Published
Categorized as angular, forms Tagged ,

Dynamically set local template variable name based on @Input()-binding

I am migrating an Angular-Application to AngularJS and stumbled upon a problem which I dont know how to solve or if its even feasable in Angular. Theres a form <form novalidate #myAwesomeForm="ngForm" name="myAwesomeForm"> […] </form> which contains some child-components with input-fields: <child-component [fieldId]="’myNameForTheInput’"> </child-component > So far I learned that with template-driven forms in Angular […]

By Vortilion
Published
Categorized as angular, forms Tagged ,

Cannot get form’s children control

I wrote a simple a simple Angular unit test as below: import { Component, ViewChild } from ‘@angular/core’; import { ComponentFixture, TestBed, waitForAsync } from ‘@angular/core/testing’; import { FormsModule, NgForm } from ‘@angular/forms’; fdescribe(‘AppComponent’, () => { @Component({ template: `<form #form="ngForm"> <input [(ngModel)]="test" name="test" /> </form>`, }) class TestHostComponent { public test = ”; @ViewChild(‘form’) […]

How to validate to prevent more then one whitespace? using Angular 2+ and Typescript

I need to validate to user can’t type more than one whitespace on input type. I am find any solution for similar problem but not use case which i need . Check this links: https://www.titanwolf.org/Network/q/77d56d42-68ae-4a29-b239-0145da1c6852/y Here is example for all cases but not for my. I am try with: import { AbstractControl, FormControl } from […]

By Grigory Pavek
Published
Categorized as angular, forms, whitespace Tagged , ,

How can I enable next dropdown selection if current is selected and disable again when previous gets unselected?

I would like to be able to have four dropdown menus that behave as follows: If the current dropdown gets selected, the dropdown next will be enabled. If the current dropdown gets unselected every consecutive dropdown gets disabled Right now I’m able to enable the next dropdown upon selecting the current dropdown, as well as […]

By Diego Burela
Published
Categorized as angular, forms, primeng, reactive Tagged , , ,
1 2 3 61

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq