1,628 questions
2
votes
2
answers
177
views
Angular FormControlName vs NgModel Binding
I have a general question using Angular's FormgroupName or NgModel. The Docs I am reading say NgModel was deprecated in Version 6, but it is still available in 17/18, today's current version. The ...
1
vote
1
answer
71
views
Angular Nested Form ngModel meaning
Given the following code snippet:
@Component({
selector: 'app-editor',
templateUrl: './editor.component.html',
styleUrls: ['./editor.component.scss'],
providers: [{
provide: ...
0
votes
1
answer
101
views
Ionic input ngModel two way Data Binding or Add number format
<ion-col size="4">
<ion-input
class="input-field"
style="--padding-end: 20px; text-align: end;"
[(ngModel)]="discountPercent"
...
0
votes
1
answer
396
views
How to implement Optional chaining in ngModel using angular 18
I have scenario in my project that a common shared service having a common variable (object) to store nested objects. I have to access and update its value in html using NgModel. Optional-chaining ...
0
votes
1
answer
36
views
Setting object values to ng-model in angularjs
I am using angularjs 1st version to display values on multiple text fields using ng-model.
I have an object like this
$scope.fieldValues = {
keys: Object.keys(subkeys),
values: Object.values(...
1
vote
1
answer
74
views
2 ngModel return same value when use ControlValueAccessor in Angular
I have component CustomInputComponent
<div>
<input
#input="ngModel"
name="input"
[(ngModel)]="value"
(ngModelChange)="onInputChange()"...
1
vote
1
answer
40
views
Angular unit test failed due to data in HTML NgModel binded to a service's property not updated
I have a LoginPageComponent with email and password fields whose values areNgModel binded to LoginServices's property loginInfo. LoginPageComponent also has Login button, which is disabled when ...
1
vote
1
answer
145
views
Can't bind to 'ngModel' since it isn't a known property of 'input' error when trying to run Angular app
I have this input field in the html file of my Angular component:
<input [(ngModel)]="bookRequest.title" type="text" class="form-control" id="title" name=&...
0
votes
1
answer
898
views
i cannot import FormsModule in task.component.ts file under task folder in angular 18.0.4 [closed]
i cannot import FormsModule in task.component.ts file under task folder .Due to unable to solve error as "Can't bind to 'ngModel' since it isn't a known property of 'input'.ngtsc(-998002)" ....
0
votes
1
answer
141
views
ngModel gives error even after importing FormModule
This is the HTML code
<form (submit)="agregarCliente()">
<div>
<label for="nombre">Nombre:</label>
<input type="text" id="...
0
votes
2
answers
149
views
Angular - edit textbox in grid to update row value
I'm trying to give user the ability to update the quantity of their selection before product checkout. The code below allows only 1 character in the textbox. What changes can I make to allow user ...
1
vote
1
answer
3k
views
Angular 17 "Can't bind to 'ngModel'" in Project without app.module.ts
I am currently developing an Angular 17 Project which was created with standalone components as default and I am always running into this error: "Can't bind to 'ngModel' since it isn't a known ...
1
vote
1
answer
698
views
*ngIf and ngmodel is not working on .html pages
I'm using following versions in Angular, Angular CLI: 17.3.4, Node: 20.9.0, Package Manager: npm 10.5.2. When I'm using *ngIf or ngmodel on .html pages in a component, I'm getting following error ...
7
votes
2
answers
17k
views
Why ngModel doesn't works on the last version of Angular 17?
I am trying to make a form in my angular app, but when i want to implement ngModel on my form :
<form (ngSubmit)="onSignUp()" #signupForm="ngForm">
<h1>...
0
votes
2
answers
174
views
NG8003: No directive found with exportAs 'ngForm'. [plugin angular-compiler]
I was trying to run my website, but when I try to build ng, I get this error:
Prerendered 0 static routes.
Application bundle generation failed. [5.115 seconds]
✘ [ERROR] NG8003: No directive found ...
2
votes
1
answer
109
views
Can't bind ngModel.errors in condition ngSwitchCase
Can't bind ngModel.errors in condition of *ngSwitchCase.
But if i do this on *ngIf, it's work fine for me.
I wan't make a structure of displaying different's error's in condition of *ngSwitchCase.
...
2
votes
0
answers
129
views
Angular 15: no ngModelGroupOptions for ngModelGroup in template driven forms?
I am trying to implement template driven form with custom validations. In it, I want to validate the controls which are under my ngModelGroup on blur instead of triggering the validation as I type/...
-1
votes
1
answer
235
views
ERROR NG8002 Cant bind to 'housingLocation' since it isn't a known property of 'app-housing-location'. (Angular)
keep getting the samen problem, everytime i swap my components from being stanalone, to joining hthem in my app.module, they give these errors :
Link to the repository : https://github.com/JariToni/...
1
vote
1
answer
368
views
ngModel not registering input value in Angular 16
So I am working on this code which uses Angular 16.
For some reason when I submit the form which is supposed to console log the info object, the values inside the object remain empty which also causes ...
1
vote
0
answers
161
views
Can't bind to 'ngModel' since it isn't a known property of 'input'. ngModel
I have encountered this problem. My code seems correct, but I don't know where the error is.
This is Loginapp.module.ts
import { NgModule } from '@angular/core';
import { LoginRoutingModule } from './...
0
votes
1
answer
388
views
@Angular Form is not displaying ( ngForm [(ngModel)]
iam new with Angular and i try to create a form as ngForm. My Problem is when the programme is succesfully compiled the form isnt displayed on my site. I think that i have an issue with the "...
0
votes
1
answer
67
views
'Value' attribute in Angular is not applied to an <input> tag if i also add [(ngModel)]
I am working on a wizard form. The form have multiple steps (Personal, address...). All of this steps represents child component wrapped in a parent component that use NgRx Store to save the data ...
2
votes
1
answer
666
views
ngModel updated but the change not showing in the view in PrimeNG checkbox
I have a list of PrimeNG checkboxes. I have an array binded to it with ngModel called selectedItems. I also have initially checked items in that array. I have a situation where I add items to the ...
0
votes
0
answers
93
views
Can't bind to 'ngModel' although importing { FormsModule } from '@angular/forms'
here is the component.html <input [(ngModel)]="email" (keyup.enter)="onKeyUp()">
here is the error: Can't bind to 'ngModel' since it isn't a known property of 'input'.
here ...
2
votes
1
answer
84
views
Angular ngModelChange showing duplicate value from API json data
UPDATE: I have reproduced the error on Stackblitz for those who want to interact with the code. I have the following JSON data:
related_contacts: [
{
"id": 1,
"...
0
votes
1
answer
58
views
2 way binding ngmodel to a 2d array is giving undefined when dynamically populating the array
I want to use [(ngModel)] bound to a 2d boolean array as I have a nested ngFor loop in the html. I want to populate this array dynamically as data will be coming from database but as the html starts ...
0
votes
0
answers
52
views
How to bind repeated entries to different variables using ngModel in an ngFor loop?
My question is an extension of the following Stack Overflow question: Using ngModel inside an ngFor loop
I have implemented a similar approach to this and it works fine. However, the form that I am ...
0
votes
0
answers
364
views
Set ngModel and ngModelChange programmatically
I can do the following in HTML:
<input
type="text"
[(ngModel)]="..."
(ngModelChange)="..." />
Now I have to set ngModel and ngModelChange ...
0
votes
2
answers
545
views
Why am I getting 'No directive found with exportAs ngModel' error when using FormsModule and ReactiveFormsModule in Angular?
This is my code and I get "No directive found with exportAs 'ngModel'." error message. I've tried adding FormsModule and ReactiveFormsModule to my app.module.ts (declarations) but still have ...
0
votes
0
answers
93
views
How does (ngModel) syntax explicitly work?
I am trying to understand how ngModel directives work in Angular. I ran into this simple line of code, which makes absolutely no sense to me and I'll explain why :
<input (ngModel)="userName&...
1
vote
2
answers
2k
views
Style a HTML select according to the selected option in Angular
I would like to to style a select element in an Angular component differently, when a specific option (with an inactive attribute) is selected.
My component look like this:
class ComponentWithSelect {
...
0
votes
2
answers
1k
views
'ngModel' cannot be binded to 'ion-input'
I am using ionic 7 with angular to build social app and I want to use two way binding to get the data from the input field but ngModel is not recognise
Here is the html content:
<div class="...
0
votes
3
answers
168
views
Angular ngModel with dynamic parameter
In this Angular example, the ngModel binding does not work.
Can someone let me understand why? and if so, What is the best way to do it?
(note that the binding uses a dynamic key)
ts:
constructor() { ...
0
votes
2
answers
1k
views
How to access members of object in ngModel by string keys
I am trying to generate input fields programmatically because there are a whole lot of them.
Unfortunately their database names are != to the display names. Therefor i can't just pipe | keyvalue.
...
0
votes
1
answer
363
views
error NG8003: No directive found with exportAs 'ngModel'
<form>
<div class="form-group">
<label for="firstName">First Name</label>
<input required ngModel name="firstName" #...
0
votes
1
answer
222
views
*ngIf not affecting type check in [(ngModel)]
I have the following type:
interface Video {
metaData?: {
tags?: {
TIT2: string;
};
};
}
In my template
<form class="meta meta__tags" *ngIf="video.metaData?.tags&...
0
votes
1
answer
77
views
How to use *ngFor to create repeating checkbox input fields in Angular
I am trying to create multiple checkbox fields using ngFor. I have an array which consists of project ids, names and types.
So, now I am trying to create multiple input checkbox fields according to ...
0
votes
1
answer
315
views
Angular - Value binding issue while using ng-template and ngTemplateOutlet
I created a live example on Stackblitz with dropdown from primeng.
My issue is that whenever I change the value from the dropdown without ng-template it works fine and all dropdowns are modified, but ...
0
votes
1
answer
166
views
Angular update grid based on checkbox selection
When page load first time at that time I am displaying grid view with current user details.
Now in that I have added one checkbox.
So when user click on that checkbox then that grid should updated ...
0
votes
0
answers
123
views
Angular - template checkboxes in ngFor are linked
For a role assignment website, it is possible to assign a role to a user for a specific application. These roles can have some linked "entities", such as Brands. The content of such entities ...
0
votes
1
answer
79
views
Convert user input with function and ng-model in AngularJS
Im trying to implement in an app, a unit converter from mm to inches and viceversa. This is part of a larger design app and the idea is that the user can work in mm-inch and use a button to change the ...
2
votes
1
answer
3k
views
What is the replacement for ngModel in this code in Angular as I am getting warning for using form control name and ngModel together
I have used ngModel and formControlName together so I am getting warning in console. I want to remove that warning but I am not able to figure out if I am removing ngModel in it than with what should ...
0
votes
0
answers
47
views
Angular insert a char-limit: Property 'invalid' does not exist on type 'HTMLTextAreaElement'. Did you mean 'oninvalid'?
I want to add a character limit and I did this:
but it shows an error by "invalid" last line
<mat-form-field class="fbinput" appearance="outline" style="white-...
0
votes
1
answer
674
views
Get value of a variable in one component to another component using ngmodel
I have two components first and second. From the second component, I am calling the first component. In the first component, I have a matslider module and I want to get that slider on/off status to my ...
1
vote
0
answers
265
views
Angular Material Chips Field Not Submitting in Form
Problem:
I have a form, inside the form all fields are submitted correctly, however, the chips(aka tags in other frameworks) field(for technologies) does not get submitted.
HTML:
<!--MAIN CONTAINER-...
0
votes
1
answer
320
views
My radio button is showing Yes or No depending on whether the SQL database value is "T" or "F." In addition, I want an OnChange event
Here's my code for showing yes or no based on a SQL database. What I am trying to achieve is to update the SQL database based on the user's selection again. When I use ngModel to update a SQL database,...
0
votes
1
answer
681
views
How to build a checkbox list in Angular related to ngModel and other parameters coming from a JSON
I'm working on Angular. I made a checkbox list with a specific ngModel value for each checkbox.
In order to do that, I built a JSON in my TS component file. The JSON looks like this :
test = [
{...
0
votes
1
answer
742
views
How to Data bind to deep nested arrays? Angular Forms
Background:
I am trying to make a three-layered form front-end, the user should be able to fill out the basic details as well as the list object with the title. The list in its entirety needs to be an ...
2
votes
3
answers
2k
views
Typescript property returning undefined
I have encountered very weird behavior using angular model when user selects from an option. I will provide screenshots + code snippets. In summary, I am getting undefined for property that is ...
0
votes
0
answers
344
views
How to fix error NG8002: Can't bind to 'ngModel' since it isn't a known property of 'input'?
I have the following error although I imported the FormsModule in app.module.ts ans I don't know how to solve it.Here is an image of the error
I tried to import everything related to forms but the ...