Display the Menu always for Tablets in Ionic3+
We can use ion-split-pane for showing the UI elements like Menu always in large viewports like Tablets which is common in iPads.
We can use ion-split-pane for showing the UI elements like Menu always in large viewports like Tablets which is common in iPads.
ionic start IonicMobileProject sidemenu
cd IonicMobileProject/
ionic serve
A Progressive Web App (PWA) is an web application which gives an App like experience on mobile devices. PWA are developed with web technologies. These apps need not be installed and can be just access on the mobile browser by adding a short cut to the Home screen using ‘Add to Home Screen’ browser option. PWA fills the gap between mobile websites and mobile apps.
Currently PWA are developed by many Software companies you can find the references from PWA Rocks website
To start a new application
ionic start NagIonic sidemenu
Navigate to the project folder NagIonic
To Launch an app in browser
Ionic serve –lab
Add platforms
ionic platform add ios
ionic platform add android
ionic platform add windows
Add icon and splash
Place icon.png (192X192 px), splash.png(
2208×2208 px) in resources folder
ionic resources
To run app on device
ionic run android
The following code snippets demonstrates the format/template which can be used in Ionic or in Angularjs Applications
/**************************
* Controller
**************************/
(function () {
'use strict';
var injectParams = [ /* 'dependency1' */];
function SampleCtrl( /* dependency1 */) {
var SampleVm = this;
//Bindable Properties and functions
SampleVm.dummyProperty = '';
SampleVm.dummyBindableFunc = dummyBindableFunc;
//Functions
function dummyBindableFunc() {
}
function myNormalFunc() {
}
};
SampleCtrl.$inject = injectParams;
angular.module('app.myModule').controller('SampleCtrl', SampleCtrl);
})();
/**************************
* Factory
**************************/
(function () {
'use strict';
var injectParams = [ /* 'dependency1' */];
function sampleFactory( /* dependency1 */) {
var exports = {
getData: getData
};
return exports;
////////////////
function getData() {
}
}
sampleFactory.$inject = injectParams;
angular.module('app.myModule').factory('sampleFactory', sampleFactory);
})();
/**************************
* Filter
**************************/
(function () {
'use strict';
function sampleFilter() {
return sampleFilterFunc;
////////////////
function sampleFilterFunc(parameters) {
return parameters;
}
}
angular.module('app.myModule').filter('sampleFilter', sampleFilter);
})();
/**************************
* Directive
**************************/
(function () {
'use strict';
var injectParams = [ /* 'dependency1' */];
function customDirective( /* dependency1 */) {
var directive = {
link: link,
restrict: 'EA',
replace: true,
templateUrl: 'app/myDirective/myDirective.html',
controller: 'customController',
controllerAs: 'custom'
};
return directive;
function link(scope, element, attrs) {
}
};
customDirective.$inject = injectParams;
angular.module('app.myModule').directive('customDirective', customDirective);
})();
Ionic 2 is an open source cross platform application development framework. For the below questions your answer is YES and you can use the Ionic 2 for your app development.
Ionic 2 apps can be developed with Angular 2 and preferably with typescript.
To install the development environment perform the below steps
To create first sample app, Open the cmd window and use the below command
ionic start sampleApp --v2
To run your app, cd
into the sampleApp directory
To run on browser ionic serve
To run on ios ionic run ios
To run on Android ionic run android
To know the environment details use ionic info
Your system information:
Cordova CLI: 6.1.1
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 2.0.0-rc.1
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
OS: Windows 8.1
Node Version: v6.2.1
ionic g page [pageName]
ionic g page demoPage
CLI creates the following three files under 'sampleApp/src/pages/demo-page'
page
with provider
:ionic g provider [providerName]
ionic g provider demoData
CLI creates the demo-data.ts under 'sampleApp/src/providers/' folder this file serves likes service/factory.
import { NgModule } from '@angular/core';
import { IonicApp, IonicModule } from 'ionic-angular';
import { MyApp } from './app.component';
import { AboutPage } from '../pages/about/about';
import { ContactPage } from '../pages/contact/contact';
import { HomePage } from '../pages/home/home';
import { TabsPage } from '../pages/tabs/tabs';
import { DemoPage } from '../pages/demo-page/demo-page'; //import DemoPage
@NgModule({
declarations: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage,
DemoPage //Add DemoPage
],
imports: [
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage,
DemoPage //Add DemoPage
],
providers: []
})
export class AppModule {}
Add button on Home.html
Show DemoPage
Add the code to navigate in the HomePage class
goToDemoPage(){
this.navCtrl.push(DemoPage);
}
Launch the app and click on the 'SHOW DEMOPAGE' Button you will be navigated to the DemoPage
Bingo !!! you created a new page and plugged in app and implemented the navigation.