In today’s i will explain a very useful tutorial which will help all AngularJS beginner and just started with angularJS, then you should keep close attention in this post. This is very basic tutorial which help you to create simple login page using angularjs, PHP and MySQL.

AngularJS is a Java script based open-source framework which used to create front-end web application. It is developed and maintained by Google. By using angularJS, you can create single page web application.


How to create login in angularjs, PHP and MySQL

So, lets start to create login page. First create a folder named “angularlogin” and create below files:

1) index.html
2) app.js
3) config.php
4) userauth.php
5) success.html

Create dca_users table

Select your database and copy below query then paste in SQL tabs to execute. It will create dca_users table in your database.

After table created insert some dummy users. Copy below SQL and execute.

1. Create index.html page

Create index.html file in angularlogin folder and copy paste below code. In below index.html define the login form.

2) Create app.js file

Create app.js file and copy paste below codes.

3) Create config.php file

In the config.php file define database configurations. I have used PDO (PHP Data Object) to conenct with mysql database. Copy paste below code it in your config.php file and change database configuration.

4) Create userauth.php page

Create userauth.php file and copy paste below code to authenticate user.

5) Create success.html

User will redirected to success.html after authenticated from API. Add success message in this page.

Do you like & share this article with your friends, and don’t forget to follow us on Facebook and Twitter to learn cool angularJS tutorials.

You may also like: