SlideShare a Scribd company logo
handson
why angular?
                                         keyarguments
                                          2 - Way Binding
                  HTML                                                       JS


                                                      app.controller("SearchController", function($scope){

                                                        // Initially set the search term to hello
                                                        $scope.searchTerm = "Hello";
<div ng-controller="SearchController">
  <input type="text" ng-model="searchTerm">
                                                        // Watch for changes of the search term
</div>
                                                        $scope.$watch("searchTerm", function(){
                                                          // perform search
                                                        });
                                                      });
why angular?
                          keyarguments
                                 Directives
                                        HTML

               <thumbnail picture="pictures.find(2)"></thumbnail>


                                         JS

app.directive("thumbnail", function(){
  return {
     restrict: 'E',
     scope:{ picture: '=' },
     replace: true,
     template: "<div class='thumbnail' ng-click='toggle()'>" +
                  "<img src='images/{{picture.url}}' alt='{{picture.name}}'></img>" +
                "</div>",
     controller: function($scope, element){
        $scope.selected = false;
        $scope.toggle = function(){
          $scope.selected = !$scope.selected;
        }
     },
  };
});
why angular?
                keyarguments
            Dependency Injection
                              JS

app.controller("SearchController", function($scope, $http, ...){

  // Use the $scope
  // Use whatever you need
  // Use $http
  $http.get("/search/" + $scope.searchTerm).success(function(data){
   $scope.results = data;
  });

});
why angular?
       keyarguments
             Testability!
                     JS

describe("Pictures Service", function(){
  var pictures;

  beforeEach(function(){
    module("gallery");
    module("galleryMock");

    inject(function($injector){
      pictures = $injector.get("pictures");
    });
  });

  it("returns 4 default pictures", function(){
    expect(pictures.all.length).toBe(4);
  });
});
lets code!
handson
start using
              projectrepository
      https://github.com/southdesign/hands-on-angular




                        step by step
                projectcommits
https://github.com/southdesign/hands-on-angular/commits/master
final project
galleryscreenshot
final project
sourcecode
we’re done!
                       thankyou

                   Thomas Fankhauser, M.Sc.
                    tommy@southdesign.de




try it out on: https://github.com/southdesign/hands-on-angular

More Related Content

PPTX
AngularJS Routing
PPTX
AngularJS Directives
PPTX
Building an End-to-End AngularJS Application
DOCX
Built in filters
DOCX
Filters in AngularJS
DOCX
Controller in AngularJS
PDF
Angular js routing options
DOCX
Understanding angular js $rootscope and $scope
AngularJS Routing
AngularJS Directives
Building an End-to-End AngularJS Application
Built in filters
Filters in AngularJS
Controller in AngularJS
Angular js routing options
Understanding angular js $rootscope and $scope

What's hot (20)

PPTX
AngularJS Services
PPTX
AngularJS $Provide Service
PPTX
AngularJS: what is underneath the hood
DOCX
Directives
PPTX
AngularJS - $http & $resource Services
PPTX
AngularJS Compile Process
PPTX
AngularJS Introduction
PPTX
AngulrJS Overview
DOCX
Shaping up with angular JS
PDF
Building Custom AngularJS Directives - A Step-by-Step Guide - Dan Wahlin | Fa...
PPTX
Dart and AngularDart
DOCX
multiple views and routing
TXT
Comment pages 002
PPTX
Building AngularJS Custom Directives
PPTX
Angular directive filter and routing
PPTX
Dive into AngularJS Routing
PDF
Angular JS Routing
PDF
Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA)
PPTX
Component lifecycle hooks in Angular 2.0
PDF
Introduction to angular js
AngularJS Services
AngularJS $Provide Service
AngularJS: what is underneath the hood
Directives
AngularJS - $http & $resource Services
AngularJS Compile Process
AngularJS Introduction
AngulrJS Overview
Shaping up with angular JS
Building Custom AngularJS Directives - A Step-by-Step Guide - Dan Wahlin | Fa...
Dart and AngularDart
multiple views and routing
Comment pages 002
Building AngularJS Custom Directives
Angular directive filter and routing
Dive into AngularJS Routing
Angular JS Routing
Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA)
Component lifecycle hooks in Angular 2.0
Introduction to angular js
Ad

Similar to Hands on AngularJS (20)

PDF
Clean Javascript
PDF
Angular.js Primer in Aalto University
PDF
Get AngularJS Started!
PDF
前端MVC 豆瓣说
PDF
Javascript Frameworks for Joomla
PDF
Backbone.js — Introduction to client-side JavaScript MVC
PPTX
AngularJS for Java Developers
PDF
Angular js
PDF
Opinionated AngularJS
PDF
Writing Maintainable JavaScript
PPTX
Writing HTML5 Web Apps using Backbone.js and GAE
PPTX
Basics of AngularJS
PPT
AngularJS Mobile Warsaw 20-10-2014
PPTX
Custom directive and scopes
PDF
Building Large jQuery Applications
PDF
Choosing a Javascript Framework
PDF
Mini-Training: AngularJS
PDF
PPTX
AngularJS.part1
PPTX
Javascript first-class citizenery
Clean Javascript
Angular.js Primer in Aalto University
Get AngularJS Started!
前端MVC 豆瓣说
Javascript Frameworks for Joomla
Backbone.js — Introduction to client-side JavaScript MVC
AngularJS for Java Developers
Angular js
Opinionated AngularJS
Writing Maintainable JavaScript
Writing HTML5 Web Apps using Backbone.js and GAE
Basics of AngularJS
AngularJS Mobile Warsaw 20-10-2014
Custom directive and scopes
Building Large jQuery Applications
Choosing a Javascript Framework
Mini-Training: AngularJS
AngularJS.part1
Javascript first-class citizenery
Ad

More from Thomas Fankhauser (7)

PDF
PDF
iOS Sensors
PDF
Github - Social Coding
PDF
Benji - Ruby on Rails Profiler
PDF
PDF
Super Social Everybody
PDF
iOS Sensors
Github - Social Coding
Benji - Ruby on Rails Profiler
Super Social Everybody

Recently uploaded (20)

PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPT
Teaching material agriculture food technology
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
sap open course for s4hana steps from ECC to s4
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Electronic commerce courselecture one. Pdf
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
Building Integrated photovoltaic BIPV_UPV.pdf
A comparative analysis of optical character recognition models for extracting...
MYSQL Presentation for SQL database connectivity
Unlocking AI with Model Context Protocol (MCP)
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Teaching material agriculture food technology
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
sap open course for s4hana steps from ECC to s4
“AI and Expert System Decision Support & Business Intelligence Systems”
20250228 LYD VKU AI Blended-Learning.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
A Presentation on Artificial Intelligence
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
The AUB Centre for AI in Media Proposal.docx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Electronic commerce courselecture one. Pdf
Assigned Numbers - 2025 - Bluetooth® Document
Dropbox Q2 2025 Financial Results & Investor Presentation
Diabetes mellitus diagnosis method based random forest with bat algorithm

Hands on AngularJS

  • 2. why angular? keyarguments 2 - Way Binding HTML JS app.controller("SearchController", function($scope){ // Initially set the search term to hello $scope.searchTerm = "Hello"; <div ng-controller="SearchController"> <input type="text" ng-model="searchTerm"> // Watch for changes of the search term </div> $scope.$watch("searchTerm", function(){ // perform search }); });
  • 3. why angular? keyarguments Directives HTML <thumbnail picture="pictures.find(2)"></thumbnail> JS app.directive("thumbnail", function(){ return { restrict: 'E', scope:{ picture: '=' }, replace: true, template: "<div class='thumbnail' ng-click='toggle()'>" + "<img src='images/{{picture.url}}' alt='{{picture.name}}'></img>" + "</div>", controller: function($scope, element){ $scope.selected = false; $scope.toggle = function(){ $scope.selected = !$scope.selected; } }, }; });
  • 4. why angular? keyarguments Dependency Injection JS app.controller("SearchController", function($scope, $http, ...){ // Use the $scope // Use whatever you need // Use $http $http.get("/search/" + $scope.searchTerm).success(function(data){ $scope.results = data; }); });
  • 5. why angular? keyarguments Testability! JS describe("Pictures Service", function(){ var pictures; beforeEach(function(){ module("gallery"); module("galleryMock"); inject(function($injector){ pictures = $injector.get("pictures"); }); }); it("returns 4 default pictures", function(){ expect(pictures.all.length).toBe(4); }); });
  • 7. start using projectrepository https://github.com/southdesign/hands-on-angular step by step projectcommits https://github.com/southdesign/hands-on-angular/commits/master
  • 10. we’re done! thankyou Thomas Fankhauser, M.Sc. tommy@southdesign.de try it out on: https://github.com/southdesign/hands-on-angular