in ionic how to add a fixed logo bar at top

Dinesh

I am just starting with ionic framework for a hybrid app, and stuck right at the gates! I want a fixed-top bar having logos and a search icon; and then the rest of the content consisting of - a context dependent menu followed by the content.

I started with one of the start apps "sidemenu" from ionic website and modified it.

<ion-nav-bar class="logo-bar">
    <button class="button button-clear">
        <img class="pull-left" src="img/YourCompany-trans.png">
    </button>
    <div class="title icon ion-search" ng-click="doSearch()">
    </div>
    <button class="button button-clear">
        <img class="pull-right" src="img/MyCompanyLogo.png">
    </button>
</ion-nav-bar>

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

</body>

But my logo/search bar does not appear at all. If I remove the ion-nav-view then I can visualize it. I have tried other combinations, placing it within the nav-view, using ion-content but I am still stuck.

What's the right way of doing this? Ionic documentation is rather sparse.

Manish Kr. Shukla

ion-nav-view is used for navigation and routing views.

If you actually want to see your headers, you have to do a lot of stuff.

  1. Configure your routes.

  2. Develop corresponding HTML pages / HTML Templates for each route url.

  3. Wire up stuff and run.

HTML :

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



    <script id="templates/yourTemplate.html" type="text/ng-template">
      <ion-view view-title="Welcome">
        <ion-content class="padding">
            <!-- Place your HTML content containing header here -->
        </ion-content>
      </ion-view>
    </script>

JS :

    angular.module('ionicApp', ['ionic'])
    .config(function($stateProvider, $urlRouterProvider) {

      $stateProvider
        .state('yourStateName', {
          url: "/UrlToBeDisplayedInTheBrowser",
          templateUrl: "idThatYouSpecifiedInTheScripTag"
        });
    });

A complete example can be found here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to put logo on navigation bar

From Dev

How to add image on top of UINavigationController's navigation bar?

From Dev

Links in Top-Fixed Navigation Bar Not Responding

From Dev

How to make renderbody content not to appear below the top fixed nav bar

From Dev

Add fixed bar to HTML page

From Dev

Keep menu bar on top without position:fixed

From Dev

how to move logo to top in html

From Dev

How do I center the logo in ionic bar

From Dev

ionic: Fixed title in ion-nav-bar

From Dev

How to make App Bar and an Edittext fixed at the top of the layout in Android

From Dev

How to add padding to anchor tags in Top Bar in Foundation 6?

From Dev

ionic 2: How to implement a fixed top panel

From Dev

How to add a line on top of a bar chart?

From Dev

How to add my custom layout in top of notifications in status bar?

From Dev

Show fixed width top bar on horizontal scroll

From Dev

Fixed top bar + 100% height fixed sidebar?

From Dev

Add fixed bar to HTML page

From Dev

CSS: Fixed/pinned top menu bar

From Dev

Foundation fixed top bar, how to deal with the ofset

From Dev

Add brand logo and a li when navbar fixed top on scroll

From Dev

how to move logo to top in html

From Dev

Make menu bar fixed on top when scrolling

From Dev

How do I add a logo into the nav bar in CSS?

From Dev

Need centered Logo with top fixed navigation bootstrap

From Dev

How to add a line on top of a bar chart?

From Dev

How do I add stuff to top bar?

From Dev

How do I add a navigation bar on top of background?

From Dev

how to make the nav-bar fixed and on top of the page and not overlapable

From Dev

How to add a fixed bar on the mapView on iOS

Related Related

HotTag

Archive