Comprehensive Angular 2 Review of Day 3

Similar documents
Angular 2 Programming

Angular 4 Training Course Content

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

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

Angular 2 and TypeScript Web Application Development

Angular 2 and TypeScript Web Application Development

3 Days Training Program

Financial. AngularJS. AngularJS.

Financial. AngularJS. AngularJS. Download Full Version :

AngularJS Fundamentals

FRONT END WEB. {< Course Details >}

CodeValue. C ollege. Prerequisites: Basic knowledge of web development and especially JavaScript.

Frontend Web Development with Angular. CC BY-NC-ND Carrot & Company GmbH

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

IN4MATX 133: User Interface Software

Full Stack Web Developer

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

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

Source. Developer Guide / forms

Ten interesting features of Google s Angular Project

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

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

Input and Validation. Mendel Rosenblum. CS142 Lecture Notes - Input

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

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

AngularJS AN INTRODUCTION. Introduction to the AngularJS framework

Lab 1 - Introduction to Angular

Single Page Applications using AngularJS

Advantages: simple, quick to get started, perfect for simple forms, don t need to know how form model objects work

Full Stack boot camp

Single Page Applications

Comprehensive AngularJS Programming (5 Days)

ANGULARJS INTERVIEW QUESTIONS

Ur/Web: A Simple Model for Programming the Web. Adam Chlipala MIT CSAIL POPL 2015 January 15, 2015

Modern and Responsive Mobile-enabled Web Applications

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

Chapter 1 - Model Driven Forms

STARCOUNTER. Technical Overview

All India Council For Research & Training

AngularJS Introduction

Oracle Fusion Middleware 11g: Build Applications with ADF I

Simple AngularJS thanks to Best Practices

Front End Nanodegree Syllabus

Full Stack Web Developer

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

Advanced Angular & Angular 6 Preview. Bibhas Bhattacharya

Interactive XML Visualization - using XSLT 2.0 on the Browser. Phil Fearon - Saxonica

JavaScript Specialist v2.0 Exam 1D0-735

Controller/server communication

Learn to Build Awesome Apps with Angular 2

Smashing Node.JS: JavaScript Everywhere

ANGULARJS - MOCK TEST ANGULARJS MOCK TEST II

Oracle Fusion Middleware 11g: Build Applications with ADF I

Comet and WebSocket Web Applications How to Scale Server-Side Event-Driven Scenarios

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

Creating Effective Websites using AngularJS

AngularJS Intro Homework

The DOM and jquery functions and selectors. Lesson 3


Controller/server communication

DOT NET Syllabus (6 Months)

Advanced React JS + Redux Development

Jquery.ajax Call Returns Status Code Of 200 But Fires Jquery Error

NODE.JS MOCK TEST NODE.JS MOCK TEST I

Oracle Application Express 5 New Features

Sample CS 142 Midterm Examination

Front-End Web Developer Nanodegree Syllabus

Web API Lab folder 07_webApi : webapi.jsp your testapijs.html testapijq.html that works functionally the same as the page testapidomjs.

Jim Jackson II Ian Gilman

INTRODUCTION TO.NET. Domain of.net D.N.A. Architecture One Tier Two Tier Three Tier N-Tier THE COMMON LANGUAGE RUNTIME (C.L.R.)

Frontend UI Training. Whats App :

I, J, K. Eclipse, 156

AngularJS. Beginner's guide - part 2

The course also includes an overview of some of the most popular frameworks that you will most likely encounter in your real work environments.

Front End Nanodegree Syllabus

PHPKB API Reference Guide

Nagaraju Bende

20480C: Programming in HTML5 with JavaScript and CSS3. Course Code: 20480C; Duration: 5 days; Instructor-led. JavaScript code.

MEAN Stack. 1. Introduction. 2. Foundation a. The Node.js framework b. Installing Node.js c. Using Node.js to execute scripts

Developing Web Applications Using ASP.NET Duration:56 Hours

APPLICATION INTERFACE

Offline-first PWA con Firebase y Vue.js

Index LICENSED PRODUCT NOT FOR RESALE

Etanova Enterprise Solutions

Mobile Applications 2013/2014

Building Backbone Plugins

Dynamic Web Development

Introduction Haim Michael. All Rights Reserved.

1 CS480W Quiz 6 Solution

A Closer Look at XPages in IBM Lotus Domino Designer 8.5 Ray Chan Advisory I/T Specialist Lotus, IBM Software Group

JavaScript Programming

CNIT 129S: Securing Web Applications. Ch 3: Web Application Technologies

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

Imagine for a moment

Ajax- XMLHttpResponse. Returns a value such as ArrayBuffer, Blob, Document, JavaScript object, or a DOMString, based on the value of

Building Offline Mobile Apps with Oracle JET and MCS

CS142 Winter 2017 Midterm Grading Solutions and Rubric

the web as it should be Martin Beeby

React & Redux in Hulu. (Morgan Cheng)

DreamFactory Security Guide

Transcription:

Form Validation: built in validators: added to template: required minlength maxlength pattern form state: state managed through NgModel classes: control has been visited: ng-touched or ng-untouched control s value has changed: ng-dirty or ng-pristine control s value is valid: ng-valid or ng-invalid validation messages: in component: have logic to determine validation state: errors for form errors for form element in template view: bind validation state logic to dom elements: error messages show only when there are errors to display validation styles: define styles for form state classes:.ng-valid{...style goes here } e.g..ng-invalid{border-left: 5px solid #a94442;} apply style: use ngclass directive in html Page 1 of 7

e.g. [ngclass]= seterrorclass(projectname) where the method in the component determines the correct style to apply based on state of DOM obejct Data Architecture: options for accessing data: Ajax Http Requests (XHR) WebSockets Indexdb LocalStorage Service workers etc implementation options: Angular s MVW Flux Observables/Reactive Programming etc. HTTP: setup: HTTP: import HttpModule provides API: Http oject: has HTTP methods, e.g. get: supports making calls to RESTful applications can take configuration object to set things like time-out Observables and Reactive Programming: import needed operators: import rxjs/rx //imports all Page 2 of 7

import rxjs/add/operator/map //imports map operator Promises: emit a single value code in services: use service to make Http calls and return a Promise object http.get(url).topromise.then(successmethod).catch(errormethod) calling topromise on Http method returns the Promise object the success method works with the Response object the error method uses the Promise object to call reject and port error message code in components: call service s function doing the http work and receive Promise object use Promise to handle output: promise.then(methodtosaveresult).catch(methodforerror) method to save result should copy the response to local variable method to handle error should set up error message for view Observables and Reactive Programming: Angular 2 comes with RxJS module RxJS = Observables + Operators +Schedulers Observables emit many values code in services: http.get(url).map(successmethod).catch(errormethod) httt.get returns an Observable call the methods of the observable: map: Emits the given constant value on the output Observable every time the source Observable emits a value. catch: Page 3 of 7

Catches errors on the observable to be handled by returning a new observable or throwing an error. code in components: call service s function doing the http work and receive Observable object use Observable to handle output: Observable.subscribe(methodToSaveResult, methodforerror) method to save result should copy the response to local variable method to handle error should set up error message for view Routing: single page applications challenges: browser records pages downloaded from the server 1 st page all other navigation is handled internally and supported y background server calls: history is not updated url is not updated navigating between sibbling root components requires support Router API: supports navigation adds to browser history updates url set up: have 2 or more root components: update default component view with links to other root component(s) configure router: set up Routes object: path + component default set with path + redirectto + pathmatch Page 4 of 7

export import to app module update root html to use the Router Directives: routerlinkactive: adds/removes classes from an HTML element when an associated routerlink contained on or inside the element becomes active/inactive RouterLink: Binds a clickable HTML element to a route Clicking the bound element triggers navigation. Router-outlet: Marks where the router should display a view navigation with parameters: route parameter: value is required for navigation, e.g. project id to get to the projects detail view html link with route parameter: [routerlink]= [ /projects, (project.id+1)]: where projects is a path in the routes and project.id is the required parameter query parameter: value is optional to the navigation, e.g. session id html link with query parameter: [routerlink]= [ /projects, (project.id+1), {testparam: test }] where testparam is an optional parameter implementing in code: html has DOM event bound to method: (click)= onnext(<route parameter>) component s onnext(..) method: call the navigate method of the router: this.router.navigate( <path>, <route parameter> ) reactive navigation: use case: Page 5 of 7

routes are defined as objects, injected into the app directly loading is independent from the Components themselves routes have Guards that run whenever the route tree passes through it: completely independent from which Component being loaded changes in url that do not actually change routes, i.e. only parameters changing from /user/1 to /user/2: these do nothing by default required to listen to these changes and trigger behaviour Routes, RouteParams, QueryParams, RouteData all are Observables that any Component can listen to more flexible and simpler: e.g. supports creation of things like a breadcrumb component, or anything more specific or unique can subscribe to navigation events: synchronously: retrieve the matrix parameters scoped to current route to obtain observable and subscribe to it let id = this.route.snapshot.params[<route param>]//snapshot is ActivatedRouteSnapshot this.http.get(this.projectsurl + id).map(this.extractdata).catch(this.handleerror); asynchronously: subscribe to the observable returned from from the ActivatedRoute.params this.route.params.subscribe( )//route is ActivatedRoute Location Strategies: HTML5 navigation / push state: default Page 6 of 7

<base href= / > e.g. http://localhoat/projects/edit1 update root HTML: and/or <script> document.write('<base href="' + document.location + '" />'); </script> HashLocationStrategy: hash mark style-guide.html e.g. http://localhoat/#projects/edit1 update routing configuration (app.routing.ts): RouterModule.forRoot(appRoutes,{useHash: true}); Page 7 of 7