What am I doing wrong? I have read a million articles and can't get it
right
*My Service: *
var app = angular.module('app', ['ngRoute', 'ngAnimate', 'route-segment',
'view-segment']).config(['$httpProvider', function ($httpProvider) {
$httpProvider.defaults.useXDomain = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];
}
]);
var ClaimService = app.factory('ClaimService', function ($http) {
return {
getCoordinators: function () {
//since $http.get returns a promise,
//and promise.then() also returns a promise
//that resolves to whatever value is returned in it's
//callback argument, we can return that.
return
$http.get('http://localhost:60593/api/claims/api/claims/Coordinators', {
headers: {
'Access-Control-Allow-Origin': 'http://localhost:65518/',
'Access-Control-Allow-Methods': ['GET', 'POST', 'OPTIONS', 'PUT',
'DELETE'],
'Access-Control-Allow-Headers': 'Content-Type',
'Access-Control-Allow-Credendtials': 'true',
'Content-Type': 'application/json; charset=UTF-8'
}
}).then(function (result) {
return result.data;
});
}
}
});
*MyController: *
var NewCtrl = app.controller('NewCtrl', ['$scope', '$routeSegment',
'ClaimService', function ($scope, $routeSegment, ClaimService) {
$scope.coordinatorList = ClaimService.getCoordinators();
}]);
*WebApi config:*
<handlers> <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" /> <remove
name="ExtensionlessUrlHandler-Integrated-4.0" /> <add
name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*."
verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule"
scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll"
preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0"
/> <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*."
verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule"
scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll"
preCondition="classicMode,runtimeVersionv4.0,bitness64"
responseBufferLimit="0" /> <add
name="ExtensionlessUrlHandler-Integrated-4.0" path="*."
verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS"
type="System.Web.Handlers.TransferRequestHandler"
preCondition="integratedMode,runtimeVersionv4.0" /> <remove
name="UrlRoutingHandler"/> </handlers>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.