I am trying to move one page to to another using $state.go function. I am able to do that, but when the user clicks on the button, it creates a back button on next page. I don't want this when the user clicks on this main screen button.
I will explain again I have one button on main screen. On click I go to another screen, after I move it, it shows the back button on top header. I don't want this, but after that, if the user click moves to any page, it shows the back button. I don't want the navigation back button on the first screen. After that, I want here is my code (http://plnkr.co/edit/J4XI8hjCgvIUeVV89kYG?p=preview)
<!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 data-require="ionic@1.0.0-beta.1" data-semver="1.0.0-beta.1" rel="stylesheet" href="http://code.ionicframework.com/1.0.0-beta.1/css/ionic.css" />
<link rel="stylesheet" href="style.css" />
<script data-require="ionic@1.0.0-beta.1" data-semver="1.0.0-beta.1" src="http://code.ionicframework.com/1.0.0-beta.1/js/ionic.bundle.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
<script src="app.js"></script>
<script src="controllers.js"></script>
</head>
<body ng-app="starter">
<ion-nav-view></ion-nav-view>
</body>
</html>
.controller('a', function($scope, $stateParams,$state) {
$scope.moveto=function(){
alert('--')
$state.go('app.playlists')
}
})
Use the hide-back-button attribute
<ion-view title="Playlists" hide-back-button="{{hideBackButton}}">
.controller('PlaylistsCtrl', function($scope) {
...
$scope.hideBackButton = true;
})
use ionicHistory before calling $state.go('app.playlists')
Try like this
.controller('a', function($scope, $stateParams,$state,$ionicHistory) {
$scope.moveto=function(){
alert('--')
$ionicHistory.nextViewOptions({
disableBack: true
});
$state.go('app.playlists')
}
})