You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by jo...@apache.org on 2015/05/06 20:49:48 UTC
[1/2] struts git commit: Remove unused dependency from
ApacheProjectsController
Repository: struts
Updated Branches:
refs/heads/develop ea098ba08 -> 01279636d
Remove unused dependency from ApacheProjectsController
Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/aa1e50f4
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/aa1e50f4
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/aa1e50f4
Branch: refs/heads/develop
Commit: aa1e50f4124f5861a2ea9a4014c897bf29a59d1b
Parents: ea098ba
Author: Johannes Geppert <jo...@gmail.com>
Authored: Wed May 6 20:34:35 2015 +0200
Committer: Johannes Geppert <jo...@gmail.com>
Committed: Wed May 6 20:34:35 2015 +0200
----------------------------------------------------------------------
.../archetype-resources/src/main/webapp/js/controllers.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/struts/blob/aa1e50f4/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js
----------------------------------------------------------------------
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js
index ed57b00..f0d72f1 100644
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js
@@ -24,7 +24,7 @@ angularStrutsApp.controller('HomeController', function ($scope) {
$scope.name = "Sunshine";
});
-angularStrutsApp.controller('ApacheProjectsController', function ($scope, $http, DataService) {
+angularStrutsApp.controller('ApacheProjectsController', function ($scope, DataService) {
this.init = function() {
DataService.getProjects().then(function(data) {
$scope.projects = data.data.projectNames;
[2/2] struts git commit: Correct usage of promises and improve
logging in data service
Posted by jo...@apache.org.
Correct usage of promises and improve logging in data service
Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/01279636
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/01279636
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/01279636
Branch: refs/heads/develop
Commit: 01279636d9160508dc94151e19e47a74ddf319aa
Parents: aa1e50f
Author: Johannes Geppert <jo...@gmail.com>
Authored: Wed May 6 20:49:29 2015 +0200
Committer: Johannes Geppert <jo...@gmail.com>
Committed: Wed May 6 20:49:29 2015 +0200
----------------------------------------------------------------------
.../src/main/webapp/js/controllers.js | 8 ++++----
.../src/main/webapp/js/services.js | 15 ++++++++-------
2 files changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/struts/blob/01279636/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js
----------------------------------------------------------------------
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js
index f0d72f1..07f12d7 100644
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js
@@ -24,12 +24,12 @@ angularStrutsApp.controller('HomeController', function ($scope) {
$scope.name = "Sunshine";
});
-angularStrutsApp.controller('ApacheProjectsController', function ($scope, DataService) {
+angularStrutsApp.controller('ApacheProjectsController', function ($scope, $log, DataService) {
this.init = function() {
DataService.getProjects().then(function(data) {
- $scope.projects = data.data.projectNames;
- }, function(data) {
- console.log('Could not receive project names.')
+ $scope.projects = data.projectNames;
+ }, function() {
+ $log.error('Could not receive project names.')
});
};
http://git-wip-us.apache.org/repos/asf/struts/blob/01279636/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services.js
----------------------------------------------------------------------
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services.js
index e3be1de..10ec867 100644
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services.js
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services.js
@@ -18,7 +18,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-angularStrutsApp.factory('DataService', ['$http', '$q', function($http, $q) {
+angularStrutsApp.factory('DataService', ['$http', '$log', '$q', function($http, $log, $q) {
var DataService = {
urls : {
@@ -32,18 +32,19 @@ angularStrutsApp.factory('DataService', ['$http', '$q', function($http, $q) {
}
var def = $q.defer();
if(method === 'GET') {
- return $http.get(url).success(function(data) {
- DataService.data = data;
+ $http.get(url).success(function(data) {
def.resolve(data);
- }).error(function() {
- def.reject("Failed to get data");
+ }).error(function(data, code) {
+ def.reject(data);
+ $log.error(data, code);
});
} else if(method === 'POST'){
$http.post(url, model).success(function(data) {
DataService.data = data;
def.resolve(data);
- }).error(function() {
- def.reject("Failed to post data");
+ }).error(function(data, code) {
+ def.reject(data);
+ $log.error(data, code);
});
}
return def.promise;