Questions tagged [angularjs-ng-value]

Binds the given expression to the value of

ngValue is useful when dynamically generating lists of radio buttons using ngRepeat, as shown below.

Likewise, ngValue can be used to generate <option> elements for the select element. In that case however, only strings are supported for the valueattribute, so the resulting ngModel will always be a string. Support for select models with non-string values is available via ngOptions.

ngValue docs

34 questions
44
votes
5 answers

What's the difference/incompatibility between ng-model and ng-value?

As far as i understood ng-model sets the value for that particular element in which the model is been assigned. given that how is ng-value different from ng-model?
7
votes
1 answer

Default value of input textbox in AngularJS

How do I set the default value of an input textbox in AngularJS so that it can be altered later? I wish to be able to submit the changed value of the textbox(using ng-model) to the server. Would using ng-value to set the initial value of the textbox…
6
votes
3 answers

Angular2 selected option with objects

I have an Angular 2 app that is dealing with customers and a spring rest back end. The customer object has a customer type, which is also an object, and I have the drop down on the customer form working so that objects are stored as the value,…
Drew
  • 464
  • 1
  • 5
  • 18
3
votes
1 answer

Angularjs: when use ng-value, value = 0?

I got one weird error. When I use ng-value, the page render a 'value=0' for some options. The console doesn't show errors. Here is the code: Here is the result:
zif
  • 51
  • 6
1
vote
1 answer

ng-model not working for angular radio buttons with JSON object as values

I have a simple filter where I want to select a particular value and type and make other calls using that. Here is a close representation of what I have in my view (I am not using ng-repeat to create these radio buttons).
1
vote
3 answers

how to use ng-init with ng-repeat

I am creating a web app in which i am using dropdown and angularjs for updating my database, this is my syntax of my dropdownlist
I want to take a numerical value from $scope and…
0
votes
1 answer

Can't make select work properly with ngmodel

I have a "lookup" select which needs to work as a "passive" control: highlight the selected option and as an "active" control: let user select the option and initiate some action (load corresponding entity's details). I tried a lot and can't make it…
Alexander
  • 1,152
  • 1
  • 16
  • 18
0
votes
0 answers

Problem setting value in field ngValue form Angular

I have the follow code: .json 0: {stateId: 1, name: "Acre", uf: "AC", countryId: 1, country: {…}} 1: {stateId: 2, name: "Alagoas", uf: "AL", countryId: 1, country: {…}} 2: {stateId: 3, name: "Amazonas", uf: "AM", countryId: 1, country: {…}} 3:…
0
votes
2 answers

AngularJS ng-value and ng-model do not work together

I was trying to give a value to textfield using ngvalue and textarea has that value but it when I submit it, it recognized as textarea is empty.