Tôi có nút quay lại khi tôi nhấn ng-click='goBack()'
. tôi có thể thấy url trong trình duyệt thay đổi từ http://app:8888/#/main/payments thành http://app:8888/#/main/products/7 là con đường đúng mà tôi muốn quay lại nhưng vấn đề là chế độ xem không chuyển đổi ở đó.Ionic cách quay lại trạng thái lập trình
Tôi phải nhấn nút làm mới để đến đó hoặc thực hiện window.location.reload sau $ionicHistory.goBack();
.
Tôi không muốn tải lại toàn bộ trang tôi muốn chuyển chế độ xem đó sang trang trước đó.
đây là html của tôi
<div class="row">
<div class="col col-25">
<button ng-click="goBack()" class="button button-large button-block button-royal">Go Back</button>
</div>
</div>
đây là bộ điều khiển của tôi
.controller('paymentsController', function($scope, $localStorage, $log, $state, $window, $ionicHistory){
$scope.goBack = function(){
$ionicHistory.goBack();
}
})
đây là app.js của tôi, tôi không biết nếu điều này sẽ giúp.
// Ionic Starter App
// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services', 'ngStorage'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
})
.config(function($stateProvider, $urlRouterProvider){
//$ionicConfigProvider.views.transition('none');
$urlRouterProvider.otherwise('/');
$stateProvider
.state('login',{
url: '/',
templateUrl: 'templates/login.html',
controller: 'loginController'
})
.state('main', {
url: '/main',
templateUrl: 'templates/main.html',
controller: 'mainController',
abstract: true
})
.state('main.categories', {
url: '/categories',
views: {
'categories': {
templateUrl: 'templates/categories.html',
controller: 'categoriesController'
}
}
})
.state('main.products', {
url: '/products/:productId',
views: {
'products': {
templateUrl: 'templates/products.html',
controller: 'productsController'
}
}
})
.state('main.payments', {
url: '/payments',
views: {
'payments': {
templateUrl: 'templates/payments.html',
controller: 'paymentsController'
}
}
})
})
thể trùng lặp của [làm thế nào để tạo ra một nút quay lại ở chân (khuôn khổ ion)?] (Http://stackoverflow.com/câu hỏi/22739459/cách tạo-a-back-nút-trong-chân-i-khung-khuôn) – callmekatootie