Angularjs Basics

Post on 14-Jul-2015

315 views 1 download

Tags:

Transcript of Angularjs Basics

Isn’t that all you need ?

• Pure JS (no JQuery)

• MVC framework

• Dependency Injection

• There are no Observables objects/Properties

• Encourage to write unit testable code

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

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

Expressions

{{ expression | filter }}

expression - access variables and functions from the scope

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

Controllers

• The UI Logic

• Use of ng-controller

Services

• View independent business logic

• Share common logic across controllers

• Lazily instantiated

• Singletons

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

References

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

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

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