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;
});
}
});

索引.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>

我知道这是常见错误,但我已经检查了代码并且看起来不错。我无法找到错误。我到处搜索,发现语法是正确的。我是 Angular 的新手,所以请忽略是否有任何愚蠢的错误并帮助我。

最佳答案

由于此行,您收到此错误:

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

它应该是:
data:{
  email: $scope.email,
  pass: $scope.pass
},

关于angularjs - 由于 : Error: [$injector:nomod] 无法实例化模块启动,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36977226/

10-13 01:37