I have an angularjs controller. I am calling a restful webservice.
app.controller('ordersCtrl', function($scope, $http, $filter) {
$scope.fetchOrders = function () {
var url = "http://localhost:8080/blah/blah";
// $http({method: 'POST', url : url})
var data = $.param({"title": "kuldeep"});
$http({method: 'POST',
url: url,
data: data,
headers: {'Content-Type': 'application/x-www-form-urlencoded'}})
.success(function(data) {
console.log(data)
});
}
I want to submit form data. So using jquery to convert object to form data. But getting the error :
$ is not defined
at Scope.$scope.fetchOrders (ordersModule.js:34)
What should I do to inject jquery inside controller. Or any alternate to make form data will be appreciated.
jquery.json DOM prior toangular.jsangular.element. The OP calls$.not$(.