I have created a controller using AngularJS and TypeScript within DotNetNuke 7. I am attempting to call my web API method using http.put but am encountering a 400 error status. Here is the code for my controller:
var customerapp = angular.module('CustomerSearch');
module CustomerSearch.controllers
{
export class CustomerCtrl {
static $inject = ['$scope', '$http', '$templateCache'];
debugger;
constructor(protected $scope: ICustomerScope,
protected $http: ng.IHttpService,
protected $templateCache: ng.ITemplateCacheService) {
$scope.search = this.search;
console.log(angular.element($scope).scope());
}
public search = (search: any) => {
debugger;
var Search = {
ActId: search.txtAct,
checkActiveOnly: search.checkActiveOnly,
checkParentsOnly: search.checkParentsOnly,
listCustomerType: search.listCustomerType
};
this.$scope.customer = [];
this.$scope.ticket = [];
this.$scope.services = [];
this.$http.put('<%=ResolveUrl("~/API/Search/PutDoSearch")%>', Search).
success((data, status, headers, config) => {
debugger;
this.$scope.cust_File = data[0].customers;
this.$scope.ticket_file = data[0].tickets;
this.$scope.service_file = data[0].services;
}).
error((data, status) => {
debugger;
console.log("Request Failed");
alert(status);
});
}
}
var customerapp = angular.module("CustomerSearch", []);
customerapp.controller('CustomerCtrl', CustomerSearch.controllers.CustomerCtrl);
}