由于以下原因无法实例化模块启动:错误:[$ injector:nomod]

时间:2016-05-02 07:32:33

标签: angularjs html5 ionic-framework

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>

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

1 个答案:

答案 0 :(得分:2)

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

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

应该是:

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