-2
我在控制檯下面的錯誤解析錯誤,AngularJS
"Error: [$parse:syntax] http://errors.angularjs.org/1.4.12/$parse/syntax?p0=Detail&p1=is%20an%20unexpected%20token&p2=11&p3=carrental%09Detail.hostDescription&p4=Detail.hostDescription
這意味着
Error: $parse:syntax
Syntax Error
Syntax Error: Token 'Detail' is an unexpected token at column 11 of the expression [carrentalDetail.hostDescription] starting at [Detail.hostDescription].
但在我在MySQL數據庫中檢索數據的PHP
$carrentalhost = $this->master_model->getRecords('carrentalhost', ['carrentalId' => $carrentalId])[0];
if(!empty($carrentalhost['hostImage'])){
$hostImage= base_url() . 'resources/carrentals/carrentalhost/' . $carrentalhost['hostImage'];
} else {
$hostImage=null;
}
$categoryId = $this->master_model->getRecords('module_category', ['module_id' => 8], 'id')[0];
$mobileNumber = $carrentalhost['hostMobile'];
$resultArray = [
'hostName' => $carrentalhost['hostName'],
'hostEmail' => $carrentalhost['hostEmail'],
'hostDescription' => $carrentalhost['hostDescription'],
'price' => $carrentalhost['price'],
'selectedDates' => $carrentalhost['availableDates']
];
if (!empty($resultArray)) {
$responseArray = array(
'result' => $resultArray,
'success' => true);
return $this->set_response($responseArray, REST_Controller::HTTP_OK);
}
我在檢查我的PHP代碼,我可以從數據庫中檢索正確的數據。
在我AngularJS側,
var loadCarrentalDetails = function() {
var query = {};
var loadCarrentalDetailsReq = CarrentalResource.loadCarrentalDetails(query);
loadCarrentalDetailsReq.success(function (loadCarrentalDetailsRes) {
$scope.carrentalDetail = loadCarrentalDetailsRes.result;
});
loadCarrentalDetailsReq.error(function() {
});
}
loadCarrentalDetails();
出了什麼問題?
請告訴我們的HTML。 – 31piy
是的,我的html代碼有問題。 – batuman