所以我有一個PHP變種名爲$輸出,完成回聲json_encode($輸出)當PHP輸入類似以下打印:NG-INIT角度解析錯誤,包括JSON格式
[{
"title": null
}, {
"title": "a b c"
}, {
"title": "d e f"
}, {
"title": "d f g"
}, {
"title": "f g d"
}]
我相信這是正確的JSON
現在我使用的輸出,因爲它必須是在同一頁上所以我用下面的代碼加載通過NG-INIT結果:
> <table ng-init="values =<?php echo json_encode($output); ?>">
> <tr ng-repeat="value in values">
> <td>{{value}}</td>
> </tr> </table>
它如下提示錯誤:
Error: [$parse:ueoe] http://errors.angularjs.org/1.4.9/$parse/ueoe?p0=values%20%3D%5B%7B
<table ng-init="values =[{" title":null},{"title":"a="" b="" c"}]">
等它的一個大陣列與INT很多的話。使用ABC到位一部開拓創新詞的
你不能PHP代碼添加到'html',當您添加這裏面角指令(' ng-init'),它會給你分析錯誤。 [見此](https://stackoverflow.com/questions/11312316/how-do-i-add-php-code-file-to-html-html-files) – anoop
@anoop是我可以擴展它.phtml擴展名文件 –
您是否可以在.phtml的任何在線編輯器上重現您的錯誤\問題? – anoop