Return-Path: X-Original-To: apmail-struts-commits-archive@minotaur.apache.org Delivered-To: apmail-struts-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AA7C918322 for ; Fri, 10 Jul 2015 15:36:52 +0000 (UTC) Received: (qmail 3304 invoked by uid 500); 10 Jul 2015 15:36:50 -0000 Delivered-To: apmail-struts-commits-archive@struts.apache.org Received: (qmail 3232 invoked by uid 500); 10 Jul 2015 15:36:50 -0000 Mailing-List: contact commits-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list commits@struts.apache.org Received: (qmail 2226 invoked by uid 99); 10 Jul 2015 15:36:49 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Jul 2015 15:36:49 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5C646E685D; Fri, 10 Jul 2015 15:36:49 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jogep@apache.org To: commits@struts.apache.org Date: Fri, 10 Jul 2015 15:37:17 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [30/30] struts git commit: WW-4522 Support latest stable AngularJS version in maven angularjs archetype WW-4522 Support latest stable AngularJS version in maven angularjs archetype - Refactor the DataService to only expose the callable members Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/d0a25d68 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/d0a25d68 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/d0a25d68 Branch: refs/heads/master Commit: d0a25d688aedee99d31f06e94fc4fac6fad4227c Parents: 55e10bc Author: Johannes Geppert Authored: Fri Jul 10 17:37:10 2015 +0200 Committer: Johannes Geppert Committed: Fri Jul 10 17:37:10 2015 +0200 ---------------------------------------------------------------------- .../src/main/webapp/js/services/DataService.js | 28 +++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/d0a25d68/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services/DataService.js ---------------------------------------------------------------------- diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services/DataService.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services/DataService.js index d2612a4..3f9e308 100644 --- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services/DataService.js +++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services/DataService.js @@ -27,13 +27,26 @@ function DataService($http, $log, $q) { + /** Object to manage all backend URL's */ + var urls = { + projects : "data/projects" + }; + + /** The DataService with all public methods */ var DataService = { - urls : { - projects : "data/projects" - } + getProjects: getProjects }; - DataService._request = function(url, method, model){ + return DataService; + + /** Get all projects */ + function getProjects() { + return _request(urls.projects); + } + + + /** A generic helper method to execute a HTTP request to the backend */ + function _request(url, method, model){ if(!method) { method = 'GET'; } @@ -55,13 +68,8 @@ }); } return def.promise; - }; + } - DataService.getProjects = function () { - return this._request(this.urls.projects); - }; - - return DataService; } })(); \ No newline at end of file