2016-05-02 8 views
3

app.js: -

var app = angular.module('start', ['ionic']); 
app.run(function($ionicPlatform) { 
$ionicPlatform.ready(function() { 
if(window.cordova && window.cordova.plugins.Keyboard) { 
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); 
    cordova.plugins.Keyboard.disableScroll(true); 
} 
if(window.StatusBar) { 
    StatusBar.styleDefault(); 
} 
}); 
}); 
app.controller('sign_up', function($scope, $http){ 
$scope.check_cred = function(){ 
document.getElementById('message').textContent=""; 
var request = $http({ 
    method:"post", 
    url: "http://10.0.128.152/ionic/login.php", 
    data:{ 
    email = $scope.email, 
    pass = $scope.pass 
    }, 
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' } 
}); 
request.success(function(data){ 
    document.getElementById("message").textContent = "Login successful with "+data; 
}); 
} 
}); 

index.html

<!DOCTYPE html> 
<html> 
<head> 
<meta charset="utf-8"> 
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> 
<title></title> 

<link href="lib/ionic/css/ionic.css" rel="stylesheet"> 
<link href="css/style.css" rel="stylesheet"> 

<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above 
<link href="css/ionic.app.css" rel="stylesheet"> 
--> 

<!-- ionic/angularjs js --> 
<script src="lib/ionic/js/ionic.bundle.js"></script> 

<!-- cordova script (this will be a 404 during development) --> 
<script src="cordova.js"></script> 

<!-- your app's js --> 
<script src="js/app.js"></script> 
</head> 
<body ng-app="start" ng-controller="sign_up"> 

<ion-pane> 
    <ion-header-bar class="bar-header bar-dark"> 
    <h1 class="title">Lazywyre</h1> 
    </ion-header-bar> 
    <ion-content class="padding"> 
    <div class="list"> 
     <label class="item item-input"> 
     <input type="text" ng-model="email" placeholder="Email"> 
     </label> 
     <label class="item item-input"> 
     <input type="password" ng-model="pass" placeholder="Password"> 
     </label> 
     <button ng-click="check_cred()" class="button button-full button-positive"> 
     Submit 
     </button> 
    </div> 
    <span id="message"></span> 
    </ion-content> 
</ion-pane> 
</body> 
</html> 

Ich weiß, das häufiger Fehler ist, aber ich habe überprüfte den Code und sieht gut aus für mich. Ich kann den Fehler nicht finden. Ich habe es überall gesucht und festgestellt, dass die Syntax stimmt. Ich bin neu in Angular, also ignoriere bitte, wenn irgendein dummer Fehler ist und hilf mir.

+0

Die Syntaxfehler von Datenobjekt sollte in der Konsole sichtbar gewesen sein. – Vaibhav

Antwort

2

Sie erhalten diesen Fehler, da dieser Linie:

data:{ 
    email = $scope.email, 
    pass = $scope.pass 
}, 

Es sollte:

data:{ 
    email: $scope.email, 
    pass: $scope.pass 
}, 
Verwandte Themen