Questions tagged [angular-ngmodelchange]

29 questions
500
votes
5 answers

(change) vs (ngModelChange) in angular

Angular 1 does not accept onchange() event, it's only accepts ng-change() event. Angular 2, on the other hand, accepts both (change) and (ngModelChange) events, which both seems to be doing the same thing. What's the difference? which one is best…
Ramesh Rajendran
  • 37,412
  • 45
  • 153
  • 234
5
votes
0 answers

How do I supress ngModelChange from firing when the component is being created (and therefore) populating my inputs with existing data?

The basic premise of the problem is as follows: I have a component with various (custom) inputs, when any of these input values change I do a HTTP call to an API endpoint to re-calculate what my audience reach is i.e. it's a Campaign system and as…
3
votes
2 answers

Angular: Search bar in TypeScript table

I have done a simple CRUD application, now I have to add a Search Bar that filters my table and show me the rows with the same letters that I digit. I don't know what to do in my component, I saw different things with pipes and filter but I couldn't…
S.A.R.A.
  • 165
  • 1
  • 2
  • 15
3
votes
3 answers

How does ngModelChange works without providing model name in ngModel directive

How does ngModelChange() works? (ngModelChange) is the @Output of ngModel directive. It fires when the model changes. You cannot use this event without ngModel directive but I am not sure, how does(ngModelChange) it works, if I am use…
Ramesh Rajendran
  • 37,412
  • 45
  • 153
  • 234
3
votes
1 answer

(ngModelChange) does not fire when I remove all values or paste values

The (ngModelChange) event does not fire when I clear all values from input field by using Ctrl.A or paste a value into it.
Ramesh Rajendran
  • 37,412
  • 45
  • 153
  • 234
2
votes
3 answers

Angular 8 number input min/max

I have an Angular 8 application. What I wanna do is not letting user to set any other value in number input, than from range of 0-100 I was thinking something like this
Tomas Lukac
  • 1,923
  • 2
  • 19
  • 37
2
votes
0 answers

ngModelChange not triggering when change in ngModel

I am trying to fire an event when input value changes. I am using ngModel with ngModelChanges. But its not working HTML
IamGrooot
  • 940
  • 1
  • 17
  • 44
2
votes
2 answers

Angular 4 - ngModelChange throw cannot read property '...' of undefined during two select form binding

I have the following json model and want to have two select form (dropdown) in which the first dropdown will contain the title while the second dropdown contain the authors with the value depending on the which title to pick (first title has two,…
OreoFanatics
  • 818
  • 4
  • 15
  • 32
2
votes
1 answer
2
votes
2 answers

Why ngModelChange event triggering whenever focus in and out on the input box?

sample.html componenent.ts clearFilter(value) { alert(value);// values is…
Ramesh Rajendran
  • 37,412
  • 45
  • 153
  • 234
1
vote
2 answers

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 { @Input() ngModel: unknown = null; @Input()…
karlitos
  • 1,604
  • 3
  • 27
  • 59
1
vote
1 answer

Angular 2 - ControlValueAccessor - (ngModelChange) not triggered

[edit: this code is actually working, so it may serve as a simple example on how to implement ControlValueAccessor for beginners] I made a custom component, of the simplest form, a simple dif, that changes its internal state when clicking on…
1
vote
1 answer

how to assign the value returned from function call to a variable inside html in angular 2

Here in (ngModelChange) I want to assign the value returned from…
1
vote
1 answer

Set undefined value using *ngIf and ngModelChange

I am using (ngModelChange) with several attribute but one of its attribute can be null for some entry. For now the only solution I have found is to duplicate the input with *ngIf condition to check if attribute is not null.
C. Banzet
  • 409
  • 2
  • 5
  • 19
1
vote
1 answer

Angular How to trigger change event of checkbox after model value change?

I want to trigger change event of checkbox two on checking on checkbox one. So far after second one is checked when first one is checked. But I couldn't get second one to fire its change event Here's my code This is my template code
1
2