How to create login page using ionic?


I am new to Ionic framework and I am currently working on login page using Ionic framework with using MySQL database and return the data from it as JSON using PHP.

But when I run the code, the $http does not send the values and it throws the error.


Look no further than Andrew McGivery blog article:

Look for the chapter: Authentication, there you’ll find 6 distinct tutorials

1 Like


In that site, they didn’t gave the example for login and validating the username and password from the mysql db.

this is my controller

$scope.selva = function(loginData) {

.success(function(data) {
var alertPopup = $ionicPopup.alert({
title: ‘Success’,
template: ‘You are ON’
alertPopup.then(function(res) {

// $scope.state.go(‘home’);

when i enter the url it return the message correctly but when i enter into the controller.js as above, it throws the exception.

Thanks in advance
Selvaraj C

Your’re using a POST method and you pass parameters in query string (as in a GET), I don’t know how you PHP code works but it’s not consistent anyway.

1 Like


Thanks for the reply.

Could you provide the sample code on how to pass the data when we are using post method?

Selvaraj C

Search in the forum, a member just posted a link to a blog using $http or $resource or read angular docs.

Other things you should consider is to read about CORS and use https for your server.