我嘗試NG-重複從返回PHP JSON result.But我有一些錯誤代碼=)Angularjs和PHP JSON/NG-INIT/NG重複
angular.min.js:117錯誤:[$ parse:ueoe] ** 對不起,我的英語。
JSON結果:
[{"id":"1","fullname":"Ad Soyad","email":"[email protected]","tel":"12332123","message":"Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.","time":"12/05/2016","picture":"assets/admin/layout3/img/avatar1.jpg","isread":"1"},
{"id":"2","fullname":"Mahmut Tuncer","email":"[email protected]","tel":"1233211","message":"Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.","time":"12/05/2016","picture":"assets/admin/layout3/img/avatar1.jpg","isread":"1"}]
a.php只會
$datacontactform = $sorgu = $dbquery->multisorgu('contactform');
<ul ng-init="contactlist = <?php echo $datacontactform; ?>">
<li ng-repeat="data in contactlist"> {{data.fullname}}</li>
</ul>
b.php
public function multisorgu($tablo,$where = null, $orderby = null, $limit = null){
// MYSQL JSON RESULT
global $Baglan;
$sorgu = mysqli_query($Baglan, "SELECT * FROM $tablo $where $orderby $limit");
$result = array();
if(mysqli_num_rows($sorgu) > 0){
while($bak = mysqli_fetch_assoc($sorgu)){
$result[] = $bak;
}
}
//UTF-8 JSON_UNESCAPED_UNICODE
$json_response = json_encode($result,JSON_UNESCAPED_UNICODE);
return $json_response;
}
你可以在'ng-init'變量中看到JSON數據? –
如果您嘗試打印contactList如下:'
' – Daniele