212 questions
1
vote
0
answers
112
views
Create Dropdown menu with Angular Signal with default value and an extra option
I am not sure what's the proper way to set up the drop drop down options. the code I have is not working. please help. this is angular 18.
I have an array that is a computed signal, this is the ...
1
vote
2
answers
41
views
Angular implicit ngModel change handler when ngModelChange isn't specified?
I'm experienced in the use of [(ngModel)] to achieve two-way value binding between a component field and a form control in the component's template, and the use of (ngModelChange) to perform ...
1
vote
1
answer
49
views
Angular [(ngModel)] does not show values after new item added to Array
After I add an Object to the array, the values don't appear in the tableInputRow.name but the values from tableInputRow.priority work.
This is the object pushed to the Array
export class ...
0
votes
1
answer
162
views
Can't bind to 'ngModel' since it isn't a known property of 'query-builder' error in angular2-query-builder library
i am using angular2-query-builder library in my project. my angular cli version is 13.0.4 and "angular2-query-builder" is "^0.6.2". i added QueryBuilderModule at app.module.ts file....
0
votes
2
answers
3k
views
How to make a unit test for to check checkbox is checked in a component
I have trouble with unit test in Angular 2+. And now I am trying the smaller example (similar to my component) to learn how to test a input checkbox with ngmodel. But it does not run.
Here my smaller ...
0
votes
1
answer
114
views
(ngModelChange) not triggers the function in Angular 2+
I have two input fields and when I enter any number value in input field 1 (dummy1) it should update the input field 2 (dummy2). Once input field 2 is updated, it should trigger the successMessage(). ...
1
vote
1
answer
2k
views
Can't bind to 'ngModel' since it isn't a known property of 'mat-select', BUT FormsModule is already imported
I'm receiving the old and very well know error: "Can't bind to 'ngModel' since it isn't a known property of 'mat-select.'"
BUT
FormsModule is imported on app.module.ts.
FormsModule is ...
1
vote
1
answer
3k
views
Angular - ngModel is not updating the value to the component
The ngModel is not working. I'm using it with textbox.
app.component.html
<input type="text" [value]="name" [ngModel]="name">
Name is: {{name}}
app.component.ts
...
0
votes
1
answer
2k
views
Multiple NgModelGroup nesting across different components
When I try to nest NgModelGroup inside another NgModelGroup, it looks like Angular just ignore it. I'm using Angular 12 and Template-driven Forms.
This is how my code looks like:
app.component.html
&...
0
votes
2
answers
245
views
I have been having issues in implementing a filter of item categories in an ecommerce being built using NodeJs and Angular
In the following
code snippets you the filter functions doesn't work.
Component HTML:
<div class="products-page">
<div class="grid">
<div class="col-3"&...
1
vote
2
answers
10k
views
Understanding Angular FormBuilder with Groups and ngModel data and how/if they can be used together?
I am running into some issues with trying to use FormBuilder in my Angular app and how I can set the default values in the form based on my ngModel data.
In my class, I have the following code:
form: ...
0
votes
1
answer
1k
views
ngModel is not working (Forms Module I have imported)
I have imported forms module. Also I have included in imports section still I am getting error. It is highlighting error in html files only. I am not able to understand the issue.
<textarea rows=&...
0
votes
1
answer
9k
views
Error: NG0301: Export of name 'ngModel' not found
So I'm trying to add a simple validation message.
App.Module.ts
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
@NgModule({
...
imports: [ FormsModule, ReactiveFormsModule, ]
})
...
1
vote
0
answers
286
views
Angular form validation classes without ngModel
I am trying to get the Angular form validation, i.e. ng-touched, ng-valid, etc. working on a input element without an ngModel binding. There are three radio buttons: a, b and ab, which I need to map ...
0
votes
1
answer
2k
views
ngModel in MatDialog not updating model when value entered in dialog
I'm sure I must be missing something terribly simple but I've been thrashing about with this for a full day now...
I have a MatDialog with one text input.
Upon closing the dialog this value needs to ...
0
votes
1
answer
1k
views
Two way binding in angular 9 forms
Two way binding in angular 9 form
I tried using [(ngmodel)] in form but it gives error This is depricated in angular 6 and above versions
3
votes
1
answer
2k
views
Angular - TextArea with Multiple Binding
I have two input field ("name" and "city") and one textarea on my screen. Text area is filled up with some JSON data and data contains a few details like "name", "...
0
votes
3
answers
273
views
Angular - Deep nested object models are linked
I've a Angular application which displays company & contact person information on a text box as below
Company Email address:
<label> Company Email address</label>
<input type=&...
2
votes
0
answers
202
views
Angular directive not updating ngModel
I created a custom directive for telephone number mask (eg: 123-234-4566). My input box have minlength and maxlength 12. If I copy paste a 10 digit number in the element, The directive updated the ...
2
votes
2
answers
1k
views
Two-way data binding in Angular
My question is referring to all Angular versions >= 2
So for two-way data binding, does Angular support it out of the box using ngModel. Is it only supported for form controls e.g. input box ?
Is ...
4
votes
1
answer
2k
views
Two-way binding for select element doesn't work properly | Angular 11
I have a JSON with structure:
For item
"item": {
"pk": "123456",
"title": "Title4",
"list_fields": [
{
...
1
vote
1
answer
392
views
Angular 10 - Can't bind to 'ngModel' since it isn't a known property of 'select'
I tried to start a new project on angular 10 today, but i got this problem whenever a try to use a ngModel inside of anything, and i know that question was already asked and resolved several times ...
1
vote
2
answers
1k
views
How can avoid the use of ngModel
I've been stuck on something for hours and I need some help. I'm pretty new to angular.
I'm working with the reactive forms, showing my code and explaining what I want to accomplish.
<mat-form-...
0
votes
1
answer
370
views
Two-way event binding doesn't work inside form tag Angular 2
I have a form which has an input. I applied two-way event binding on the input, however, it doesn't work. I have imported the FormsModule in my AppModule and I am not getting any errors.
search....
0
votes
2
answers
53
views
Angular option with ngModel does not display default option when paired with the value property
I have a list of types in my component.ts as followed.
public type: string;
types:Array<Object> = [
{name: "Category", value: "c"},
{name: "Cuisine",...
-1
votes
1
answer
320
views
Angular NgModel Does Not Work At All: Object(...) is not a function
Angular NgModel Does Not Work At All: Object(...) is not a function
Even just having ngModel on an input was crushing my runtime. Did I remember to import the FormsModule? Yes. Having #form="...
0
votes
0
answers
451
views
How To Bind Interpolation value To ngModel In angular 9
Good day Community,
I have a problem with binding interpolated data/value with [ngModel], I would like to send the interpolated data to my database so i can get it and use it, but its sending and ...
0
votes
2
answers
1k
views
Angular 9 | ngModel Provider in Directive not working as expected
I have one directive which reads the dirty state of the input control and takes some action.
Following is the code of the directive.
// our root app component
import { Directive, HostListener, Input } ...
0
votes
1
answer
310
views
how to manipulate an ngmodel whose value is an attribute that comes from an ngFor
I would like to know how I can manipulate an input that has as ngModel an attribute that comes from an ngFor, and change its value in the component, next I show my code
HTML
FRONT
the idea is that ...
0
votes
1
answer
81
views
Is it possible in Angular to display a value in an option but return an array to the ngModelChange?
I am trying to organize a drop down list that will display a single value to the user but will also pass back an array object upon changing the selection.
Currently I have an array called ...
0
votes
1
answer
1k
views
Angular: How to get value from one component's frontend (app.compont.html) to another component's backend (other.component.ts)
Consider a simple crud scenario. I have a lot of input fields and buttons in app.component.html. When i press a button from app.component.html, it will send html field value to 'other.component.ts' ...
0
votes
2
answers
3k
views
How to update multiple parameters with ngModelChange?
In my application I would like to change 3 values with one ngModelChange.
My component looks like:
model: any = {};
images: any;
public input = true;
public dropdown = false;
images : ...
4
votes
1
answer
11k
views
ControlValueAccessor ngModel not being updated
This is simple custom form control
@Component({
selector: 'app-custom-control',
template: `
{{ value }}
<input [ngModel]="value" (ngModelChange)="onChange($event)">
`,
providers:...
3
votes
3
answers
5k
views
How can I prevent NgModel from setting invalid form control values?
How can I prevent NgModel from setting invalid template-driven form control values? I verified that NgModel will set invalid values when two-way bound to a model instance. I am aware that I can create ...
3
votes
5
answers
19k
views
Angular select options control does not reset ngModel value automatically even if I empty the array of options
I have a very basic select-option input control in Angular 8. User selects one item from dropdown and it's reflected correctly in dropdown as well as in ngModel variable.
But if I empty the source ...
0
votes
3
answers
11k
views
Select option with ngModel
I have a project that has a select of several questions and I would like the first one to appear by default.
I have seen an example of how to achieve this using the index, of the type:
<select>...
1
vote
1
answer
614
views
ngModel two way databinding does not bind correctly inside a *ngFor loop
I have the following html inside a ngForm:
<div class="form-group form-group-flex" *ngFor="let customerRole of customerRoles; let i = index">
<div class="role-name">
<label ...
0
votes
0
answers
36
views
Event on a text field Angular
that's my html code
...
4
votes
1
answer
3k
views
Why I can not limit an input's value length with Angular NgModel?
I have an input field with two way binding and I want to change the user input to uppercase and limit it to 3 characters. I'm doing this in the setter of the variable. The uppercase replacement works ...
1
vote
2
answers
3k
views
How to sum nested array field in table row in angular 6?
I am using Angular 6 and Html. I want to sum or total a nested array field and show in row.
I have a array list ('marksEntryList') with multiple student and also have a nested array list ('...
1
vote
2
answers
608
views
Angular - Uncaught Error: Cannot assign to a reference or variable
I have an Angular 8 app.
app.component.html
<div>
<label class="form-check-label f-14">
<input type="checkbox" class="form-check-input" name="isAgree" [(ngModel)]="...
0
votes
0
answers
2k
views
Add items to ngx-chips input model and only keep display and value fields
I'm using ngx-chips for a tag input control. I'm using my own custom objects as items to use in the control's dropdown; these have this structure:
_id: number;
name: string;
summary: string;
...
1
vote
2
answers
4k
views
Using [(ngModel)] 2 way data binding with ngFor , array doesn't update the values of the rows
I have built this form:
Here's the html code:
<table class="table table-hover table-bordered table-striped table-highlight">
<thead>
<tr>
<th *ngFor="let cell of ...
1
vote
1
answer
2k
views
How to implement ngModel (two way binding) for radio buttons when used as custom Component?
I have a custom Component for radio buttons using: NG_VALUE_ACCESSOR
I embed the radio-buttons in a parent component and try to pass the ngModel and required attribute to it, but It doesn't work.
...
0
votes
1
answer
158
views
Angular2: How to set [(ngModel)] based on which Model property has a value and what type of option object is chosen
I have a <select> tag with options that are of two different type of objects. I want the [(ngModel)] to be binded to the same Object but to different properties of that object. For example [(...
1
vote
4
answers
15k
views
Changing value bind to ng-model doesn't change the value on the input text
I have an input text box which use ngModel bind to a variable inside the component class. Upon clicking a button I want to clear the input text, however changing the variable value doesn't change the ...
0
votes
5
answers
1k
views
Form validation is not working in angular
I have a reactive form where the submit button should be disabled until aa inputs are filled
I have tried using ngmodel and ngForm parameters to disable the button but it is not enabled when the ...
0
votes
1
answer
479
views
Angular 7 - make #parameter="ngModel" input as a dynamic name
I there a way to create the "ngModel" parameter in template driven forms as a dynamic name (for ex. by loop)?
I wish to get something like:
<div *ngFor='let d of items; let i = index;'>
&...
2
votes
2
answers
1k
views
Binding model for multiple elements
I have a quite complex object which should be the model for a component.
It might look something like this:
{
"attribute1": "value1",
"attribute2": "value2",
"attribute3": "value3",
"...
-1
votes
1
answer
346
views
How to create element with dynamic name in ngModel?
How to create element with dynamic name in ngModel?
<div class="form-group" *ngFor="let setting of settings">
<label [for]="setting.name + '-' + setting.type">Setting</label>
...