# Hello I want to create a simple login from in ionic framework and angular-js

**URL:** <https://forum.ionicframework.com/t/hello-i-want-to-create-a-simple-login-from-in-ionic-framework-and-angular-js/64006>\
**Category:** ionic-v1\
**Created:** [September 20, 2016, 4:25pm UTC](https://forum.ionicframework.com/t/hello-i-want-to-create-a-simple-login-from-in-ionic-framework-and-angular-js/64006 "2016-09-20T16:25:38Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![nishikant5674](https://avatars.discourse-cdn.com/v4/letter/n/b9e5f3/32.png) [@nishikant5674](https://forum.ionicframework.com/u/nishikant5674)\
**Post date:** [September 20, 2016, 4:25pm UTC](https://forum.ionicframework.com/t/hello-i-want-to-create-a-simple-login-from-in-ionic-framework-and-angular-js/64006/1 "2016-09-20T16:25:38Z")

</div>

Hello,

I want to create a simple login from in ionic framework and angular-js.  
just I want to check how its work click button event .  
Otherwise you can create a new project login from and check the validation then send me .

---

<div class="post-metadata">

**Author:** ![rgecy](https://avatars.discourse-cdn.com/v4/letter/r/ac8455/32.png) [@rgecy](https://forum.ionicframework.com/u/rgecy)\
**Post date:** [September 20, 2016, 9:00pm UTC](https://forum.ionicframework.com/t/hello-i-want-to-create-a-simple-login-from-in-ionic-framework-and-angular-js/64006/2 "2016-09-20T21:00:29Z")

</div>

Create an ionic project using the sidemenu template. It has a login form and a dummy auth function.

`ionic start myApp sidemenu`

Then check out ionic cloud and ionic.Auth

> **[Ionic Services Docs](http://legacy-cloud-docs.ionic.io)**
>
> Documentation for the Ionic Services Service: Push, Users, Package, and Deploy

> **[Ionic Services Docs](http://legacy-cloud-docs.ionic.io)**
>
> Documentation for the Ionic Services Service: Push, Users, Package, and Deploy

This should be a good start using ionic. If you want to do your own custom authentication, thats a different story.

There are several good articles out there on creating your own authentication system, but Ionic really makes it easy.

Good Luck,

RGecy

---

<div class="post-metadata">

**Author:** ![nishikant5674](https://avatars.discourse-cdn.com/v4/letter/n/b9e5f3/32.png) [@nishikant5674](https://forum.ionicframework.com/u/nishikant5674)\
**Post date:** [September 27, 2016, 11:19am UTC](https://forum.ionicframework.com/t/hello-i-want-to-create-a-simple-login-from-in-ionic-framework-and-angular-js/64006/3 "2016-09-27T11:19:35Z")

</div>

I can’t understand Mr RGecy can you please explain it …  
My requirement is …  
I have two field 1 is user id and 2 is user password get the values on html page then on click submit button  
the values is store in my database and i will try to run in local system .  
How can i do ? please guide me because i am new in ionic and anglar js .

---

<div class="post-metadata">

**Author:** ![nishikant5674](https://avatars.discourse-cdn.com/v4/letter/n/b9e5f3/32.png) [@nishikant5674](https://forum.ionicframework.com/u/nishikant5674)\
**Post date:** [September 28, 2016, 6:27am UTC](https://forum.ionicframework.com/t/hello-i-want-to-create-a-simple-login-from-in-ionic-framework-and-angular-js/64006/4 "2016-09-28T06:27:11Z")

</div>

Hello Every One ,  
anyone can guide me please …

---

<div class="post-metadata">

**Author:** ![anicacute09](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/anicacute09/32/113162_2.png) [@anicacute09](https://forum.ionicframework.com/u/anicacute09)\
**Post date:** [September 28, 2016, 6:30am UTC](https://forum.ionicframework.com/t/hello-i-want-to-create-a-simple-login-from-in-ionic-framework-and-angular-js/64006/5 "2016-09-28T06:30:52Z")

</div>

you may want to look at this tutorial: [https://devdactic.com/simple-login-example-with-ionic-and-angularjs/](https://devdactic.com/simple-login-example-with-ionic-and-angularjs/) hope it helps…

---

<div class="post-metadata">

**Author:** ![nishikant5674](https://avatars.discourse-cdn.com/v4/letter/n/b9e5f3/32.png) [@nishikant5674](https://forum.ionicframework.com/u/nishikant5674)\
**Post date:** [September 28, 2016, 6:40am UTC](https://forum.ionicframework.com/t/hello-i-want-to-create-a-simple-login-from-in-ionic-framework-and-angular-js/64006/6 "2016-09-28T06:40:50Z")

</div>

okey thanks let check it .

---

<div class="post-metadata">

**Author:** ![priteshpmehta](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/priteshpmehta/32/103076_2.png) [@priteshpmehta](https://forum.ionicframework.com/u/priteshpmehta)\
**Post date:** [September 28, 2016, 6:43am UTC](https://forum.ionicframework.com/t/hello-i-want-to-create-a-simple-login-from-in-ionic-framework-and-angular-js/64006/7 "2016-09-28T06:43:22Z")

</div>

Hi,

You can use following

**Login.html**

```
<ion-view view-title="Login">
  <ion-content>
  <form name="myForm" novalidate>
    <div class="padding logo">
    	<img src="img/logo.png">
    	<div class="padding">Use your credentials to log into your account</div>
    </div>
    <div class="list">
        <label class="item item-input">
          <span class="input-label">User Name</span>
          <input type="text" name="username" ng-model="user.userID" required>
        </label>
        <label class="item item-input">
          <span class="input-label">Password</span>
          <input type="password" name="password" ng-model="user.password" required>
        </label>
  	</div>
    
    <div class="padding errors">
        <p ng-show="myForm.username.$error.required">* Username is required</p>
        <p ng-show="myForm.password.$error.required">* Password is required</p>
    </div>

    <div class="padding">
        <button class="button button-block button-custom" ng-disabled="myForm.$invalid" ng-click="login(user)">Sign-In</button>
    	<!-- <p class="text-center">
      	<a href="#/forgot-password">Forgot password</a>
    	</p> -->
    </div>
    </form>
  </ion-content>
</ion-view>

```

**Config**

```
.state('login', {
    cache: false,
    url: '/login',
    templateUrl: 'templates/Account/Login.html',
    controller: 'loginController'
  })

```

**Controller**

```
.controller('loginController', ['$scope', '$state', '$http', '$ionicPopup', '$ionicLoading', '$q', '$rootScope', function ($scope, $state, $http, $ionicPopup, $ionicLoading, $q, $rootScope) {

  $scope.user = {};
  
  $scope.login = function() {
  
  $http.get('http://www.XXX.com/LoginWebService/GetLoginDetails/' + $scope.user.userID + '/' + $scope.user.password)
    .then( function (response) {
      // If successful login
      $state.go('Dashboard', {}, {reload: true});
    })
    .catch(function (e){
       alert(e);
    })
    .finally(function (e) {
      // do something
    });
  }
}])
```

---

<div class="post-metadata">

**Author:** ![nishikant5674](https://avatars.discourse-cdn.com/v4/letter/n/b9e5f3/32.png) [@nishikant5674](https://forum.ionicframework.com/u/nishikant5674)\
**Post date:** [September 28, 2016, 6:43am UTC](https://forum.ionicframework.com/t/hello-i-want-to-create-a-simple-login-from-in-ionic-framework-and-angular-js/64006/8 "2016-09-28T06:43:35Z")

</div>

I show that link but my problem is not solve …

---

<div class="post-metadata">

**Author:** ![nishikant5674](https://avatars.discourse-cdn.com/v4/letter/n/b9e5f3/32.png) [@nishikant5674](https://forum.ionicframework.com/u/nishikant5674)\
**Post date:** [September 28, 2016, 6:49am UTC](https://forum.ionicframework.com/t/hello-i-want-to-create-a-simple-login-from-in-ionic-framework-and-angular-js/64006/9 "2016-09-28T06:49:23Z")

</div>

Let me check Mr priteshpmetha.

---

<div class="post-metadata">

**Author:** ![nishikant5674](https://avatars.discourse-cdn.com/v4/letter/n/b9e5f3/32.png) [@nishikant5674](https://forum.ionicframework.com/u/nishikant5674)\
**Post date:** [September 28, 2016, 7:16am UTC](https://forum.ionicframework.com/t/hello-i-want-to-create-a-simple-login-from-in-ionic-framework-and-angular-js/64006/10 "2016-09-28T07:16:25Z")

</div>

Hello ,  
Please tell me " where put the code config and Controller "  
Or creating a new file Conig.js and Controller.js  
Or put the code in apps.js file.

---

<div class="post-metadata">

**Author:** ![priteshpmehta](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/priteshpmehta/32/103076_2.png) [@priteshpmehta](https://forum.ionicframework.com/u/priteshpmehta)\
**Post date:** [September 28, 2016, 7:36am UTC](https://forum.ionicframework.com/t/hello-i-want-to-create-a-simple-login-from-in-ionic-framework-and-angular-js/64006/11 "2016-09-28T07:36:46Z")

</div>

You can copy paste it in app.js file

---

<div class="post-metadata">

**Author:** ![nishikant5674](https://avatars.discourse-cdn.com/v4/letter/n/b9e5f3/32.png) [@nishikant5674](https://forum.ionicframework.com/u/nishikant5674)\
**Post date:** [September 28, 2016, 8:05am UTC](https://forum.ionicframework.com/t/hello-i-want-to-create-a-simple-login-from-in-ionic-framework-and-angular-js/64006/12 "2016-09-28T08:05:56Z")

</div>

I have put the code config and controller in apps.js file and save it.  
After click login button validation is not working .

---

<div class="post-metadata">

**Author:** ![priteshpmehta](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/priteshpmehta/32/103076_2.png) [@priteshpmehta](https://forum.ionicframework.com/u/priteshpmehta)\
**Post date:** [September 28, 2016, 9:10am UTC](https://forum.ionicframework.com/t/hello-i-want-to-create-a-simple-login-from-in-ionic-framework-and-angular-js/64006/13 "2016-09-28T09:10:40Z")

</div>

For validation… no need to click on button… Once you enter value in compulsory field then after button will get active…
