From 0e2e04d1fe44535b3158d891a67d090ac42e9a83 Mon Sep 17 00:00:00 2001 From: mdmunir Date: Sun, 23 Aug 2015 14:53:09 +0700 Subject: [PATCH] litle fix --- generators/angular/default/views/js/create.js.php | 6 +++--- generators/angular/default/views/js/update.js.php | 6 +++--- generators/angular/default/views/main.php | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/generators/angular/default/views/js/create.js.php b/generators/angular/default/views/js/create.js.php index 3f2d902..e82fb55 100644 --- a/generators/angular/default/views/js/create.js.php +++ b/generators/angular/default/views/js/create.js.php @@ -32,9 +32,9 @@ },function(r){ $scope.errors = {status: r.status, text: r.statusText, data: {}}; if (r.status == 422) { - for (key in r.data) { - $scope.errors.data[r.data[key].field] = r.data[key].message; - } + angular.forEach(r.data,function(err) { + $scope.errors.data[err.field] = err.message; + }); } }); } diff --git a/generators/angular/default/views/js/update.js.php b/generators/angular/default/views/js/update.js.php index e3f78f0..3e42acd 100644 --- a/generators/angular/default/views/js/update.js.php +++ b/generators/angular/default/views/js/update.js.php @@ -36,9 +36,9 @@ },function(r){ $scope.errors = {status: r.status, text: r.statusText, data: {}}; if (r.status == 422) { - for (key in r.data) { - $scope.errors.data[r.data[key].field] = r.data[key].message; - } + angular.forEach(r.data,function(err) { + $scope.errors.data[err.field] = err.message; + }); } }); } diff --git a/generators/angular/default/views/main.php b/generators/angular/default/views/main.php index ecc1378..8cddc70 100644 --- a/generators/angular/default/views/main.php +++ b/generators/angular/default/views/main.php @@ -42,7 +42,7 @@ '/:id' => [ 'view' => 'view', 'js' => 'js/view.js', - 'di' => ['',], + 'injection' => ['',], ], ], 'resources' => [