I have an ionic mobile app. i runs on a mobile browser. it has static a header. i need to hide the address bar for that web app even when scrolling down, but this does not happen.
it has a header as follows,
<meta name="viewport"
content="initial-scale=1,
maximum-scale=1,
user-scalable=no,
width=device-width">
it runs on a native mobile browser. i built the app using console. so please help me to hide the address/header bar and run like facebook or other web apps
You can install the statusbar plug-in:
$ cordova plugin add org.apache.cordova.statusbar
or for cordova 5.0+:
$ cordova plugin add cordova-plugin-statusbar
and hide the status bar: StatusBar.hide();
.controller('MyCtrl', function($scope) {
ionic.Platform.ready(function() {
// hide the status bar using the StatusBar plugin
StatusBar.hide();
});
});
Some more info here and a working app here.
UPDATE for Ionic 2
In Ionic 2 things are a bit different. We still need to install cordova plugin statusbar but we need to import the statusbar from ionic native:
import {StatusBar} from 'ionic-native';
The main class should roughly look like this:
import {App, Platform} from 'ionic/ionic';
import {HomePage} from './home/home';
import './app.scss';
import {StatusBar} from 'ionic-native';
@App({
template: `
<ion-nav [root]="root"></ion-nav>
<ion-overlay></ion-overlay>
`,
})
export class MyApp {
constructor(platform: Platform) {
this.platform = platform;
this.initializeApp();
this.root = HomePage;
}
initializeApp() {
this.platform.ready().then(() => {
console.log('Platform ready');
StatusBar.hide();
});
}
}
The code is borrowed from the ionic native repository. A good tutorial can be found here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With