Hello. I have a problem: I’m trying to organize the navigation of my app.
I’m starting from the side menu template, and when I click on a menu selection I arrive to a item list.
Now I need to start the navigation from the item list: when I click on an item I must go to another subpage, with the “back” button on the top bar.
Here is my route file
angular.module('starter')
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('app', {
url: "/app",
abstract: true,
templateUrl: "templates/menu.html",
controller: 'AppCtrl'
})
.state('app.search', {
url: "/search",
views: {
'menuContent': {
templateUrl: "templates/search.html"
}
}
})
.state('app.browse', {
url: "/browse",
views: {
'menuContent': {
templateUrl: "templates/browse.html"
}
}
})
.state('app.home', {
url: "/home",
views: {
'menuContent': {
templateUrl: "templates/home.html",
controller: 'HomeCtrl'
}
}
})
.state('app.single', {
url: "/playlists/:playlistId",
views: {
'menuContent': {
templateUrl: "templates/playlist.html",
controller: 'PlaylistCtrl'
}
}
})
.state('app.singlenews', {
url: '/singlenews',
templateUrl: 'singlenews.html'
});
// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/app/home');
});
And this is my menu:
<ion-side-menus enable-menu-with-back-views="false">
<ion-side-menu-content>
<ion-nav-bar class="bar-dark">
<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-buttons side="right">
<button class="button button-icon button-clear ion-grid" menu-toggle="right">
</button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-nav-view name="menuContent"></ion-nav-view>
</ion-side-menu-content>
<ion-side-menu side="right">
<ion-header-bar class="bar-royal">
<h1 class="title">MENU</h1>
</ion-header-bar>
<ion-content>
<ion-list>
<ion-item nav-clear class="item-icon-left" menu-close href="#/app/home">
<i class="icon ion-home"></i> Home
</ion-item>
<ion-item nav-clear class="item-icon-left" menu-close href="#/app/home">
<i class="icon ion-star"></i> Articoli
</ion-item>
<ion-item nav-clear class="item-icon-left" menu-close href="#/app/home">
<i class="icon ion-images"></i> Gallery
</ion-item>
<ion-item nav-clear class="item-icon-left" menu-close href="#/app/home">
<i class="icon ion-videocamera"></i> Video
</ion-item>
<ion-item nav-clear class="item-icon-left" menu-close ng-click="login()">
<i class="icon ion-person"></i> Robypez
<span class="badge badge-assertive">0</span>
</ion-item>
<ion-item nav-clear class="item-icon-left" menu-close ng-click="login()">
<i class="icon ion-person"></i> Login
</ion-item>
</ion-list>
</ion-content>
</ion-side-menu>
</ion-side-menus>
The home list has a single news link:
<ion-view view-title='<img class="title-image" src="img/logo.svg" />'>
<ion-content>
<ion-list class="home-list">
<ion-item class="item-text-wrap cover" ng-repeat="item in cover" href="#/app/news/{{item.id}}">
<img class="imgthumb" ng-src="{{item.thumbnail}}"/>
</ion-item>
<ion-item class="item-text-wrap" ng-repeat="item in news" href="#/singlenews">
<div class="row">
<div class="col-33"><img class="imgthumb" ng-src="{{item.thumbnail}}"/></div>
<div class="col-67"><h2>{{item.title}}</h2></div>
</div>
</ion-item>
</ion-list>
</ion-content>
</ion-view>
How can i load another template clicking on an item? The lendine template must have the menu and the back button.
Thank you