gAngularJS By Nishikant Taksande NetPay Merchant Services
The Principles Boilerplate D.R.Y. Structure Testability Source: google I/O
DatabaseRAM <div> <span> <ul> <li > <li > <li> Where does it fits in? Source: google I/O
How it works? AngularJS will initialize when DOM content is loaded ng-app
Conceptual Overview TEMPLATE DIRECTIVES MODEL SCOPE EXPRESSIONS COMPILER VIEW FILTER DATA BINDING CONTROLLER MODULE SERVICE
Kick Start
What are directives ? They teach HTML new trick!
Using Directives Directive Directive
Using Directives …
Using Filters
RAM {{ databinding }} Logic <div> <span> <ul> <li > <li > <li>
Manages Notifies Observes Logic / Controller (JS Classes) UI / View (DOM) RAM Data / Model <div> <span> <ul> <li> Structure
Model View var firstName = “john” <h1>john</h1> controller, viewModel MVC
View, Controller and Scope
View, Controller and Scope… $scope $scope is the glue between a controller and a view
View, Controller and Scope… $scope injected dynamically
Module, Routes and Factories
$scope
Module and container <html ng-app="sampleApp">
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
Creating Controller in Module Creating Module Creating Controller
Role of Routes /view1 /view2 /view3 /view4
Routes Dependency Define Module Route
AngularJS

AngularJS - Part 1

Editor's Notes

  • #2 AngularJs is structural framework for dynamic web app. Client side javascript framework for adding interactivity to HTML
  • #6 DRY – don’t repeat yourself
  • #10 Template – Html with additional markup Model – Data shown to user and with which user interact Directive – extends html with custom element and attributes Scope – context where the model is stored so that controllers, directives, and expressions can access it. Expressions – access variables and functions from the scope. Compiler – parses the template and instantiate directives and expressions Filter – Format the value of and expressions for display to user. View – What user sees (DOM) Data Binding – Sync data between the model and the view. Controller – the business logic behind views Module – Container for different part of and app, including controllers, service, filter, directive, which configures the injector. Service – reusable business logic independent of views.