我是新的離子 我試圖做一個登錄應用兩個視圖之間切換簡單:AngularJS改變位置不工作
的index.html
<ion-pane>
<ion-header-bar class="bar-stable">
<h1 class="title">Ionic Login App</h1>
</ion-header-bar>
<ion-content>
<div class="list list-inset">
<label class="item item-input">
<input type="text" placeholder="Email" ng-model="data.email">
</label>
<label class="item item-input">
<input type="password" placeholder="Password" ng-model="data.password">
</label>
</div>
<button class="button button-block button-calm" ng-click="postLogin()">Login</button>
</ion-content>
</ion-pane>
logincontroller.js
app.controller( 'loginCtrl',函數($範圍,$ HTTP,$位置) {
$scope.data = {};
$scope.postLogin = function()
{
var data =
{
email: $scope.data.email,
password: $scope.data.password
};
console.log('bonjour');
$http.post("http://localhost/authproject/public/api/auth/login", data)
.then(
function(response){
// success callback
console.log('success');
$location.path('/map');
},
function(response){
// failure callback
console.log('error');
$location.path('/index');
}
);
}
當我點擊一個按鈕登錄的URL變化,但頁面沒有改變
有人能告訴我如何解決這個問題嗎?感謝提前:)
要再次同一個瀏覽頁面登錄後? –
是的。我想導航map.html頁面 – Sarah