Angularjs Basics

16

Transcript of Angularjs Basics

Page 1: Angularjs Basics
Page 2: Angularjs Basics
Page 3: Angularjs Basics
Page 4: Angularjs Basics
Page 5: Angularjs Basics

Isn’t that all you need ?

Page 6: Angularjs Basics

• Pure JS (no JQuery)

• MVC framework

• Dependency Injection

• There are no Observables objects/Properties

• Encourage to write unit testable code

Page 7: Angularjs Basics

Basic Concepts

• Model - application data

• View - what the user sees

• Controller - application behavior

• Scope - glue between application data and behavior

• $ - angular namespace ($$ is private )

• Module - configures the injector

• Injector - assembles the application

Page 8: Angularjs Basics
Page 9: Angularjs Basics

Data Binding

Write an interactive app without using custom JavaScript

Few directives

• Define data in the view itself ng-init

• Initialize the application ng-app

• Two way binding ng-model

Page 10: Angularjs Basics

Expressions

{{ expression | filter }}

expression - access variables and functions from the scope

filter - formats the value of an expression for display to the user

Page 11: Angularjs Basics
Page 12: Angularjs Basics

Controllers

• The UI Logic

• Use of ng-controller

Page 13: Angularjs Basics
Page 14: Angularjs Basics

Services

• View independent business logic

• Share common logic across controllers

• Lazily instantiated

• Singletons

• Built in services - $http, $compile, $q

Page 15: Angularjs Basics
Page 16: Angularjs Basics

References

• https://www.youtube.com/watch?v=i9MHigUZKEM

• https://docs.angularjs.org/guide/concepts

• http://stackoverflow.com/questions/tagged/angularjs