This document provides an overview of the Ionic Framework, including:
- Ionic is an open source SDK for building hybrid mobile apps using web technologies like HTML, CSS, and JavaScript.
- It uses Cordova to access native device capabilities and wrap the app in a native shell.
- The document covers installing Ionic, using the Ionic CLI, CSS components, AngularJS directives, and integrating Sass for styling.
4. About Ionic
HTML5 mobile app development framework
for building Hybrid apps -> Cordova / Phonegap
Native-styled mobile UI elements (iOS, Android) through CSS3
(optional) core functionality through AngularJS
8. What is Cordova
● Mobile development framework
● Provide API bindings to access device’s sensors, data…
● Open Source (vs Adobe PhoneGap)
● Build app wrappers for each mobile platform
● Distributable to app stores
10. Cordova Components
Plugins
● interface between Cordova and
native components
● Allows invoke native code from JS
● Plugins to standard device APIs
● Third party plugins
● How to build a plugin
11. Cordova Components
Cordova CLI
● Create new projects
● Add / remove platforms
● Build for any platform
● Run on real devices
● Run on emulators
● Search for plugins
● Install / Remove plugins
32. <ion-header-bar align-title="left">
<div class="buttons">
<!-- left button -->
</div>
<h1 class="title">Title!</h1>
<div class="buttons">
<!-- right button -->
</div>
</ion-header-bar>
ion-header-bar
Ionic AngularJS elementshttp://ionicframework.com/docs/api/
API
● align-title: left/right/center
● no-tap-scroll: by default it scrolls
content to the top when clicked
33. <ion-footer-bar align-title="left">
<div class="buttons">
<!-- left button -->
</div>
<h1 class="title">Title!</h1>
<div class="buttons">
<!-- right button -->
</div>
</ion-footer-bar>
ion-footer-bar
Ionic AngularJS elementshttp://ionicframework.com/docs/api/
API
● align-title: left/right/center
36. Basics
● data must be array
● NO one-time binding (::)
<ion-content>
<ion-item collection-repeat="item in
items">
{{item}}
</ion-item>
</ion-content>
collection-repeat
Ionic AngularJS elementshttp://ionicframework.com/docs/api/
API
● collection-repeat
● item-width: in px or %
● item-height: in px or %
● item-render-buffer
● force-refresh-images
40. ionNavViews
Ionic AngularJS elementshttp://ionicframework.com/docs/api/
Usage
var app = angular.module('myApp', ['ionic']);
app.config(function($stateProvider) {
$stateProvider
.state('index', {
url: '/',
template: '<ion-view view-title="My Page">
...my home content...
</ion-view>'
})
.state('about', {
url: '/about',
templateUrl: 'about.html'//this template should use ion-view
});
});
<!-- The nav bar that will be updated as we
navigate →
<ion-nav-bar>
<ion-nav-back-button></ion-nav-back-button>
</ion-nav-bar>
<!-- where the initial view template will be
rendered -->
<ion-nav-view></ion-nav-view>
ion-views are cached by default
41. .controller(function($scope, $ionicActionSheet) {
$scope.show = function() {
// Show the action sheet
var hideSheet = $ionicActionSheet.show({
buttons: [
{ text: '<b>Share</b> This' },
],
cancelText: 'Cancel',
cancel: function() {},
buttonClicked: function(index) {return true;}
});
};
});
$ionicActionSheet
Ionic AngularJS elementshttp://ionicframework.com/docs/api/
show(options)
● buttons: [{text:””}]
● titleText: str
● cancelText: str
● destructiveText: str
● cancel: f()
● buttonClicked: f() return true to close ASheet
● destructiveButtonClicked: f() true to close
● cancelOnStateChange: f() cancel when navigate
● cssClass: str custom CSS class name
44. What is this doing
1. Install Gulp and gulp-sass
2. remove old CSS files from index.html
3. add Sass generated CSS files to index.html
4. add Sass to gulp startup tasks, so ionic serve command watch for Sass changes.
$ ionic setup sass
setup Sass
Sass integration
./scss/ionic.app.scss
where do you write your Sass