如何在网址中使用id的值?
$scope.modify = function (id) {
$http({
method: "POST",
url: prefixSeverUrl + "/" + "vehicles/id",
dataType: "json",
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
data: $scope.modifyvehicle,
})
答案 0 :(得分:4)
连接字符串,如下所示:
url: prefixSeverUrl + "/" + "vehicles/" + id,
使用JavaScript template literals,您可以使用以下语法:
url: `${prefixSeverUrl}/vehicles/${id}`