Thanks Dan,
I did as you suggested and uploaded the code to Git if you maybe find the time
to check it out:
This is what I did in js/app.js in Angular for tests: - everything works fine -
even authorization - �as long as I do no http://... calls, as you can see. Any
idea?
// working: www json test
function Hello($scope, $http) {
$http({
method: "GET",
url: 'http://rest-service.guides.spring.io/greeting'
}).
� � success(function(data) {
� � $scope.greeting = data;
� � });
};
�
�
// working: I have saved http://localhost:8080/restful/services to
services.json file
function ISISfile($scope, $http) {
$http({
method: "GET",
url: 'services.json'
}).
� � success(function(isisdata) {
� � � � $scope.isisdata = isisdata;
� � });
};
�
//working; relative call without http://localhost\:8080
function ISISrel($scope, $http) {
$http({
method: "GET",
url: '/restful/services',
headers: {'Authorization': 'Basic c3ZlbjpwYXNz'}
}).
� � success(function(isisdata) {
� � � � $scope.isisdata = isisdata;
� � });
};
�
//working; so authorization is not the problem
function ISISrelnoauth($scope, $http) {
$http({
method: "GET",
url: '/restful/services'
}).
� � success(function(isisdata) {
� � � � $scope.isisdata = isisdata;
� � });
};
�
// NOT working
// I tried 'http://localhost:8080/restful/services and
// http://localhost\:8080/restful/services and
// http://mmyco.co.uk:8180/isis-onlinedemo/restful/services and
// http://mmyco.co.uk\:8180/isis-onlinedemo/restful/services and
function ISISwww($scope, $http) {
$http({
method: "GET",
url: 'http://mmyco.co.uk\:8180/isis-onlinedemo/restful/services',
headers: {'Authorization': 'Basic c3ZlbjpwYXNz'}
}).
� � success(function(isisdata) {
� � � � $scope.isisdata = isisdata;
� � });
};
On 12 August 2014 22:35, wrote:
>
>
> - Thank you. Still no response: though I checked and made sure no
> authorization is required now.
>
> Could it be a CORS kind of thing?
>
> I am running the ISIS app on localhost:8080 and angular on localhost:8888
> ...
>
> Any idea?
>
>
Yep, CORS.
My recommendation would be to have Isis also serve up AngularJS... just put
those files under src/main/webapp.
If you don't want to do that, then I know it's possible to run Chrome with
CORS disabled, see eg [1]
Or, you could spend the time enabling CORS. I did start (last Xmas, and
then ran out of time) building an AngularJS app myself against Isis, and
there's a repo on github. In it there is (somewhat redundantly I now
suspect) a CORS filter; you can grab it here [2]
Dan
[1]
http://stackoverflow.com/questions/3102819/disable-same-origin-policy-in-chrome
[2]
https://github.com/danhaywood/zzz-playtime-isis-todoapp-angularjs/blob/master/webapp/src/main/java/org/eclipse/jetty/servlets/CrossOriginFilter.java
�