Angular 2's ngModel directive used for two-way databinding
Questions tagged [angular2-ngmodel]
209 questions
5
votes
4 answers
How to set default selected values in multiselect with ngModel in Angular 2
How to set default selected values in multiselect. I get current_options and all_options from database and I want to update current_options and send new values do database again.
Updating database works but when I refresh page none of options are…

pelcomppl
- 575
- 2
- 6
- 16
5
votes
1 answer
Passing object in ngModel to a custom control Angular2
I want to create custom control which contains other custom controls and use ngModel that connects all of them.
Like :
PersonSearchComponent :
DeveloperSearchControl
Name - some string input
Surname
ProffesionSelect - custom control expecting…

Mopa
- 521
- 1
- 6
- 13
5
votes
3 answers
select list set selected item angular 2 ngModel
This is my current code:
I'm loading all the roles in an…

JDOE
- 67
- 2
- 5
5
votes
1 answer
Angular 2 ngModel Not Binding Object Property Defined In Class Definition
I am new to angular 2, I tried [(ngModel)] as shown below.
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `
{{model.name}}
` }) export class AppComponent…
Yuvaraj V
- 1,020
- 2
- 16
- 28
4
votes
1 answer
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": [
{
"pk": "12345",
"title": "Selector",
"type": "SEL",
…

s_spirit
- 111
- 10
4
votes
1 answer
ControlValueAccessor ngModel not being updated
This is simple custom form control
@Component({
selector: 'app-custom-control',
template: `
{{ value }}
`,
providers: [{
provide: NG_VALUE_ACCESSOR,
useExisting:…
user7003407
4
votes
1 answer
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 if I try to do a substring it does not update the…

Milhooz
- 43
- 1
- 5
4
votes
2 answers
Angular 2 + how to select and loop over multiple elements with the same selector (elementRef.nativeElement)
In my component I am trying to unselect all checkboxes with the same class name.
querySelector selects only the first one each time (or once)... and querySelectorAll does not select anything.
this is the function. I know its wrong to use jQuery like…

Omar
- 2,726
- 2
- 32
- 65
4
votes
2 answers
select ngmodel not binding the variable
I have a very simple page with two selects filled in with same data (bank accounts). One is aimed to be source and another target in order to create a transaction. In this simple scenario a transaction is just an amount transfered from one account…

Jim C
- 3,957
- 25
- 85
- 162
4
votes
1 answer
Angular2: how to chain ngModel with two-way bound variable of other component?
I have a main-component which passes a variable to another component sub-component via custom two-way binding. The passed variable is used for an input tag via ngModel.
These two variables are currently not in sync. How can I chain those two…

Pratik
- 695
- 2
- 11
- 29
4
votes
5 answers
How to force ngModel update when value did not change?
I want to limit number input to 0-100 range, but on input, not during validation. I'm using ngModel to bind value and emitt change event:
And then check if value exceeds given…

K. Kowalczyk
- 967
- 13
- 34
4
votes
2 answers
Angular2 table model binding with text input
I have a PrimeNG table which cells are editable. When I edit the value of the input text field the table model does not change. How do I make the table model bind to the input text?
Here is my code:
…

myanmar
- 81
- 1
- 2
- 11
4
votes
1 answer
How to give correct path names for loadchildren in lazy loading angular 2 NgModule?
How to give correct path names for loadchildren in app-routing.module file in the angular 2 ngmodule, I followed the ngmodule concept in angular main website
but its not giving such informations. I am getting the issue with app-routing.module…

Sathish Kotha
- 1,081
- 3
- 17
- 30