前台对应的三个输入项目,声音故障类型,屏幕故障数量,屏幕故障类型,要怎么用ng-model.
控制器端用$http.post方法传入后台,大致如下:
$scope.data = { lineNo: $scope.lineNo, trainNo: $scope.trainNo, "audio": { fault:$scope.fault,
}, "screen ":{ fault:$scope.fault, screenNum :$scope.screenNum,
}
}
$scope.insertClick = function () {
$http({
url: 'http://yiwuyahei.com/api/v1/issues',
method: 'post',
headers: {'Authorization': 'Bearer ' + data.token},
data: $scope.data,
})
.success(function (data, status, headers, config) { })
.error(function (data, status, headers, config) { });
}
请问这样写,可以吗?或者有什么更好的写法,新手刚开始学,求大牛指导!!