2016-11-19 55 views
0

根據下一個代碼,我創建一個登錄過程,通過PHP文件處理工作正常,但成功後的看法並沒有改變,在這裏:

(function(){ 

var app = angular.module('starter', ['ionic']); 
var app2 = angular.module('nuevo', []); 

app.controller('controller', function($scope, $http, $state) { 

$scope.registrar = function(){ 
$http.post("http://127.0.0.1:8080/php/Conexion.php",{ 
    correo:$scope.mail, pass:$scope.word,  
}).success(function(data){ 
    alert("SESIÓN INICIADA") 
    $state.go('main'); 
}); 
} 

}); 

    app.config(function($stateProvider, $urlRouterProvider) { 

$stateProvider 
    .state('main', { 
    url: '/main', 
    templateUrl: 'templates/main.html', 
    controller: 'controller', 
    }) 

$urlRouterProvider.otherwise('/index.html'); 
    }); 

我的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 rel="manifest" href="manifest.json"> 

    <link href="lib/ionic/css/ionic.css" rel="stylesheet"> 
    <link href="css/style.css" rel="stylesheet"> 
    <script src="lib/ionic/js/ionic.bundle.js"></script> 
    <script src="cordova.js"></script> 
    <script src="js/app.js"></script> 
    </head> 
    <body ng-app="starter"> 
    <ion-pane> 
     <ion-header-bar class="bar-stable"> 
     <div class=" col text-center"> 
      <h3 >Taxi App</h3> 
      </div> 
     </ion-header-bar> 
     <div ng-controller="controller">  

     <img class="indexImg" src="img/saludoIndex.jpg"> 
     <br><br> 
      <div class="item item-input-inset">  
       <label class="item-input-wrapper"> 
        <i class="icon ion-at placeholder-icon"></i> 
        <input type="text" placeholder="Dirección de email" ng-model="mail"> 
       </label> 
      </div> 

      <div class="item item-input-inset">  
       <label class="item-input-wrapper"> 
        <i class="icon ion-locked placeholder-icon"></i> 
        <input type="text" placeholder="Contraseña" ng-model="word"> 
       </label><br> 
      </div> 

      <div class="col text-center"> 
       <br><h4><a>¿Olvidaste tu contraseña?</a></h4><br><br><br><br><br> 
       <a class="button button-stable button-large" href="templates/Register.html"> 
       <b>Crear una cuenta gratuita</b></a> 
      </div> 

    <ion-footer-bar class="bar-positive tabs"> 
     <a class="tab-item"> 
      <h4 style="color:white;" ng-click="registrar()">INICIAR SESIÓN</h4> 
     </a> 
    </ion-footer-bar> 
</div> 
</ion-pane> 
    </body> 
</html> 

但網絡日誌顯示我在頁面內的信息(簡單的測試數據),main.html中只是用於測試的簡單的數據,如果變化是工作,但不在應用程序的屏幕上加載頁面。

enter image description here

enter image description here

我希望你能幫助我這個問題,非常感謝你。

+0

什麼是在瀏覽器中看到的網址,而你訪問你的應用程序 –

+0

首先加載我看到「index.html」,然後我訪問主,它顯示了我發佈上面的圖片。 – Gutierrez

+0

$ state.go('app.swap_device',{},{location:false});這對我工作 –

回答

0

閱讀更多關於這個問題,我發現,我不得不添加對index.html的身體,這main.html中,它完美的作品