Top Banner
Building single page applications with Angular.js Dieter De Mesmaeker
34

Building single page applications with angular.js

May 09, 2015

Download

Technology

Short introduction to angular
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Building single page applications with angular.js

Building single page applications with Angular.js Dieter De Mesmaeker

Page 2: Building single page applications with angular.js

What is Angular Js?

Open source javascript framework

Single page applications

Created by Misko Hevery at Google

Heavy focus on testing

Augmented HTML

Page 3: Building single page applications with angular.js

Introduction

Page 4: Building single page applications with angular.js

Introduction

Page 5: Building single page applications with angular.js

Introduction

Page 6: Building single page applications with angular.js

Introduction

Page 7: Building single page applications with angular.js

Introduction

Page 8: Building single page applications with angular.js

MVC

Page 9: Building single page applications with angular.js

Concepts

Page 10: Building single page applications with angular.js

ControllersSet up the initial state of the $scope object

Page 11: Building single page applications with angular.js

ControllersAdd behaviour to a $scope object

Page 12: Building single page applications with angular.js

ControllersDo NOT use controllers for DOM manipulation or presentation logic! (use Directives instead)

Only business Logic!

Why? Testability!

Page 13: Building single page applications with angular.js

$scopeRefers to the application model

Glues the controller with its view

$scope inheritance

Page 14: Building single page applications with angular.js

$scope

Page 15: Building single page applications with angular.js

$scope

Page 16: Building single page applications with angular.js

$scopeWhy child scope for ng-repeat?

Page 17: Building single page applications with angular.js

ServicesView independent business logic

Page 18: Building single page applications with angular.js

ServicesView independent business logic

Page 19: Building single page applications with angular.js

ServicesFactory creates a single instance

Everything that is dependent on the service gets a reference to that instance

(Think of it as a singleton)

Page 20: Building single page applications with angular.js

DirectivesExtending HTML

DOM Manipulation

Page 21: Building single page applications with angular.js

Directives

Page 22: Building single page applications with angular.js

DirectivesMore useful example

Page 23: Building single page applications with angular.js

Directives

Page 24: Building single page applications with angular.js

Two-way data binding

src: http://www.slideshare.net/cloudvis/angularjs-framework

Page 25: Building single page applications with angular.js

Two-way data binding

src: http://www.slideshare.net/cloudvis/angularjs-framework

Page 26: Building single page applications with angular.js

Two-way data binding

Classical template systems Angular templates

Page 27: Building single page applications with angular.js

Dependency Injection

Page 28: Building single page applications with angular.js

Dependency Injection

Page 29: Building single page applications with angular.js

$location service

Navigating in Angular

Page 30: Building single page applications with angular.js

ng-Route

Page 31: Building single page applications with angular.js

Bootstrapping the Application

Page 32: Building single page applications with angular.js

Hands on

Yeoman

Grunt

Bower

Depends on Node.js

Page 33: Building single page applications with angular.js

Hands on

Step 1: Install node

http://lmgtfy.com/?q=install+node

Step 2: Install Yeoman

npm install -g yo

Page 34: Building single page applications with angular.js

Hands on

Install the angular-generator

https://github.com/yeoman/generator-angular