我正在從laravel 5.2形式請求驗證JSON輸出追加鍵值對angularjs對象
我的JSON輸出是:
{
"title": [
"The title field is required."
],
"description": [
"The description field is required."
],
"address.city": [
"City field is required"
]
}
追加此輸出到對象
var self = this;
self.error = {
address: {}
};
var onFailure = function (response) {
angular.forEach(response.data, function(value, key) {
self.error[key] = value[0];
});
};
我想要訪問這個錯誤對象到我的視圖,對於「address.city」,我不能訪問它使用「ctrl.error.address.city」,其餘我可以訪問
如何使用包含「。」的鍵追加對象。並在視圖中顯示?