Ionic Navigation using sidemenu


#1

Hi

I create an app first page as a dashboard with links to all the app sections.

When i click i see a back button at the top header. How can i present the hamburguer icon (i am using sidemenu template) and have the normal sidemenu navigation ?

Also the back button does not navigate back to the origin page.

I try using :
Link1
href="#/app/link1">Link1

And also :

<button ng-click="link1Redirect()">Link 1</button>


.controller('DashboardCtrl', function($scope, $stateParams,$location) {
	$scope.link1Redirect = function() {
		$location.path('#/app/link1');
	}
})

#2

please do not use href… use ui-sref instead… it is the default approach for ui-router navigation.

you can set an attribute to activate sidemenu also on backviews:
enable-menu-with-back-views=“true”

http://ionicframework.com/docs/api/directive/ionSideMenus/


#3

Better solution use $state.go(‘STATE’)


#4

thank you @bengtler, it is working fine.


#5

thank you ! it is working fine.


#6

state.go is the js-pendant to the uiSref directive :wink:


#7

Hi !

I do use ui-sef in a button in my dashboard screen, and it work´s only on the first time, i click and i can go to the link!

If i hit the back button and click again in the same button no action is trigered i just stay in the dashboard screen.

Trying to look at docs, there is a fix for that ?


#8

could you show us some code?


#10

Basically after bower install and include at index.html:

Add ui-sref

<div class="div1">
	<button ui-sref="app.div1" class="mdl-button mdl-js-button mdl-button--fab mdl-button--colored">Div1</button>
</div>

Add ui-view at index.html

<body ng-app="starter">
	<ion-nav-view ui-view></ion-nav-view>
</body>

At app.js i inject ui.router

'ui.router']

#11

you only need the ion-nav-view

<ion-nav-view></ion-nav-view>

#12

Thank you it work´s .

I also add these event: on-release=“navigate()”