quick and beautiful apps in angular - smart data · cross platform web use modern web platform...

26
Quick and Beautiful Apps in Angular Lunch and Learn

Upload: others

Post on 04-Jun-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

Quick and Beautiful Apps in Angular

Lunch and Learn

Page 2: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

Who am I?

➲ Rodney Kendall● Senior Full-Stack Development Guru

➲ ~30 Years (already???) experience➲ .Net, SQL, Javascript, Angular, you name it,

I've probably at least dabbled in it.➲ [email protected]➲ https://www.linkedin.com/in/rodneyk

Page 3: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

What are we doing today?

➲ Learn how to create a cool app in Angular➲ See how easy it is, with just a little “coding”➲ Should have some idea of Javascript● No problem if you don't, we'll walk through it!

➲ See some cool coding standards and easy to read code

➲ See how easy it is to make this app

REALLY COOL (not just COOL)

Page 4: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

What is Angular?

➲ https://angular.io/➲ Framework for mobile and desktop

development● User interface and integration all in one

➲ Easy to use, and easy to reuse➲ Everything you need for a great user

experience with Angular Material!➲ Uses Typescript➲ Not AngularJS (that's 'old school')

Note: Angular features at https://angular.io/features

Page 5: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

Cross Platform

➲ Web● Use modern web platform capabilities to deliver app-like

experiences. High performance, offline, and zero-step installation.

➲ Native● Build native mobile apps with strategies from Cordova,

Ionic, or NativeScript.➲ Desktop● Create desktop-installed apps across Mac, Windows, and

Linux using the same Angular methods you've learned for the web plus the ability to access native OS APIs.

➲ All in ONE!

Page 6: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

Speed and Performance➲ Code Generation● Angular turns your templates into code that's highly

optimized for today's JavaScript virtual machines, giving you all the benefits of hand-written code with the productivity of a framework.

➲ Universal● Serve the first view of your application on Node.js, .NET,

PHP, and other servers for near-instant rendering in just HTML and CSS. Also paves the way for sites that optimize for SEO (Search Engine Optimization).

➲ Code Splitting● Angular apps load quickly with the new Component

Router, which delivers automatic code-splitting so users only load code required to render the view they request.

Page 7: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

Productivity

➲ Templates● Quickly create UI views with simple and powerful

template syntax.➲ Angular CLI (Command-Line Interface)● Command line tools: start building fast, add components

and tests, then instantly deploy.➲ IDEs (Integrated Development Environments)● Get intelligent code completion, instant errors, and other

feedback in popular editors and IDEs.

Page 8: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

Full Development Story

➲ Testing● With Karma for unit tests, you can know if you've broken

things every time you save, and Protractor makes your scenario tests run faster and in a stable manner.

➲ Animation● Create high-performance, complex choreographies and

animation timelines with very little code through Angular's intuitive API.

➲ Accessibility● Create accessible applications with ARIA-enabled

components, developer guides, and built-in a11y (numeronym (cool word of the day!) for 'accessibility') test infrastructure.

Page 9: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

Why Angular Material?

➲ Ease of use➲ Modern UI appearance➲ Eye-popping built-in features➲ Works great across the web, mobile, and

desktop➲ FAST!➲ “Themeable” – make it your own➲ Angular's friend

Page 10: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

Let's make an App!

➲ Use news API at http://newsapi.org ● Free for developers!

➲ Goals:● Make it look good● Search the headlines by keyword● Limit the sources to search● Easy for us and the user

Page 11: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

Take a look!100%

Awesome!

Page 12: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

Installation*** Only needed one time ***

➲ Node.js from https://nodejs.org● LTS version recommended

➲ Angular● npm install -g @angular/core● npm install -g @angular/cli

➲ Verify the install● 'node -v', 'npm -v', and 'ng v'

Page 13: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

Create the base automatically

➲ ng new news-reader➲ cd news-reader➲ What do we have so far? QUICK DEMO!➲ ng serve➲ http://localhost:4200

Page 14: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

Add Angular Material

➲ ng add @angular/material➲ What did that do?● Added references in 'package.json'● Add import information to app.module.ts● Changed other files, too

➲ Let's take a look!➲ ng serve➲ http://localhost:4200

Page 15: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

Setup News Feed

➲ https://newsapi.org● Get API Key

Page 16: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

Styles.css

Page 17: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

Angular.json

"styles": ["./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css","src/styles.css"],

Page 18: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

Manual changes app.module.ts (Not 100% automatic, but close!)

Page 19: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

Create the Service (The Food)

➲ Service: Way to get data from anywhere➲ ng g service news➲ On to coding!

Page 20: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step
Page 21: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

Source.ts (What's this?)

Page 22: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

App.component.ts (The Brain)

Page 23: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

App.component.html (The Face)

Page 24: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

App.component.css (The Makeup)ALMOST DONE!

Page 25: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

Icons

➲ Source: https://newsapi.org/sources● Lookup each from the news site and download the icons,

one-by-one

➲ Put them: src/assets/sources

➲ Great news! I already did this part...

➲ Time to see what we made!

Page 26: Quick and Beautiful Apps in Angular - Smart Data · Cross Platform Web Use modern web platform capabilities to deliver app-like experiences. High performance, offline, and zero-step

What's next?

➲ Add comments➲ Add likes (and maybe dislikes?)➲ Change the color scheme➲ Other ideas?