Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <ion-header-bar align-title="center" class="bar-balanced">
- <h1 class="title">Onseral</h1>
- </ion-header-bar>
- <ion-view>
- <ion-content class="padding has-header">
- <ion-list>
- <ion-item>
- <input type="text" ng-model="username" placeholder="Username">
- </ion-item>
- <ion-item>
- <input type="password" ng-model="password" placeholder="Password">
- </ion-item>
- </ion-list>
- <button nav-clear class="button button-block button-balanced" ng-click="LogIn()">Login</button>
- </ion-content>
- </ion-view>
- angular.module('ionicApp.controllers', [])
- .controller('AppCtrl', function($scope) {
- })
- .controller('LoginCtrl', function($scope, $state, $http, $ionicPopup) {
- $scope.LogIn = function() {
- var request = $http({
- method: "post",
- url: "http://www.webcentury.co.id/api/login.php",
- data: {
- username: $scope.username,
- password: $scope.password
- },
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
- });
- /*Successful HTTP post request or not */
- request.success(function (data){
- //console.log(data);
- if (data == '1'){
- console.log('test success');
- }
- else {
- console.log('test failed');
- console.log($scope.username);
- }
- })
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement