INTRODUCTION TO IONIC 2

Similar documents
Angular 2 Programming

ANGULAR 2.X,4.X + TYPESRCIPT by Sindhu

Angular2. Bernhard Niedermayer. Software Development playing around with Angular2 since alpha.

Cross-Platform Mobile-Entwicklung mit dem Ionic Framework

Lab 1 - Introduction to Angular

Angular 4 Training Course Content

IN4MATX 133: User Interface Software

IONIC. The Missing SDK For Hybrid Apps. Mike

Front End. Presentation Layer. UI (User Interface) User <==> Data access layer

PHP WITH ANGULAR CURRICULUM. What you will Be Able to Achieve During This Course

Angular 4 Syllabus. Module 1: Introduction. Module 2: AngularJS to Angular 4. Module 3: Introduction to Typescript

The magic behind. Angular 2+

Sample Copy. Not For Distribution.

ANGULAR2 OVERVIEW. The Big Picture. Getting Started. Modules and Components. Declarative Template Syntax. Forms

Angular 2: What s new? Jonas Bandi, IvoryCode GmbH

International Research Journal of Engineering and Technology (IRJET) e-issn: Volume: 05 Issue: 05 May p-issn:

By the end of this Angular 6 tutorial, you'll learn by building a real world example application:

Upgrading to Ionic 3 APPENDIX D. Angular 4

IN4MATX 133: User Interface Software

Each class (which we will talk about in the next section) you see in an Ionic application will

One Framework. Angular

Catbook Workshop: Intro to NodeJS. Monde Duinkharjav

Frontend UI Training. Whats App :

"Charting the Course... Comprehensive Angular. Course Summary

IN4MATX 133: User Interface Software

Ten interesting features of Google s Angular Project

Stencil: The Time for Vanilla Web Components has Arrived

Software Architecture Documentation for the JRC MYGEOSS app for Invasive Species project

Comprehensive AngularJS Programming (5 Days)

An Introduction to TypeScript. Personal Info

Web Development for Dinosaurs An Introduction to Modern Web Development

Advance Mobile& Web Application development using Angular and Native Script

Chapter 1 - Development Setup of Angular

FRONT END WEB. {< Course Details >}

React + React Native. Based on material by Danilo Filgueira

Building Your own Widget with ArcGIS API for JavaScript

Introduction to. Angular. Prof. Dr.-Ing. Thomas Wiedemann.

Node.js. Node.js Overview. CS144: Web Applications

P a g e 1. Danish Technological Institute. Scripting and Web Languages Online Course k Scripting and Web Languages

AngularJS Intro Homework

React. HTML code is made up of tags. In the example below, <head> is an opening tag and </head> is the matching closing tag.

UI Course HTML: (Html, CSS, JavaScript, JQuery, Bootstrap, AngularJS) Introduction. The World Wide Web (WWW) and history of HTML

Getting started with Tabris.js Tutorial Ebook

Angular 2 and TypeScript Web Application Development

International Research Journal of Engineering and Technology (IRJET) e-issn: Volume: 05 Issue: 06 June p-issn:

Webpack 2 The last bundler you would need in Vijay Dharap, Principal Architect, Infosys

Integrating Angular with ASP.NET Core RESTful Services. Dan Wahlin

Demystifying Angular 2. SPAs for the Web of Tomorrow

<?php function preprocess_drupalcon($presentation) { if ($drupal && $ionic) { if ($ionic[ app ] = Megalomaniac ) { create $presentation } } }?

Default Parameters and Shapes. Lecture 18

Arjen de Blok. Senior Technical Consultant bij ICT Groep ( sinds 1995 Programmeren sinds 1990 Technologiën. Links

"Charting the Course... Comprehensive Angular 5. Course Summary

3 Days Training Program

Extending VMware vcloud Director User Interface Using Portal Extensibility Ticketing Example

welcome to BOILERCAMP HOW TO WEB DEV

Javascript. Many examples from Kyle Simpson: Scope and Closures

Advanced React JS + Redux Development

Ionic Tutorial. For Cross Platform Mobile Software Development

AngularJS Fundamentals

"Charting the Course... Comprehensive Angular 6 Course Summary

PHP + ANGULAR4 CURRICULUM 6 WEEKS

Course Outline. ProTech Professional Technical Services, Inc. Comprehensive Angular 7 Course Summary. Description

Full Stack boot camp

Learn Gulp. Jonathan Birkholz. This book is for sale at This version was published on

D3 + Angular JS = Visual Awesomesauce

Full Stack Web Developer

CREATE SASSY WEB PARTS. Developer Guide to SASS usage in SPFx

Index. Elad Elrom 2016 E. Elrom, Pro MEAN Stack Development, DOI /

Ionic CLI is the default and easiest way to work with ionic projects. In this tutorial we will learn the ins and outs of Ionic CLI.

AngularJS - Walkthrough

JavaScript CS 4640 Programming Languages for Web Applications

Tarek Elachkar, VP Customer Solutions - Jahia A real world story of Angular and Apache Unomi integration.

Introduction to TypeScript

UNIT -II. Language-History and Versions Introduction JavaScript in Perspective-

About Me. Name: Jonathan Brown. Job: Full Stack Web Developer. Experience: Almost 3 years of experience in WordPress development

Tim Roes. Android- & inovex in Karlsruhe. GDG Karlsruhe Co-Organizer.

Full Stack Web Developer

Programming Languages and Techniques (CIS120)

Introduction to the SharePoint Framework Bob German Principal Architect - BlueMetal. An Insight company

AngularJS Examples pdf

Brunch Documentation. Release Brunch team

Dreamweaver CS6. Table of Contents. Setting up a site in Dreamweaver! 2. Templates! 3. Using a Template! 3. Save the template! 4. Views!

ANGULARJS INTERVIEW QUESTIONS

Before proceeding with this tutorial, you should have a basic understanding of HTML, CSS, JavaScript, TypeScript, and Document Object Model (DOM).

What is AngularJS. à Javascript Framework à MVC à for Rich Web Application Development à by Google

iwebkit5 In this tutorial we wi! be picking up where we le# off in Part 1.

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications

Sebastiano

Designing the Home Page and Creating Additional Pages

Getting Started with ReactJS

WEBASSETS & DUKPY FREE YOURSELF FROM NODEJS. Alessandro amol

DNCMagazine. ANGULAR. Cheat Sheet

Decoupled Drupal with Angular

APACHE SLING & FRIENDS TECH MEETUP SEPTEMBER Integrating a Modern Frontend Setup with AEM Natalia Venditto, Netcentric

Angular 2 and TypeScript Web Application Development

widgetjs Documentation

Vue.js Developer friendly, Fast and Versatile

Learn to Build Awesome Apps with Angular 2

Topic 16: Validation. CITS3403 Agile Web Development. Express, Angular and Node, Chapter 11

Static Webpage Development

Transcription:

LECTURE 7 INTRODUCTION TO IONIC 2 DANIEL RYS JAN VÁCLAVÍK

OVERVIEW Create new Ionic2 application Why Ionic2 Project structure Features 2/95

INSTALL IONIC 2 & CREATE NEW APPLICATION $ npm install -g ionic@beta $ ionic start my-first-ionic2-app [tabs sidemenu blank] --v2 [--ts] $ ionic serve 3/95

INSTALL IONIC 2 & CREATE NEW APPLICATION Ionic version 2 $ npm install -g ionic@beta $ ionic start my-first-ionic2-app [tabs sidemenu blank] --v2 [--ts] $ ionic serve 4/95

INSTALL IONIC 2 & CREATE NEW APPLICATION Create TypeScript project Ionic version 2 $ npm install -g ionic@beta $ ionic start my-first-ionic2-app [tabs sidemenu blank] --v2 [--ts] $ ionic serve 5/95

WHY IONIC2 Component-based model Angular2 ES6 / TypeScript (transpiling) Windows 10 support, Android Material Design Generator Better theming & performance More scalable structure 6/95

/95

I can do all this through him who gives me strength Philippians 4:13 /95

ECMASCRIPT 6 / TYPESCRIPT Classes (OOP) Fat arrow (=>) Promises Components (modules) Block scoping 9/95

CLASSES Mapping real world object into the abstract class Shape { constructor (id, x, y) { this.id = id this.move(x, y) move (x, y) { this.x = x this.y = y 10/95

CLASSES Mapping real world object into the abstract class Shape { constructor (id, x, y) { this.id = id this.move(x, y) move (x, y) { this.x = x this.y = y Constructor is called when creating instance of class 11/95

FAT ARROW FUNCTIONS somefunction(function(response){ console.log(response); ); 12/95

FAT ARROW FUNCTIONS Has local context somefunction(function(response){ console.log(response); ); 13/95

FAT ARROW FUNCTIONS Has local context somefunction(function(response){ console.log(response); ); somefunction((response) => { console.log(response); ); 14/95

FAT ARROW FUNCTIONS Has local context somefunction(function(response){ console.log(response); ); somefunction((response) => { console.log(response); ); Has parent context 15/95

PROMISES dosomething().then((response) => { console.log(response); ); For more details see Lecture 5 16/95

IMPORT & EXPORT COMPONENTS // lib/math.js export function sum (x, y) {return x + y export var pi = 3.141593 // someapp.js import * as math from "lib/math" console.log("2pi = " + math.sum(math.pi, math.pi)) // otherapp.js import {sum, pi from "lib/math" console.log("2pi = " + sum(pi, pi)) 17/95

IMPORT & EXPORT COMPONENTS // lib/math.js export function sum (x, y) {return x + y export var pi = 3.141593 // someapp.js import * as math from "lib/math" console.log("2pi = " + math.sum(math.pi, math.pi)) Specify visible functions, vars // otherapp.js import {sum, pi from "lib/math" console.log("2pi = " + sum(pi, pi)) 18/95

IMPORT & EXPORT COMPONENTS // lib/math.js export function sum (x, y) {return x + y export var pi = 3.141593 // someapp.js import * as math from "lib/math" console.log("2pi = " + math.sum(math.pi, math.pi)) Specify visible functions, vars // otherapp.js import {sum, pi from "lib/math" console.log("2pi = " + sum(pi, pi)) Can call functions from components 19/95

IMPORT & EXPORT COMPONENTS // lib/math.js export function sum (x, y) {return x + y export var pi = 3.141593 // someapp.js import * as math from "lib/math" console.log("2pi = " + math.sum(math.pi, math.pi)) Specify visible functions, vars // otherapp.js import {sum, pi from "lib/math" console.log("2pi = " + sum(pi, pi)) Can call functions from components 20/95

IMPORT & EXPORT COMPONENTS IN IONIC2 import {Page from 'ionic-angular'; import {MoviesPage from '../movies/movies'; 21/95

IMPORT & EXPORT COMPONENTS IN IONIC2 Import from Ionic import {Page from 'ionic-angular'; import {MoviesPage from '../movies/movies'; 22/95

BLOCK SCOPING for (let i = 0; i < movies.length; i++) { let x = movies[i]; console.log(x); 23/95

BLOCK SCOPING for (let i = 0; i < movies.length; i++) { let x = movies[i]; console.log(x); // Undefined 24/95

TYPESCRIPT EXAMPLE function add(x : number, y : number) : number { return x + y; add('a', 'b'); 25/95

TYPESCRIPT EXAMPLE function add(x : number, y : number) : number { return x + y; add('a', 'b'); // Compiler error 26/95

DEPENDENCY INJECTION 27/95

DEPENDENCY INJECTION import {Page, NavController, Platform from 'ionic-angular'; @Page({ templateurl: 'build/pages/movies/movies.html' ) export class MoviesPage { static get parameters() { return [[NavController], [Platform]]; constructor(nav, platform) { this.nav = nav; this.platform = platform; 28/95

DEPENDENCY INJECTION import {Page, NavController, Platform from 'ionic-angular'; @Page({ templateurl: 'build/pages/movies/movies.html' ) export class MoviesPage { static get parameters() { return [[NavController], [Platform]]; constructor(nav, platform) { this.nav = nav; this.platform = platform; Constructor is function called when new instance is created 29/95

DEPENDENCY INJECTION import {Page, NavController, Platform from 'ionic-angular'; @Page({ templateurl: 'build/pages/movies/movies.html' ) export class MoviesPage { static get parameters() { return [[NavController], [Platform]]; constructor(nav, platform) { this.nav = nav; this.platform = platform; Inject components to constructor Constructor is function called when new instance is created 30/95

BINDING 31/95

BINDING <input [value]="name"> 32/95

BINDING One-way data binding [] <input [value]="name"> 33/95

BINDING One-way data binding [] <input [value]="name"> <button (click)="somefunction($event)"></button> 34/95

BINDING One-way data binding [] <input [value]="name"> <button (click)="somefunction($event)"></button> Call function on event () 35/95

BINDING One-way data binding [] <input [value]="name"> <button (click)="somefunction($event)"></button> Call function on event () <input [value]="name" (input)="name = $event.target.value"> 36/95

BINDING One-way data binding [] <input [value]="name"> <button (click)="somefunction($event)"></button> Call function on event () <input [value]="name" (input)="name = $event.target.value"> <!-- or --> <input [(ngmodel)]="name"> 37/95

BINDING One-way data binding [] <input [value]="name"> <button (click)="somefunction($event)"></button> Call function on event () <input [value]="name" (input)="name = $event.target.value"> <!-- or --> <input [(ngmodel)]="name"> Two-way data binding [()] 38/95

RENDERING <p>hello my name is {{name and I like {{thing.</p> 39/95

RENDERING <p>hello my name is {{name and I like {{thing.</p> The same as in Angular1 40/95

CREATE LOCAL VARIABLE <p #myparagraph></p> <button (click)="myparagraph.innerhtml = 'Fill element with something...'"> 41/95

CREATE LOCAL VARIABLE # means variable <p #myparagraph></p> <button (click)="myparagraph.innerhtml = 'Fill element with something...'"> 42/95

DECORATORS Metadata and info about classes Directly above class definition Starts with @ 43/95

DECORATOR TYPES @App Declare class for root component in Angular2 @Component Separately usable element (template, style, logic) @Page Ionic-specific component @Directive Modify behavior of existing component @Injectable Inject to constructor, for creating services @Pipe similar with filter in Angular1 44/95

DECORATOR EXAMPLE import {Page, NavController, Platform from ionic-angular'; @Page({ templateurl: 'build/pages/movies/movies.html' ) export class MoviesPage {... 45/95

DECORATOR EXAMPLE import {Page, NavController, Platform from ionic-angular'; @Page({ templateurl: 'build/pages/movies/movies.html' ) export class MoviesPage {... Decorator for Ionic2 page 46/95

DECORATOR EXAMPLE import {Page, NavController, Platform from ionic-angular'; @Page({ templateurl: 'build/pages/movies/movies.html' ) export class MoviesPage {... Object with metadata, contains template URL for specific page Decorator for Ionic2 page 47/95

DIRECTIVES Modify behavior of existing component <section *ngif="showsection"></section> <li *ngfor="#item of items"></li> 48/95

DIRECTIVES Modify behavior of existing component <section *ngif="showsection"></section> <li *ngfor="#item of items"></li> Array/Object iterator, the same as ng-repeat from Angular1 49/95

DIRECTIVES Modify behavior of existing component <section *ngif="showsection"></section> <li *ngfor="#item of items"></li> Remember #? Array/Object iterator, the same as ng-repeat from Angular1 50/95

DIRECTIVES Modify behavior of existing component * Syntactic sugar for <template> <section *ngif="showsection"></section> <li *ngfor="#item of items"></li> Remember #? Array/Object iterator, the same as ng-repeat from Angular1 51/95

TEMPLATE ELEMENT, * <template> rendered when script is running * is embedded template You can work with HTML elements like with <template> 52/95

LOOPING <ion-list> <ion-item *ngfor="#movie of movies" (click)="viewmovie(movie)"> <h2>{{movie.title</h2> <p>{{movie.rating / 10</p> </ion-item> </ion-list> 53/95

IONIC2 PROJECT STRUCTURE!"" app #!"" app.js #!"" pages # #!"" page1 # # #!"" page1.html # # #!"" page1.js # # # $"" page1.scss # #!"" page2 # #!"" page3 # # $"" tabs # $"" theme #!"" app.core.scss #!"" app.ios.scss #!"" app.md.scss #!"" app.variables.scss # $"" app.wp.scss!"" config.xml!"" gulpfile.js!"" hooks!"" ionic.config.js!"" ionic.config.json!"" node_modules!"" package.json!"" platforms!"" plugins!"" resources $"" www $"" index.html 54/95

IONIC2 PROJECT STRUCTURE Do not edit code in WWW directory except index.html! Except resources and index.html, everything in www directory is generated automatically from app directory! 55/95

IONIC2 GENERATOR 56/95

IONIC2 GENERATOR We don t need to create and include files manually! Use Ionic Generator, you will love it $ ionic g [page component directive pipe provider tabs] some-name 57/95

CREATE COMPONENT $ ionic g component my-component app/components/my-component/my-component.js import {Component from 'angular2/core'; import {IONIC_DIRECTIVES from 'ionic-angular'; @Component({ selector: 'my-component', templateurl: 'build/components/my-component/my-component.html', directives: [IONIC_DIRECTIVES] ) export class MyComponent { constructor() { this.text = 'Hello World'; 58/95

CREATE COMPONENT $ ionic g component my-component app/components/my-component/my-component.js import {Component from 'angular2/core'; import {IONIC_DIRECTIVES from 'ionic-angular'; @Component({ selector: 'my-component', templateurl: 'build/components/my-component/my-component.html', directives: [IONIC_DIRECTIVES] ) export class MyComponent { constructor() { this.text = 'Hello World'; Decorator for component 59/95

CREATE PAGE $ ionic g page my-page app/pages/my-page/my-page.js import {Page, NavController from 'ionic-angular'; @Page({ templateurl: 'build/pages/my-page/my-page.html', ) export class MyPagePage { static get parameters() { return [[NavController]]; constructor(nav) { this.nav = nav; 60/95

CREATE PAGE $ ionic g page my-page app/pages/my-page/my-page.js import {Page, NavController from 'ionic-angular'; @Page({ templateurl: 'build/pages/my-page/my-page.html', ) export class MyPagePage { static get parameters() { return [[NavController]]; constructor(nav) { this.nav = nav; Create bundle with JS + HTML + SASS 61/95

CREATE DIRECTIVE $ ionic g directive my-super-directive app/components/my-super-directive/my-super-directive.js import {Directive from 'angular2/core'; @Directive({ selector: '[my-super-directive]' // Attribute selector ) export class MySuperDirective { constructor() { console.log('hello World'); 62/95

CREATE PIPE $ ionic g pipe my-old-pipes app/pipes/my-old-pipes.js import {Injectable, Pipe from 'angular2/core'; @Pipe({ name: 'my-old-pipes' ) @Injectable() export class MyOldPipes { transform(value, args) { value = value + ''; // make sure it's a string return value.tolowercase(); 63/95

CREATE PROVIDER $ ionic g provider my-provider app/providers/my-provider/my-provider.js import {Injectable from 'angular2/core'; import {Http from 'angular2/http'; import 'rxjs/add/operator/map'; @Injectable() export class MyProvider { static get parameters(){ return [[Http]] constructor(http) { this.http = http; this.data = null; load() { if (this.data) return Promise.resolve(this.data); return new Promise(resolve => { this.http.get('path/to/data.json').map(res => res.json()).subscribe(data => { this.data = data; resolve(this.data); ); ); 64/95

CONDITIONALS 65/95

CONDITIONALS <div *ngif="someboolean">hello 1</div> 66/95

CONDITIONALS <div *ngif="someboolean">hello 1</div> <div [ngswitch]="somevalues"> <p *ngswitchwhen="1">paragraph 1</p> <p *ngswitchwhen="2">paragraph 2</p> <p *ngswitchwhen="3">paragraph 3</p> <p *ngswitchdefault>paragraph</p> </div> 67/95

CONDITIONALS <div *ngif="someboolean">hello 1</div> <div [ngswitch]="somevalues"> <p *ngswitchwhen="1">paragraph 1</p> <p *ngswitchwhen="2">paragraph 2</p> <p *ngswitchwhen="3">paragraph 3</p> <p *ngswitchdefault>paragraph</p> </div> <div [hidden]="someboolean">hello 2</div> 68/95

CONDITIONALS <div *ngif="someboolean">hello 1</div> <div [ngswitch]="somevalues"> <p *ngswitchwhen="1">paragraph 1</p> <p *ngswitchwhen="2">paragraph 2</p> <p *ngswitchwhen="3">paragraph 3</p> <p *ngswitchdefault>paragraph</p> </div> <div [hidden]="someboolean">hello 2</div> <div [class.my-custom-class]="someboolean">hello 3</div> 69/95

NAVIGATION 70/95

NAVIGATION Pop and push to history stack push(somepage) add to the top of stack pop() delete last page from the stack 71/95

NAVIGATION EXAMPLE 72/95

NAVIGATION EXAMPLE app/pages/movies/movies.html <ion-navbar *navbar> <ion-title>movies</ion-title> </ion-navbar> <ion-content padding class="movies"> <button class="positive" (click)="showdetail()"> Go to detail </button> </ion-content> 73/95

NAVIGATION EXAMPLE app/pages/movies/movies.html <ion-navbar *navbar> <ion-title>movies</ion-title> </ion-navbar> <ion-content padding class="movies"> <button class="positive" (click)="showdetail()"> Go to detail </button> </ion-content> Call method for showing another page 74/95

NAVIGATION EXAMPLE app/pages/movie-detail/movie-detail.html <ion-navbar *navbar> <ion-title>movie-detail</ion-title> </ion-navbar> <ion-content padding class="movie-detail"> <button class="positive" (click)="goback()"> Go back </button> </ion-content> 75/95

NAVIGATION EXAMPLE app/pages/movie-detail/movie-detail.html <ion-navbar *navbar> <ion-title>movie-detail</ion-title> </ion-navbar> <ion-content padding class="movie-detail"> <button class="positive" (click)="goback()"> Go back </button> </ion-content> Call method for going back 76/95

NAVIGATION GO TO PAGE app/pages/movies/movies.js import {Page, NavController from 'ionic-angular'; import {MovieDetailPage from '../movie-detail/movie-detail' @Page({ templateurl: 'build/pages/movies/movies.html', ) export class MoviesPage { static get parameters() { return [[NavController]]; constructor(nav) { this.nav = nav; showdetail() { this.nav.push(moviedetailpage) 77/95

NAVIGATION GO TO PAGE app/pages/movies/movies.js Import import {Page, NavController from 'ionic-angular'; import {MovieDetailPage from '../movie-detail/movie-detail' @Page({ templateurl: 'build/pages/movies/movies.html', ) export class MoviesPage { static get parameters() { return [[NavController]]; constructor(nav) { this.nav = nav; showdetail() { this.nav.push(moviedetailpage) 78/95

NAVIGATION GO TO PAGE app/pages/movies/movies.js Import import {Page, NavController from 'ionic-angular'; import {MovieDetailPage from '../movie-detail/movie-detail' @Page({ templateurl: 'build/pages/movies/movies.html', ) export class MoviesPage { static get parameters() { return [[NavController]]; constructor(nav) { this.nav = nav; Dependency injection showdetail() { this.nav.push(moviedetailpage) 79/95

NAVIGATION GO TO PAGE app/pages/movies/movies.js Import import {Page, NavController from 'ionic-angular'; import {MovieDetailPage from '../movie-detail/movie-detail' @Page({ templateurl: 'build/pages/movies/movies.html', ) export class MoviesPage { static get parameters() { return [[NavController]]; Dependency injection constructor(nav) { this.nav = nav; Save as class variable showdetail() { this.nav.push(moviedetailpage) 80/95

NAVIGATION GO TO PAGE app/pages/movies/movies.js Import import {Page, NavController from 'ionic-angular'; import {MovieDetailPage from '../movie-detail/movie-detail' @Page({ templateurl: 'build/pages/movies/movies.html', ) export class MoviesPage { static get parameters() { return [[NavController]]; Dependency injection constructor(nav) { this.nav = nav; showdetail() { this.nav.push(moviedetailpage) Save as class variable Push MovieDetailPage to the stack 81/95

NAVIGATION GO TO PAGE app/pages/movies/movies.js Import import {Page, NavController from 'ionic-angular'; import {MovieDetailPage from '../movie-detail/movie-detail' @Page({ templateurl: 'build/pages/movies/movies.html', ) export class MoviesPage { static get parameters() { return [[NavController]]; Dependency injection constructor(nav) { this.nav = nav; showdetail() { this.nav.push(moviedetailpage) Save as class variable Push MovieDetailPage to the stack 82/95

NAVIGATION GO BACK app/pages/movie-detail/movie-detail.js import {Page, NavController from 'ionic-angular'; @Page({ templateurl: 'build/pages/movie-detail/movie-detail.html', ) export class MovieDetailPage { static get parameters() { return [[NavController]]; constructor(nav) { this.nav = nav; goback() { this.nav.pop() 83/95

NAVIGATION GO BACK app/pages/movie-detail/movie-detail.js import {Page, NavController from 'ionic-angular'; @Page({ templateurl: 'build/pages/movie-detail/movie-detail.html', ) export class MovieDetailPage { static get parameters() { return [[NavController]]; constructor(nav) { this.nav = nav; goback() { this.nav.pop() Pop last page from the stack 84/95

NAVIGATION GO TO PAGE WITH PASSING PARAMS import {Page, NavController from 'ionic-angular'; import {MovieDetailPage from '../movie-detail/movie-detail' @Page({ templateurl: 'build/pages/movies/movies.html', ) export class MoviesPage { static get parameters() { return [[NavController]]; constructor(nav) { this.nav = nav; showdetail() { this.nav.push(moviedetailpage, { id: 4 ) 85/95

NAVIGATION GO TO PAGE WITH PASSING PARAMS import {Page, NavController from 'ionic-angular'; import {MovieDetailPage from '../movie-detail/movie-detail' @Page({ templateurl: 'build/pages/movies/movies.html', ) export class MoviesPage { static get parameters() { return [[NavController]]; constructor(nav) { this.nav = nav; showdetail() { this.nav.push(moviedetailpage, { id: 4 ) Second parameter is an object with params 86/95

NAVIGATION GET PARAMS import {Page, NavController, NavParams from 'ionic-angular'; @Page({ templateurl: 'build/pages/movie-detail/movie-detail.html', ) export class MovieDetailPage { static get parameters() { return [[NavController], [NavParams]]; constructor(nav, params) { this.nav = nav; this.params = params; console.log("id: " + this.params.get("id")); goback() { this.nav.pop(); 87/95

NAVIGATION GET PARAMS import {Page, NavController, NavParams from 'ionic-angular'; @Page({ templateurl: 'build/pages/movie-detail/movie-detail.html', ) export class MovieDetailPage { static get parameters() { return [[NavController], [NavParams]]; constructor(nav, params) { this.nav = nav; this.params = params; console.log("id: " + this.params.get("id")); Import goback() { this.nav.pop(); 88/95

NAVIGATION GET PARAMS import {Page, NavController, NavParams from 'ionic-angular'; @Page({ templateurl: 'build/pages/movie-detail/movie-detail.html', ) export class MovieDetailPage { static get parameters() { return [[NavController], [NavParams]]; constructor(nav, params) { this.nav = nav; this.params = params; console.log("id: " + this.params.get("id")); Import Dependency injection goback() { this.nav.pop(); 89/95

NAVIGATION GET PARAMS import {Page, NavController, NavParams from 'ionic-angular'; @Page({ templateurl: 'build/pages/movie-detail/movie-detail.html', ) export class MovieDetailPage { static get parameters() { return [[NavController], [NavParams]]; constructor(nav, params) { this.nav = nav; this.params = params; console.log("id: " + this.params.get("id")); Import Dependency injection goback() { this.nav.pop(); Save as class variable 90/95

NAVIGATION GET PARAMS import {Page, NavController, NavParams from 'ionic-angular'; @Page({ templateurl: 'build/pages/movie-detail/movie-detail.html', ) export class MovieDetailPage { static get parameters() { return [[NavController], [NavParams]]; constructor(nav, params) { this.nav = nav; this.params = params; console.log("id: " + this.params.get("id")); Import Dependency injection goback() { this.nav.pop(); Get ID from params Save as class variable 91/95

92/95

WORK ON PROJECTS! 93/95

QUESTIONS? 94/95

JAN VÁCLAVÍK @janvaclavik DANIEL RYS @danielrys WWW.USERTECHNOLOGIES.COM 95/95