AngularJS Tutorial - Load object value from scope








The following code shows how to load object value from scope.

Example


<!DOCTYPE html>
<html  ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
</head><!--from   w  w  w . j a  va  2s.  c om-->
<body>
<div ng:app="myApp">
    <ul ng-controller="myController">
      <li ng-repeat="(property, value) in obj">
        <input ng-model="obj[property]"/><span>{{value}}</span>
      </li>
    </ul>
</div>
<script type='text/javascript'>
var myApp = angular.module('myApp', []);
function myController($scope){
  $scope.obj = {
    label: "Enter Text",
    type: "text"
  }
}
</script>
</body>
</html>

The code above is rendered as follows: