Questions tagged [ngmodel]

Use ngmodel for questions related to the ng-model AngularJS directive.

The ngmodel directive is used for two-way data binding of form controls. It has a built-in controller named NgModelController which exposes and API which can be used for handling state changes and performing validation.

References

386 questions
26
votes
19 answers

Uncaught (in promise): Error: Export of name 'ngForm' not found

I am trying to use ngModel to do data binding, however, I get an error ngForm not found. I have already included formsmodule in app.module.ts as you can see below. The error disappears when i remove #grantAccessForm= "ngForm" but when i do this and…
Ashim
  • 877
  • 2
  • 12
  • 22
23
votes
9 answers

ngModel not working in Angular4

I am learning Angular 4 from the official site and I came to the part with 2-way data binding through ngModel. However, my app stops working as soon as I add [(ngModel)] to my component template, even though the FormsModule is imported in the…
Mavil
  • 282
  • 1
  • 2
  • 9
21
votes
5 answers

Angular 2 - [(ngModel)] not updating after [value] changes

I'm setting the the value of an input calculating two other ngModels, and that seems to be working fine. But if I inspect my ngModel, it doesn't change at all. Let me show you: Total price:…
Agustín
  • 1,546
  • 7
  • 22
  • 41
21
votes
1 answer

Angular2 Quickstart Tutorial Breaking Karma Tests - "Can't bind to 'ngModel' since it isn't a known property of 'input'."

I am following the official Angular "Hero" Quickstart Tutorial whilst trying to TDD it. https://angular.io/docs/ts/latest/tutorial/toh-pt1.html As soon as I get to the step to replace: with
Kirsty Purcell
  • 313
  • 1
  • 2
  • 5
15
votes
5 answers

Angular 5 how to get file name from input with type = file

I know there are simmilar questions but none cover the method for Angular 5 or at least not in a way that I understand it. For my image upload system I need to know if a picture is attached to the input tag and what name the file has. Here is my…
Miger
  • 1,175
  • 1
  • 12
  • 33
15
votes
5 answers

Angular 4, How to update [(ngModel)] with a delay of 1 seconds

Since ngModel is updating instantly how to put a delay. I need to save the task_name with a delay of…
user1879901
14
votes
3 answers

Setting ngModel default value angular 2

Have a problem with ngModel in angular 2. Have a task to output a couple of inputs from an array in component class. Discovered a possibility to make ngModel take its value from [name] attribute without embracing ngModel in [()]. And I wonder if…
Mike Kovetsky
  • 1,638
  • 1
  • 14
  • 24
12
votes
1 answer

How properly bind an array with ngModel in angular 4?

Let's suppose I have an array [1,2,3]. I want to iterate all items and bind each to ngModel. When I run this code after changing the first element, the second one is getting the same value. What's the problem?
12
votes
3 answers

Angular2 keyup event update ngModel cursor position jumps to end

I am having an issue with an Angular2 directive that should do the following: Detect if the user enters '.' character. If the next char is also '.', remove the duplicate '.' and move the cursor position to after the '.' char I have the above…
conor
  • 883
  • 5
  • 14
  • 25
10
votes
3 answers

Angular4 ngModel changes type of data from 'number' to 'string'

I have an Angular4 app that captures data from a form and stores in DynamoDB. It uses ngModel to support two-way data binding and on the display all looks good. Issue comes into play because of an input field typed as 'text' bound to Typescript…
dmiller
  • 101
  • 1
  • 4
9
votes
3 answers

Angular - How to make input field formated in percent but with percent removed when editing it?

I'm trying to find a way to have a html input field displayed in percent (e.g. 97,52 %) upon initial page load (data fetched via a angular service to a backend, i.e. observable/subscribe), but also have this input field loose it's percent formating…
tom
  • 111
  • 1
  • 1
  • 6
9
votes
2 answers

Binding ngModel to Dynamic Checkbox List : Angular 2 / Typescript

I'm not sure the proper way to bind and update a model where the checkboxes are dynamically generated. (This is a ASP.NET Core project with Angular 2 initially created using the Yeoman generator) Or a simple checkbox for that matter I have just…
EHeine
  • 385
  • 1
  • 3
  • 13
8
votes
7 answers

Error: Export of name 'ngModel' not found

After building my angular project i get the error: Error: Export of name 'ngModel' not found! I have my UI running in a docker container not even sure where to look for this. Its working fine in dev. (ng serve) Any ideas
izeko
  • 165
  • 1
  • 1
  • 6
7
votes
0 answers

number formatting in ngModel

Hi! Is there any simple way to format a number in this case? now it displays 1000 for example. the goal is to display 1 000.00 i know pipes are not allowed in ngModel so {{valami.Price |…
toxikus
  • 71
  • 1
  • 2
6
votes
2 answers

Typescript - Bind ngModel to property of object

I have an object called user: let user = {}; How can I bind an input to a undefined property? E.g. And whenever the user enters his name, I want the ngModel to create the…
EDJ
  • 843
  • 3
  • 17
  • 37
1
2 3
25 26