Questions tagged [angularjs-ng-model]

The ngModel directive in AngularJS binds an input, select, textarea (or custom form control) to a property on the scope using NgModelController, which is created and exposed by this directive.

ngModel is responsible for:

  • Instantiating the ngModelController
  • Binding the view into the model, which other directives such as input, textarea or select require.
  • Providing validation behavior (i.e. required, number, email, url).
  • Keeping the state of the control (valid/invalid, dirty/pristine, touched/untouched, validation errors).
  • Setting related CSS classes on the element (ng-valid, ng-invalid, ng-dirty, ng-pristine, ng-touched, ng-untouched) including animations.
  • Registering the control with its parent form.
  • Formatters, Parsers and View change listeners

Information from AngularJS API

See also

532 questions
3
votes
1 answer

Angular 6 Using Two Shared Module : Component is not a known element:

I have two shared Moduled 'shared-candidate-login-reg.module.ts' and 'shared.module.ts', I am importing both the shared modules in my home page. I want to use 'AlertLblComponent' from my 'shared.module.ts' in side my 'WidgetLogRegComponent'…
amit gupta
  • 1,282
  • 2
  • 20
  • 36
3
votes
2 answers

How to set ng-model variable from custom validation directive

How to call controller scope from angularjs directive outside link function $scope is unknown provider here: app.directive('checkId', function($parse,$scope, $http){//here $scope is unknown provider return{ restrict:'A', link:…
3
votes
2 answers

Angularjs, select Box create blank option at first always

I got some problems with selectbox. In my original code, I receive an object through $http calling, and that is like below. [ {key:'user_id', value:'ID'}, {key:'user_name', value:'Name'}, {key:'user_gender', value:'Gender'}, …
3
votes
1 answer

How to update ng-model based on selected object in angularjs?

I have a slider, something like this: Two texts are added to canvas. This is…
funguy
  • 2,072
  • 7
  • 30
  • 41
3
votes
3 answers

Angularjs: How to get value of input without ng-model

I need to make some inputs by ng-repeat, and in my json file I have in object where is a property called name, like this: "url":"find_company", "values":[ { "name":"company name", "type":"input_search" },{ …
kliukovking
  • 569
  • 1
  • 5
  • 16
3
votes
2 answers

ng-model - Empty input returns null

I have this input: When I changed the input (for example to 1) and then delete it the data.value holds null. I want that when I delete the input data.value will hold 0 as a…
Sagie
  • 996
  • 3
  • 12
  • 25
3
votes
1 answer

Expression in ng-model AngularJS

I need to execute an expression inside ng-model. I have an array of integers which is shown in a list and input fields needs be generated on click of each item. All input fields should carry a generated value of ratio having base as 1. I also need…
Joseph
  • 1,060
  • 3
  • 22
  • 53
3
votes
2 answers

How to use ng-model with checkbox value?

I want to this : Summary Row should be checked/unchecked for datetime and object at once as well as separately. my display like photo : I use ng-model. my checkbox code as the following :
eagle
  • 451
  • 1
  • 7
  • 27
3
votes
1 answer

how can I access ngModel from directive controller

function prMySelects() { var ddo = { restrict: 'E', templateUrl: 'template.html', require: '?ngModel', scope: { ngModel: '=' }, controller: prMySelectsController, controllerAs: 'vm', bindToController: true …
3
votes
1 answer

ng-model not working with radio buttons in angular

I have a simple form with radio buttons that pulls values from a server and loops through them to provide radio buttons:
3
votes
1 answer

Model isn't updating when selected option changes

My Angular.js project features a select element bound to a model. On load the appropriate option is selected however selecting another option doesn't seem to update the model, at least not permanently. If I change the model programmatically however…
3
votes
2 answers

How do I retrieve a value from an object using users' inputs? (Angularjs)

I'm trying to calculate a rate automatically when a user gives the inputs. A user can select one of the 3 items in the "types" list, and it should input the result of multiplying the multiplier (input), and the chosen object. I tried a bunch of…
3
votes
1 answer

Angularjs disabling drop down

I have a ui in which based on the selection of one drop down another dropdown should be disabled. Both these dropdowns are generated using ng-repeat . Below is the code sample