我想进入这个格式,需要在屏幕上显示的JSON数据:如何从angular JS中的获取请求的输入字段中获取数据?
{
"make": "Toyota",
"vin": "1234",
"model": "FJ",
"parts": [
{
"name": "wheel",
"desc": "makes it roll"
},
{
"name": "engine",
"desc": "really shiny"
},
{
"name": "Seats",
"desc": "leather seat covers"
}
]
}
如何输入字段中填入这些数据?
<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>
如何使用请求使其工作?
<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>
如何编写$ scope来填充屏幕?
尝试纳克模态= “myMessage.vin”。如果它不起作用,请使用你的代码。 – NNR
对零件使用ng-repeat –
http://jsfiddle.net/u4obssd3/104/ – NNR