Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49171

Ionic 2 $http requests don't work

$
0
0

@imbrendino wrote:

Hi,
I'm trying to do external $http requests but the application doesn't find $http although I've imported it.
In a previous version of ionic it works. This is the code:

.controller('loginCtrl', ['$scope', '$stateParams',
function ($scope, $stateParams, $ionicPopup,$http, $httpParamSerializerJQLike,$ionicPopup,$ionicHistory, UserService, CONST) {

$scope.response;

$scope.showLog= function(){
requestExt();
}

function requestExt() {
console.log("login");

    $http.get(CONST.SERVER_BASE_URL+'/demo/all').

	success(function(data, status, headers, config) {
			console.log("Successo");

	}).
	error(function(data, status, headers, config) {
		console.log("Errore");
	});
  }

}])

This is the error:

Error: undefined is not an object (evaluating '$http.get')

The same error occurs when I use $httpParamSerializerJQLike

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49171

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>