27
g AngularJS By Nishikant Taksande NetPay Merchant Services

AngularJS - Part 1

Embed Size (px)

Citation preview

Page 1: AngularJS - Part 1

gAngularJS

ByNishikant Taksande

NetPay Merchant Services

Page 2: AngularJS - Part 1
Page 3: AngularJS - Part 1

TemplateSERVICE

MODULE

Injector

Dependency Injection

CONTROLLERData Binding

View

Filter

Compiler

ExpressionsScope ModelDirectives

?

Page 4: AngularJS - Part 1
Page 5: AngularJS - Part 1

The Principles

Boilerplate

D.R.Y. Structure Testability

Source: google I/O

Page 6: AngularJS - Part 1

DatabaseRAM

<div>

<span> <ul>

<li><li><li>

Where does it fits in?

Source: google I/O

Page 7: AngularJS - Part 1

How it works?

AngularJS will initialize when DOM content is loaded

ng-app

Page 8: AngularJS - Part 1

Conceptual Overview

TEMPLATE

DIRECTIVES

MODEL

SCOPE

EXPRESSIONS COMPILER

VIEW FILTER

DATA BINDING CONTROLLER

MODULE SERVICE

Page 9: AngularJS - Part 1

Kick Start

DIRECTIVES FILTERS DATA BINDING

Page 10: AngularJS - Part 1

What are directives ?

They teach HTML new trick!

Page 11: AngularJS - Part 1

Using DirectivesDirective

Directive

Page 12: AngularJS - Part 1

Using Directives …

Page 13: AngularJS - Part 1

Using Filters

Page 14: AngularJS - Part 1

RAM

{{ databinding }}

Logic

<div>

<span> <ul>

<li><li><li>

Page 15: AngularJS - Part 1

ManagesNotifies

Observes

Logic / Controller(JS Classes)

UI / View(DOM) RAM Data / Model

<div>

<span> <ul>

<li>

Structure

Page 16: AngularJS - Part 1

Model

View

var firstName = “john”

<h1>john</h1>

controller, viewModel

MVC

Page 17: AngularJS - Part 1

View, Controller and Scope

VIEW CONTROLLER SCOPE

Page 18: AngularJS - Part 1

View, Controller and Scope…

VIEW CONTROLLER$scope

$scope is the glue between a controller and a view

Page 19: AngularJS - Part 1

View, Controller and Scope…

$scope injected dynamically

Page 20: AngularJS - Part 1

Module, Routes and Factories

MODULE ROUTES FACTORIES

Page 21: AngularJS - Part 1

MODULE

CONFIG

ROUTES

VIEW CONTROLLER$scope

*FACTORIESDIRECTIVES

Page 22: AngularJS - Part 1

Module and container<html ng-app="sampleApp">

MODULE

CONFIG FILTER DIRECTIVE FACTORY CONTROLLER

ROUTES

SERVICE

PROVIDER

Page 23: AngularJS - Part 1

Creating Module

var sampleApp = angular.module('sampleApp', []);

What it is for?This is where dependency

injection comes in

var sampleApp = angular.module('sampleApp', [‘helperApp’]);

sampleApp depends on helperApp module

Page 24: AngularJS - Part 1

Creating Controller in ModuleCreating Module

Creating Controller

Page 25: AngularJS - Part 1

Role of Routes

VIEW #1 VIEW #2

VIEW #3VIEW #4

/view1

/view2

/view3

/view4

Page 26: AngularJS - Part 1

Routes Dependency

Define Module Route

Page 27: AngularJS - Part 1

AngularJS