I am new to Angular JS. I have a MVC Area called "Setup". Under this area there is a Controller called ModuleMstController.
The above controller has an Action method GridData.
From my Angular controller i make a post with a url /Setup/ModuleMst/GridData
but firebug shows the request url as
http://localhost/ModuleMst/GridData
and my action method is not hit.
I then tried to configure routing as
var ap = angular.module('myApp', ['trNgGrid', 'ngRoute']);
//controller 1
ap.controller("MainCtrl", function ($scope, $http) {
$scope.model = {};
......
....
$scope.isAjaxInProgress = true;
$scope.errorMessage = undefined;
$http.post("/ModuleMst/GridData", $scope.requestedItemsGridOptions)
.then(function (data) {
$scope.model.itemList = data.items;
$scope.model.totalCount = data.TotalCount;
}
,function () {
$scope.errorMessage = "An Error has occured while loading data!";
});
})
.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
$routeProvider.when('/ModuleMst', {
templateUrl: '/Setup/ModuleMst/GridData'
//controller: 'ModuleMst',
});
$routeProvider.otherwise({
redirectTo: '/'
});
$locationProvider.html5Mode(false).hashPrefix('!');
}]);
I have not touched the routing configuration in the server side. It works with jquery ajax but not with angular $http.post().
How do i make this work ?
Thanks for the help.