user123 user123 - 2 months ago 6
AngularJS Question

Get the edited value in AngularJS

I have data in JSON format, like this:

"details": {
"col1": "value1",
"col2": "value2",
"col3": "value3",
"col4": "value4",
"col5": "value5",
"col6": "value6",
"col7": "value7",
"col8": "value8"
}

<div ng-repeat="(key,value) in details">
<div>{{key}}:</div>
<input value="value">{{value}} </input>


If I edit the value filed, how can get edited value in controller?

Answer

Use the $scope variable and bind to ng-model

<input type="text" ng-model="value" ng-blur="print(value)" size="30">

WORKING DEMO

Comments