Skip to content

Commit

Permalink
fixed dummy controller/factory call
Browse files Browse the repository at this point in the history
  • Loading branch information
draptik committed Sep 30, 2013
1 parent 162ab36 commit 8007cfa
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ public void doFilter(ServletRequest servletRequest, ServletResponse servletRespo
}

private void addHeadersFor200Response(HttpServletResponse response) {
response.addHeader("Access-Control-Allow-Origin", "*");
response.addHeader("Access-Control-Allow-Methods", "Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With");
response.addHeader("Access-Control-Allow-Headers", "GET, PUT, OPTIONS, X-XSRF-TOKEN");
// response.addHeader("Access-Control-Allow-Origin", "*");
// response.addHeader("Access-Control-Allow-Methods", "*, Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With");
// response.addHeader("Access-Control-Allow-Headers", "*, GET, PUT, OPTIONS, X-XSRF-TOKEN");
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With, Accept, Accept-Version");
response.setHeader("Access-Control-Allow-Headers", "GET, PUT, OPTIONS, X-XSRF-TOKEN");

}
}
9 changes: 7 additions & 2 deletions frontend/app/scripts/controllers/dummy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
'use strict';

angular.module('ngdemoApp.dummyCtrl', [])
.controller('DummyCtrl', function ($scope, dummyFactory) {
.controller('DummyCtrl', function ($scope, $log, dummyFactory) {
$log.log('DummyCtrl loaded...');

$scope.bla = 'bla from controller';
$scope.foo = dummyFactory.firstName;

dummyFactory.query({}, function (data) {
$scope.foo = data.firstName;
});
});
3 changes: 2 additions & 1 deletion frontend/app/scripts/services/dummyFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

var srv = angular.module('ngdemoApp.factory', ['ngResource']);

srv.factory('dummyFactory', function ($resource) {
srv.factory('dummyFactory', function ($resource, $log) {
$log.log('dummyFactory loaded...');
return $resource('http://localhost\\:8080/ngdemo/web/dummy', {}, {
query: { method: 'GET', params: {} }
});
Expand Down

0 comments on commit 8007cfa

Please sign in to comment.