I am sending a normal get request as follows which was working normally:
service.show = function (slug) {
console.log(slug)
return $http.get('api/packages/'+slug, slug).success(function(response){
service.package = response.package;
});
};
Suddenly after I started combining all js files together using gulp I get this weird error:
angular.js:10147 TypeError: Cannot create property 'method' on string 'package-38'
Since the application is an api so I tried to run the request using postman to see if it's working and it was. However when the same request is called in a certain page, I get this error.
I check variable slug
which is a string
and it is sent normally, so what could be the possible bug here?!
The second parameter
$http.get
expects, is an object with http request configuration.Have a look at angular documentation. See the Shortcut methods section.
Or better and readable call looks like below: