Displaying titles and buttons inside of ion-header-bar - ionic-framework

Not sure if it's ionic thats buggy or something else ..
I am creating a simple header (and nothing else)
<ion-header-bar class="bar-positive">
<h1 class="title">Title!</h1>
<div class="buttons">
<button class="button">Right Button</button>
</div>
</ion-header-bar>
I expect to see a "Title" and a button on the header bar. But that doesn't happen.
http://plnkr.co/edit/vPkirnzlFX1I9B7W9H8N?p=preview

problem was with the ionic bundle:
using the below solved the issue:
<script src="//code.ionicframework.com/nightly/js/ionic.bundle.js"></script>

Related

Ionic zooming="true" does not resets the page zoom

I have modal for displaying Attachments.
When I display one image in modal and pinch zoom , close the modal and click on second image, 2nd image is already zoomed.
How to stop this from happening?
<script id="modal.html" type="text/ng-template">
<ion-modal-view>
<div class="bar bar-header" class="ng-cloak">
<button class="button button-clear ion-ios-arrow-left fontSize25" ng-click="closeModal()"></button>
<h1 class="title customeHeared white-color">Attachment</h1>
</div>
<ion-content>
<ion-scroll zooming="true" direction="xy" delegate-handle="zoom-pane" class="zoom-pane" min-zoom="1">
<img ng-src="{{imagePath}}" style="width: 100%;padding: 20%;"/>
</video>
</ion-scroll>
</ion-content>
</ion-modal-view>
</script>
I have not found any solution for this, Closing this now.
If anyone comes here and finds it with an answer please let me know with a comment.

How to use the same header with ion-side-menus?

I'm creating an app using Ionic 1.3.2, and I have one step when user choose your login type, from facebook or from app, after the user make your login it will redirect to other step when has a <ion-side-menus> and the user can use the app. The problem is I created the first step (choose login) with <ion-nav-bar> and in second step (side-menus) also has <ion-nav-bar> on content of <ion-side-menus> and the header of first step seems override the header of second step bugging the layout, I want to use the same header on both steps.
My question is, how could I use only one header, in that case header created on first step, and the second step use this header too ?
My scene is like below.
index.html (first step)
<body ng-app="starter" ng-controller="MainCtrl" animation="slide-left-right-ios7">
<!-- The nav bar that will be updated as we navigate-->
<ion-nav-bar class="bar bar-header bar-assertive" align-title="center">
</ion-nav-bar>
<!-- where the initial view template will be rendered -->
<ion-nav-view></ion-nav-view>
</body>
main.html (first step, where user choose your login type)
<ion-view view-title="MeuPedido" align-title="center">
<ion-content>
<div class="principal">
<a class="button button-block button-positive" ng-click="fbLogin();">Login com Facebook</a>
<button class="button button-block button-energized" ng-click="goTo('login');">
Entrar
</button>
<button class="button button-block button-energized" ng-click="goTo('addUsuario');">
Cadastrar
</button>
</div>
</ion-content>
</ion-view>
sidemenu.html (second step, after user make his login)
<ion-side-menus ng-controller='CtrlSideMenu' data-ng-init="loadImage();">
<!-- Center content -->
<ion-side-menu-content>
<!--app has header on index.html -->
<ion-nav-bar class="bar-assertive">
<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-buttons side="left" class="has-header">
<button class="button button-icon button-clear ion-navicon" menu-toggle="left">
</button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-nav-view name="tabsContent"></ion-nav-view>
</ion-side-menu-content>
<!-- Left menu -->
<ion-side-menu side="left">
<ion-header-bar>
<div>
<div class="row">
<div class="col col-90 text-center">
<img ng-src="{{imageURL}}" class="round_image">
</div>
</div>
<div class="row">
<div class="col col-90 text-center customTitle">{{nome}}</div>
</div>
</div>
</ion-header-bar>
<ion-content style="margin-top:200px;">
<ion-list>
<ion-item menu-close href="#/app/search">
Search
</ion-item>
<ion-item menu-close href="#/app/browse">
Browse
</ion-item>
<ion-item menu-close href="#/app/playlists">
Playlists
</ion-item>
</ion-list>
</ion-content>
<ion-footer-bar class="bar bar-footer">
<h6>Desenvolvido por Iguana Sistemas</h6>
</ion-footer-bar>
</ion-side-menu>
</ion-side-menus>
here image of first step, look at in this point has header
here image of second step, note that header of first step is overriding header inside ion-side-menus and bugging the layout.
I don't really get what you want to achieve, but side menu is one thing (it controls the view that appears when you open the side menu)and the the main view is another - is the view that user will see and from here you can open side-menu. you can have different nav bars for this 2 views. but from your code it looks like you have 1 main view that logs in the user and then changes itself to display the feed and a side-menu.
you multiple options: 1. make the title and color of the nav bar variable and change them with angular. 2. create another view for second step and override the nav bar.
You should have a structure something like this: -> main view(login) ->second view(feed) that also has a side menu

How to center header on Ionic app

I'm using Iconic 1 and I want to center the "MyAccount" in the header. I've had a look at the docs and tried the code but it places the content in the content pane.
This is the code I've got at the moment that displays the "MyAccount" at top:
<ion-view view-title="MyAccount">
<ion-content>
<h1>My Account</h1>
</ion-content>
</ion-view>
I'm thinking I'll need to add the <ion-header-bar></ion-header-bar> directive somewhere. I tried adding it but it didn't have the desired effect.
Can anyone suggest how to do this?
To use the dynamic header bar behavior in Ionic-Angular, use the <ion-header-bar> directive:
<ion-header-bar
title="MyAccount"
left-buttons="leftButtons"
right-buttons="rightButtons"
type="bar-positive"
align-title="center">
</ion-header-bar>
Source: Headers
Example:
<ion-header-bar align-title="center" class="bar-positive">
<div class="buttons">
<button class="button" ng-click="doSomething()">Left Button</button>
</div>
<h1 class="title">MyAccount</h1>
<div class="buttons">
<button class="button">Right Button</button>
</div>
</ion-header-bar>
<ion-content class="has-header">
Some content!
</ion-content>

Ionic tabs hidden beneath the header

I have a blank app with many pages. One of these pages needs to be diveded into tabs.
I want a few tabs to be displayed under the header (which has logo and back button).
However, for some reason, the tabs are hidden almost completly beneath the header.
The structure is the following:
<ion-view view-title="MyPage">
<ion-header-bar align-title="center">
<div class="app_header_side">
<button class="button back-button">
<i class="icon ion-ios-arrow-back"></i>
</button>
</div>
<div class="app_header_center">
<div class="text-center">
LOGO
</div>
</div>
<div class="app_header_side">
</div>
</ion-header-bar>
<ion-content class="padding has-header">
<ion-tabs class="tabs-positive tabs-icon-top">
<ion-tab title="All time" icon-on="ion-ios-filing" icon-off="ion-ios-filing-outline">
<!-- Tab 1 content -->
</ion-tab>
<ion-tab title="Month" icon-on="ion-ios-clock" icon-off="ion-ios-clock-outline">
<!-- Tab 2 content -->
</ion-tab>
<ion-tab title="Week" icon-on="ion-ios-gear" icon-off="ion-ios-gear-outline">
<!-- Tab 3 content -->
</ion-tab>
</ion-tabs>
</ion-content>
</ion-view>
I have tried to put the tabs everywhere. In the header, before "ion-view", before "ion-content". Nothing worked.
The only way to make ti work was to add
style="padding-top: 30px;"
in the tag for "ion-content". But I would prefer to avoid putting fixed padding.
I would suggest the following by declaring the header as follow:
<ion-header-bar class="bar-header">
and then defining the has-header
<ion-content class="has-header">
Alternatively as a test you can set:
<ion-content class="has-subheader">
That would imply that something like a ion-nav-bar for example is set as the header already. Then set the ion-header-bar as bar-subheader.
IONIC Headers and Sub-Headers
Alternatively you can place tab at bottom same like iOS.
Set $ionicConfigProvider.tabs.position('bottom'); in .config
I think you should try
<ion-view view-title="MyPage" class="has-header">
I came across same issue once. I used class="has-header" to root view that solved my problem.

Ionic: ion-nav-bar declared "globally" does not work?

I've got this strange behaviour.
In my index.html I declared:
<body>
<ion-nav-view></ion-nav-view>
</body>
Then in my page.html I used the followin markup:
<ion-view title="Purchases" hide-back-button="true">
<ion-nav-buttons side="left">
<button menu-toggle="left" class="button button-icon icon ion-navicon"></button>
</ion-nav-buttons>
<ion-content> ... </ion-content>
</ion-view>
The view correctly set a button to toggle side menu, but also, automatically, create a header:
<ion-nav-bar class="bar-stable nav-title-slide-ios7 bar bar-header nav-bar disable-user-behavior">
How can I change its styles? For instance: I would like to set it as a "bar-energized".
I also tried to insert, in index.html above , the following markup (amany examples show), but it does not seem to work (nav bar header remains grey):
<ion-nav-bar class="bar-energized nav-title-slide-ios7"></ion-nav-bar>
The only way it seems working is by declaring and buttons inside each and every
Just realized it was really a newbie question! I was starting from a Ionic sidemenu template, and the misterious "bar-stable" was declared inside "ion-pane ion-side-menu-content" in my menu.html file.
Hope it may helps someone other!