Download - Angular js fundamentals

Transcript
Page 1: Angular js fundamentals

FundamentalsWhat HTML would have been if it were designed

for web apps. - Mishko

Page 2: Angular js fundamentals

Rosina Bignall

Service Dog Zaakirhttp://tamarr.org

Blog: http://rosinabignall.comTwitter: rosinabignall

JoindIn: https://joind.in/11607

Slides: http://goo.gl/WHHtFeCode: http://goo.gl/PF8Bmd

Page 3: Angular js fundamentals

What is ...

Page 4: Angular js fundamentals
Page 5: Angular js fundamentals

Website

vs.

Web Application

Page 6: Angular js fundamentals

Why ...

Page 7: Angular js fundamentals
Page 8: Angular js fundamentals
Page 9: Angular js fundamentals

SIMPLIFY

your

Code

Templating

Routing

Data Binding

Page 10: Angular js fundamentals

Data Binding

Page 11: Angular js fundamentals

Two-Way Data Binding

Page 12: Angular js fundamentals

Benefits of ...

Page 13: Angular js fundamentals

Separation of Concerns

UI Code Declarative

Application Code Imperative

Create a Rich Intuitive User Experience

Testable!

Page 14: Angular js fundamentals

Let’sBuild AnApp

Page 15: Angular js fundamentals
Page 16: Angular js fundamentals

Requirements➔ Provide and edit a name for the ranch➔ Show all the animals on the ranch

◆ Load from server◆ Show the gender name for the type of animal based

on species, gender and age

➔ Search the animals on the ranch

Page 17: Angular js fundamentals

Static HTML

Page 18: Angular js fundamentals

Add the Angular script

Step 2 - Angularize

Bootstrap Angular

Page 19: Angular js fundamentals

Step 3 - Editable Ranch Name

Page 20: Angular js fundamentals

Step 4 - Simplify the HTML

Page 21: Angular js fundamentals

ng-includepartials/header.html

index.html

Page 22: Angular js fundamentals

Directives

Page 23: Angular js fundamentals

app.js

index.html

Page 24: Angular js fundamentals

animal/animal-directive.js

Page 25: Angular js fundamentals

animal/animal-template.html

index.html

Page 26: Angular js fundamentals

Load from Server ...

On to Function...

Search...

Filters...

Page 27: Angular js fundamentals

Step 5 - Services and ng-repeat

Page 28: Angular js fundamentals

animal/animal-service.js

app.js

Page 29: Angular js fundamentals

animal/animal-controller.js

index.html

Page 30: Angular js fundamentals

index.html

Page 31: Angular js fundamentals

Step 6: Searchingindex.html

Page 32: Angular js fundamentals

Step 7: Show gender namesHorse:

Female Male Altered (M)

> 3 years Mare Stallion Gelding

< 3 years Filly Colt Gelding

Dog:Female Male

Unaltered Bitch Stud

Altered Spayed Female Neutered Male

Chicken:

Female Male Altered (M)

> 1 years Hen Rooster Capon

< 1 years Pullet Cockerel Capon

Page 33: Angular js fundamentals

animal/animal-template.html

animal/genderName-filter.js

Page 34: Angular js fundamentals

Step 8: Track other stuff tooindex.html

app.js

partials/menu.html

Page 35: Angular js fundamentals

app.js

Page 36: Angular js fundamentals

equipment/equipment-list.html task/task-list.html

equipment/equipment-controller.js task/task-controller.js

Page 37: Angular js fundamentals

animal/animal-list.html

Page 38: Angular js fundamentals

index.html

Page 39: Angular js fundamentals

Simple HTML page -> Dynamic HTML page

Angular ConceptsScope variables ($scope)

Use <input> with ng-model

Include templates with ng-include

Create a directive (new HTML element)

Loaded data from the server - ngResource

ng-repeat - loop through an array

search by applying a filter to ng-repeat

Create a custom filter

Extended our application with new modulesLinked all the parts of it with ngRoute

Page 40: Angular js fundamentals

Resources● Angular Website:

http://angularjs.org● Code School: Shaping up with AngularJS

https://www.codeschool.com/courses/shaping-up-with-angular-js● Yeoman Angular Generator:

https://github.com/yeoman/generator-angular● Angular Best Practices: http://blog.angularjs.org/2014/02/an-angularjs-

style-guide-and-best.html● Angular-UI:

https://angular-ui.github.io/

Page 41: Angular js fundamentals

Rosina Bignalland

Zaakir

Twitter: rosinabignall

Slideshttp://goo.gl/WHHtFe

Codehttp://goo.gl/PF8Bmd

Feedback please!https://joind.in/11607