I would like to get JSON data in this format which needs to be displayed on the screen:
{
"make": "Toyota",
"vin": "1234",
"model": "FJ",
"parts": [
{
"name": "wheel",
"desc": "makes it roll"
},
{
"name": "engine",
"desc": "really shiny"
},
{
"name": "Seats",
"desc": "leather seat covers"
}
]
}
How do I populate this data in an input field?
<form>
<div class="form-group">
<label>Make</label>
<input type="text" class="form-control" id="makeid" ng-modal="make">
</div>
<div class="form-group">
<label>Vin</label>
<input type="text" class="form-control" id="vinid" ng-modal="vin">
</div>
<div class="form-group">
<label>Modal</label>
<input type="text" class="form-control" id="modalid" ng-modal="modal">
</div>
<div class="form-group">
<label>Parts</label>
<input type="text" class="form-control" id="partsid" ng-modal="part">
</div>
</form>
How do I make it work using a request?
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $http) {
$http.get("http://192.16.1:8080/restproj/v1/dealer/1234/car")
.then(function(response) {
$scope.myMessage = response.data;
});
});
</script>
How do I write the $scope to populate the screen?