Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

How to build single side menu for all pages?

$
0
0

@mi6crazyheart wrote:

Hi,
I'm pretty new to ionic. Currently, I'm trying to build an android app. I've already built the Login, Session management & Logout thing. After, Login into the app, there are many other pages(Ex: P1, P2, P3...) and in each page I've a side menu which has the constant set of links.

I know how to add side menu in any page but, What I need is... I want to a build single Side menu & use in all the pages. So, if in future I need to do any kind of modification inside the menu(Add/Remove links) then I don't have to do any kind of modification in all pages.

I googled a lot about it but, didn't get any suitable answer. There is some answer I got where peoples are adding all side menus in index.html file one below another, which I really don't want to do. I want to keep my index.html file neat & clean.

Below is my current index page code. For all other pages, I've built different templates which I include by using 'stateProvider'.

<!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 href="lib/ionic/css/ionic.css" rel="stylesheet">
        <link href="css/style.css" rel="stylesheet">

        <script src="lib/ionic/js/ionic.bundle.js"></script>
        <script src="cordova.js"></script>

        <script src="js/app.js"></script>
        <script src="js/ng-cordova.min.js"></script>

    </head>

    <body ng-app="empLogin">
        <ion-nav-view>
        </ion-nav-view>.
    </body>
</html>

My app config section is like this -

app.config(function($stateProvider, $urlRouterProvider) {
    $stateProvider
        .state('login', {
            url: '/login',
            templateUrl: 'templates/login.html',
            controller: 'LoginController'
        })
        .state('home', {
            url: '/home',
            templateUrl: 'templates/home.html',
            controller: 'HomeController'
        });
    $urlRouterProvider.otherwise('/home');
});

Need some advice to handle this.

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>