SlideShare ist ein Scribd-Unternehmen logo
1 von 48
Downloaden Sie, um offline zu lesen
AngularJS
                          Superheroic JavaScript Framework


Friday, February 22, 13
Maksym
               Klymyshyn
            CTO at GVMachines Inc.
                  (Zakaz.ua)




                 @maxmaxmaxmax

Friday, February 22, 13
Background

                      • Lead both-end developer @oDesk Inc.
                      • Front-end consultant @Helios
                      • OpenSource contributor
                      • Conferences organizer



Friday, February 22, 13
Now

                      • Doesn’t work with front-end 6+ month
                      • Never used AngularJS on production
                      • Understand VALUE of AngularJS for
                        business




Friday, February 22, 13
Friday, February 22, 13
Toc

                      • What is AngularJS
                      • Technical details
                      • Numbers and value for business
                        owners




Friday, February 22, 13
AngularJS?



Friday, February 22, 13
What is it?

                    MVC framework by Google
                        built around belief that
              declarative programming for building UIs,

             while imperative programming is excellent
                    for expressing business logic

Friday, February 22, 13
Author


                      • Originally written
                        by Misko Hevery

                      • Created at Google
                        as internal project




Friday, February 22, 13
Key points
                      • 2-way data binding
                      • dependency injection
                      • directives (custom tags and attrs)
                      • Form validation
                      • RESTful
                      • Binders, watches, events etc.

Friday, February 22, 13
Difference
                      • Lack of boilerplate code
                      • Easy-to-create reusable components
                      • Dead simple templates, no way to put
                        business logic
                      • Simple support of UI consistency
                      • All-in-one solution


Friday, February 22, 13
It fits well

                      • CRUD applications
                      • CRMs, Admin-panels
                      • Single-page apps
                      • Push-notification-based apps
                      • Mobile apps


Friday, February 22, 13
That won’t fly
              On Jun 8, 4:34 am, ganaraj p r <ganara...@gmail.com>
              wrote:
              > There should be some generic set of apps
              > for which angular would be
              > considered the wrong choice?
              >
              > Anyone figured out what set this would be?

              Good: Gmail
              Bad: Wikipedia



Friday, February 22, 13
Definitely not the first tool
                            to develop a game
Friday, February 22, 13
Technical details



Friday, February 22, 13
Bootstrap

                      $ yeoman init angular
                      $ ls
                      Gruntfile.js! ! test  app
                      testacular.conf.js package.json




Friday, February 22, 13
Bootstrap
          Structure
                      app/views
                      app/scripts/vendor
                      app/scripts/controllers/
                      app/scripts/app.js

                      app/index.html

          Server
                    $ yeoman server

Friday, February 22, 13
Friday, February 22, 13
Architecture




Friday, February 22, 13
Architecture




Friday, February 22, 13
Typical app




Friday, February 22, 13
Major parts

                      • Scope         • Filters

                      • Model         • Module

                      • View          • Injector

                      • Controller    • Services

                      • Directive


Friday, February 22, 13
Scope
                     The scope detecting changes to the model
                     section and provides the execution context
                                  for expressions.


       • Provide context for                • Isolated scopes (for
         expressions                          widgets)

       • Scopes are hierarchical            • Watches
         nested


Friday, February 22, 13
Scope




Friday, February 22, 13
Model


                               Model is view’s data.
                          No requirements. No restrictions




Friday, February 22, 13
Model
                     Controller:
                             $scope.data = {
                                title: “Test title”,
                                id: 1,
                                content: “Some content”
                             };


                     View:
                             <div id=”{{ data.id }}”>
                               <h1>{{ data.title }}</h1>
                               <p>{{ data.content }}</p>
                             </div>

Friday, February 22, 13
AWESOME



Friday, February 22, 13
View

                      • View looks like template
                      • It’s declarative
                      • Very close to HTML markup
                      • It handle directives
                      • Update DOM partially


Friday, February 22, 13
View

                          $scope.content = [
                             “paragraph 1”, “paragraph 2”,
                             “paragraph 3”
                          ];


                          <div ng-repeat=”p in content”>
                            <p>{{ p }}</p>
                          </div>




Friday, February 22, 13
View




Friday, February 22, 13
Controller
                          JavaScript code behind the view



                      • Manage application behavior
                      • Support of many views, for example
                        desktop and mobile versions with
                        different views but same controller


Friday, February 22, 13
Controller

                          MyModule.controller('MainCtrl', [
                            "$scope", function($scope) {

                                 $scope.name = "Max";
                                 $scope.content = [
                                    "paragraph 1", "paragraph 2",
                                    "paragraph 3"
                                 ];
                          }]);



Friday, February 22, 13
Directive
                              Directive is a behavior or
                                DOM transformation


                      • Provide ability to extend HTML
                      • Custom tags, attributes or classes
                      • Bi-directional binding of nested scopes
                      • Async directives processing

Friday, February 22, 13
Directive

        MyApp.directive('message',
          function factory() {
            return {
               template: '<div class="msg" ng-transclude>’ +
                         ‘</div>',
               replace: true,      // replace original tag
               transclude: true,   // put content to template
               // Element, possible Attr, Class, coMment
               restrict: 'E'
            };
          });



Friday, February 22, 13
Filters

                            Perform data transformation



                      • Very useful with locales
                      • Number formatters, text highlighting
                        and so on



Friday, February 22, 13
Filters


        MyApp.filter('title',
          function factory() {
            return function (input) {
               var ch = input.substring(0, 1);
               var rest = input.substring(1, input.length);
               return ch.toUpperCase () + rest;
            };
          });




Friday, February 22, 13
Module
                          Services, directives, filters,
                              and configuration

               var MyApp = angular.module('MyApp', [])
                 .config([
                   '$routeProvider',
                   function($routeProvider) {
                     $routeProvider.when('/', {
                        templateUrl: 'views/main.html',
                        controller: 'MainCtrl'
                     }).otherwise({
                        redirectTo: '/'
                     });
                   }]);
Friday, February 22, 13
Injector
                               Service locator,
                          Dependency Injection pattern




Friday, February 22, 13
Why? Minification
                    $ yeoman build
                    ...
                    # Error: Unknown provider:
                    aProvider <- a

       Wrong
       ... 'MainCtrl', function($scope) { ...


       Correct
       ... 'MainCtrl', ["$scope", function($scope) { ...


Friday, February 22, 13
Services
                      • $compile - dynamic views compilation
                        from string
                      • $cookies - read/write cookies
                      • $locatoin - work with browser’s
                        location
                      • $resource - factory to work with third-
                        party services/REST

Friday, February 22, 13
Toolchain
                      • End-to-end - e2e testing, similar to
                        Jasmine
                      • Yeoman - dev & build server, projects
                        skeleton
                      • Batarang - plugin for Chrome
                      • Testicular - tests framework


Friday, February 22, 13
Third-party apps

                      • Angular-UI

                      • Anglebars.js

                      • jQuery mobile +
                        Angular.js

                      • ngGrid



Friday, February 22, 13
Show me the money



Friday, February 22, 13
Rapid prototyping

                      • No boilerplate code === less code to
                        maintain
                      • Simple tests suite === more motivation
                        to write more tests
                      • Two-way data binding === easy to
                        develop push-based services, like
                        PBX<->CRM, chats, notifications etc.

Friday, February 22, 13
Structured by design
           • Well structured codebase by design
           • Easy-to-understand templates
           • Fast and maintainable prototypes may
             become fast hypothesis check and
             robust solution. Recommended for
             startups



Friday, February 22, 13
Community

            • 7001 followers on    • 9371 followers on
              github                 twitter

            • 1158 forks!          • 316 videos on YouTube

            • 1619 closed issues   • 127 presentations on
                                     SlideShare
            • 391 open issues



Friday, February 22, 13
AWESOME


                          Text




Friday, February 22, 13
Thanks. Questions?




Friday, February 22, 13

Weitere ähnliche Inhalte

Was ist angesagt?

AngularJS for Beginners
AngularJS for BeginnersAngularJS for Beginners
AngularJS for BeginnersEdureka!
 
Overview about AngularJS Framework
Overview about AngularJS Framework Overview about AngularJS Framework
Overview about AngularJS Framework Camilo Lopes
 
Gettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJSGettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJSArmin Vieweg
 
Angular 10 course_content
Angular 10 course_contentAngular 10 course_content
Angular 10 course_contentNAVEENSAGGAM1
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJSAldo Pizzagalli
 
Angular 2 interview questions and answers
Angular 2 interview questions and answersAngular 2 interview questions and answers
Angular 2 interview questions and answersAnil Singh
 
Angular.js interview questions
Angular.js interview questionsAngular.js interview questions
Angular.js interview questionscodeandyou forums
 
AngularJS One Day Workshop
AngularJS One Day WorkshopAngularJS One Day Workshop
AngularJS One Day WorkshopShyam Seshadri
 
Angular 4 Introduction Tutorial
Angular 4 Introduction TutorialAngular 4 Introduction Tutorial
Angular 4 Introduction TutorialScott Lee
 
Angular js
Angular jsAngular js
Angular jsMindtree
 
AngularJS : Superheroic JavaScript MVW Framework
AngularJS : Superheroic JavaScript MVW FrameworkAngularJS : Superheroic JavaScript MVW Framework
AngularJS : Superheroic JavaScript MVW FrameworkEdureka!
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overviewJesse Warden
 
AngularJS interview questions
AngularJS interview questionsAngularJS interview questions
AngularJS interview questionsUri Lukach
 
Angular 4 Tutorial | What's New In Angular 4 | Angular Training | Edureka
Angular 4 Tutorial | What's New In Angular 4 | Angular Training | EdurekaAngular 4 Tutorial | What's New In Angular 4 | Angular Training | Edureka
Angular 4 Tutorial | What's New In Angular 4 | Angular Training | EdurekaEdureka!
 

Was ist angesagt? (20)

AngularJS for Beginners
AngularJS for BeginnersAngularJS for Beginners
AngularJS for Beginners
 
What's new in Angular 2?
What's new in Angular 2?What's new in Angular 2?
What's new in Angular 2?
 
Overview about AngularJS Framework
Overview about AngularJS Framework Overview about AngularJS Framework
Overview about AngularJS Framework
 
Gettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJSGettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJS
 
Angular 10 course_content
Angular 10 course_contentAngular 10 course_content
Angular 10 course_content
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
Angular js
Angular jsAngular js
Angular js
 
Angular 2 interview questions and answers
Angular 2 interview questions and answersAngular 2 interview questions and answers
Angular 2 interview questions and answers
 
Angular.js interview questions
Angular.js interview questionsAngular.js interview questions
Angular.js interview questions
 
AngularJS One Day Workshop
AngularJS One Day WorkshopAngularJS One Day Workshop
AngularJS One Day Workshop
 
Angular 4 Introduction Tutorial
Angular 4 Introduction TutorialAngular 4 Introduction Tutorial
Angular 4 Introduction Tutorial
 
Angular js
Angular jsAngular js
Angular js
 
AngularJS : Superheroic JavaScript MVW Framework
AngularJS : Superheroic JavaScript MVW FrameworkAngularJS : Superheroic JavaScript MVW Framework
AngularJS : Superheroic JavaScript MVW Framework
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overview
 
AngularJS is awesome
AngularJS is awesomeAngularJS is awesome
AngularJS is awesome
 
Anjular js
Anjular jsAnjular js
Anjular js
 
AngularJS interview questions
AngularJS interview questionsAngularJS interview questions
AngularJS interview questions
 
Angular 4 Tutorial | What's New In Angular 4 | Angular Training | Edureka
Angular 4 Tutorial | What's New In Angular 4 | Angular Training | EdurekaAngular 4 Tutorial | What's New In Angular 4 | Angular Training | Edureka
Angular 4 Tutorial | What's New In Angular 4 | Angular Training | Edureka
 
Angular js
Angular jsAngular js
Angular js
 
Get satrted angular js
Get satrted angular jsGet satrted angular js
Get satrted angular js
 

Ähnlich wie Angular.js - JS Camp UKraine 2013

Mansoura University CSED & Nozom web development sprint
Mansoura University CSED & Nozom web development sprintMansoura University CSED & Nozom web development sprint
Mansoura University CSED & Nozom web development sprintAl Sayed Gamal
 
BDD approaches for web development at Agile Testing Days 2009
BDD approaches for web development at Agile Testing Days 2009BDD approaches for web development at Agile Testing Days 2009
BDD approaches for web development at Agile Testing Days 2009Thomas Lundström
 
jQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesjQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesTeamstudio
 
State of Puppet - Puppet Camp Barcelona 2013
State of Puppet - Puppet Camp Barcelona 2013State of Puppet - Puppet Camp Barcelona 2013
State of Puppet - Puppet Camp Barcelona 2013Puppet
 
Frontend Engineer Toolbox
Frontend Engineer ToolboxFrontend Engineer Toolbox
Frontend Engineer ToolboxYnon Perek
 
Architecting large Node.js applications
Architecting large Node.js applicationsArchitecting large Node.js applications
Architecting large Node.js applicationsSergi Mansilla
 
PhoneGap: Building Mobile Applications with HTML/JS
PhoneGap: Building Mobile Applications with HTML/JSPhoneGap: Building Mobile Applications with HTML/JS
PhoneGap: Building Mobile Applications with HTML/JSRyan Stewart
 
Debugging,Troubleshooting & Monitoring Distributed Web & Cloud Applications a...
Debugging,Troubleshooting & Monitoring Distributed Web & Cloud Applications a...Debugging,Troubleshooting & Monitoring Distributed Web & Cloud Applications a...
Debugging,Troubleshooting & Monitoring Distributed Web & Cloud Applications a...Theo Jungeblut
 
jQuery Comes to XPages
jQuery Comes to XPagesjQuery Comes to XPages
jQuery Comes to XPagesTeamstudio
 
Cloud4all Architecture Overview
Cloud4all Architecture OverviewCloud4all Architecture Overview
Cloud4all Architecture Overviewicchp2012
 
jQuery Conference 2012 keynote
jQuery Conference 2012 keynotejQuery Conference 2012 keynote
jQuery Conference 2012 keynotedmethvin
 
Socal piggies-app-deploy
Socal piggies-app-deploySocal piggies-app-deploy
Socal piggies-app-deployjtimberman
 
Bdd For Web Applications from Scandinavian Developer Conference 2010
Bdd For Web Applications from Scandinavian Developer Conference 2010Bdd For Web Applications from Scandinavian Developer Conference 2010
Bdd For Web Applications from Scandinavian Developer Conference 2010Thomas Lundström
 
A Morning with MongoDB Barcelona: Use Cases and Roadmap
A Morning with MongoDB Barcelona: Use Cases and RoadmapA Morning with MongoDB Barcelona: Use Cases and Roadmap
A Morning with MongoDB Barcelona: Use Cases and RoadmapMongoDB
 
True Postgres High Availability Architecture with Industry Standard Open-Sou...
 True Postgres High Availability Architecture with Industry Standard Open-Sou... True Postgres High Availability Architecture with Industry Standard Open-Sou...
True Postgres High Availability Architecture with Industry Standard Open-Sou...EDB
 
From Renamer Plugin to Polyglot IDE
From Renamer Plugin to Polyglot IDEFrom Renamer Plugin to Polyglot IDE
From Renamer Plugin to Polyglot IDEintelliyole
 
Single Page Applications - Desert Code Camp 2012
Single Page Applications - Desert Code Camp 2012Single Page Applications - Desert Code Camp 2012
Single Page Applications - Desert Code Camp 2012Adam Mokan
 

Ähnlich wie Angular.js - JS Camp UKraine 2013 (20)

QCON SP 2012
QCON SP 2012QCON SP 2012
QCON SP 2012
 
Mansoura University CSED & Nozom web development sprint
Mansoura University CSED & Nozom web development sprintMansoura University CSED & Nozom web development sprint
Mansoura University CSED & Nozom web development sprint
 
BDD approaches for web development at Agile Testing Days 2009
BDD approaches for web development at Agile Testing Days 2009BDD approaches for web development at Agile Testing Days 2009
BDD approaches for web development at Agile Testing Days 2009
 
jQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesjQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPages
 
State of Puppet - Puppet Camp Barcelona 2013
State of Puppet - Puppet Camp Barcelona 2013State of Puppet - Puppet Camp Barcelona 2013
State of Puppet - Puppet Camp Barcelona 2013
 
Frontend Engineer Toolbox
Frontend Engineer ToolboxFrontend Engineer Toolbox
Frontend Engineer Toolbox
 
Architecting large Node.js applications
Architecting large Node.js applicationsArchitecting large Node.js applications
Architecting large Node.js applications
 
PhoneGap: Building Mobile Applications with HTML/JS
PhoneGap: Building Mobile Applications with HTML/JSPhoneGap: Building Mobile Applications with HTML/JS
PhoneGap: Building Mobile Applications with HTML/JS
 
Debugging,Troubleshooting & Monitoring Distributed Web & Cloud Applications a...
Debugging,Troubleshooting & Monitoring Distributed Web & Cloud Applications a...Debugging,Troubleshooting & Monitoring Distributed Web & Cloud Applications a...
Debugging,Troubleshooting & Monitoring Distributed Web & Cloud Applications a...
 
jQuery Comes to XPages
jQuery Comes to XPagesjQuery Comes to XPages
jQuery Comes to XPages
 
Aegir
AegirAegir
Aegir
 
Cloud4all Architecture Overview
Cloud4all Architecture OverviewCloud4all Architecture Overview
Cloud4all Architecture Overview
 
jQuery Conference 2012 keynote
jQuery Conference 2012 keynotejQuery Conference 2012 keynote
jQuery Conference 2012 keynote
 
RealDay: Angular.js
RealDay: Angular.jsRealDay: Angular.js
RealDay: Angular.js
 
Socal piggies-app-deploy
Socal piggies-app-deploySocal piggies-app-deploy
Socal piggies-app-deploy
 
Bdd For Web Applications from Scandinavian Developer Conference 2010
Bdd For Web Applications from Scandinavian Developer Conference 2010Bdd For Web Applications from Scandinavian Developer Conference 2010
Bdd For Web Applications from Scandinavian Developer Conference 2010
 
A Morning with MongoDB Barcelona: Use Cases and Roadmap
A Morning with MongoDB Barcelona: Use Cases and RoadmapA Morning with MongoDB Barcelona: Use Cases and Roadmap
A Morning with MongoDB Barcelona: Use Cases and Roadmap
 
True Postgres High Availability Architecture with Industry Standard Open-Sou...
 True Postgres High Availability Architecture with Industry Standard Open-Sou... True Postgres High Availability Architecture with Industry Standard Open-Sou...
True Postgres High Availability Architecture with Industry Standard Open-Sou...
 
From Renamer Plugin to Polyglot IDE
From Renamer Plugin to Polyglot IDEFrom Renamer Plugin to Polyglot IDE
From Renamer Plugin to Polyglot IDE
 
Single Page Applications - Desert Code Camp 2012
Single Page Applications - Desert Code Camp 2012Single Page Applications - Desert Code Camp 2012
Single Page Applications - Desert Code Camp 2012
 

Mehr von Max Klymyshyn

Papers We Love Kyiv, July 2018: A Conflict-Free Replicated JSON Datatype
Papers We Love Kyiv, July 2018: A Conflict-Free Replicated JSON DatatypePapers We Love Kyiv, July 2018: A Conflict-Free Replicated JSON Datatype
Papers We Love Kyiv, July 2018: A Conflict-Free Replicated JSON DatatypeMax Klymyshyn
 
KharkivJS 2017: Коллаборативные системы и CRDT
KharkivJS 2017: Коллаборативные системы и CRDTKharkivJS 2017: Коллаборативные системы и CRDT
KharkivJS 2017: Коллаборативные системы и CRDTMax Klymyshyn
 
OdessaJS 2017: Groupware Systems for fun and profit
OdessaJS 2017: Groupware Systems for fun and profitOdessaJS 2017: Groupware Systems for fun and profit
OdessaJS 2017: Groupware Systems for fun and profitMax Klymyshyn
 
PyCon Ukraine 2017: Operational Transformation
PyCon Ukraine 2017: Operational Transformation PyCon Ukraine 2017: Operational Transformation
PyCon Ukraine 2017: Operational Transformation Max Klymyshyn
 
Communicating Sequential Processes (CSP) in JavaScript
Communicating Sequential Processes (CSP) in JavaScriptCommunicating Sequential Processes (CSP) in JavaScript
Communicating Sequential Processes (CSP) in JavaScriptMax Klymyshyn
 
PiterPy 2016: Parallelization, Aggregation and Validation of API in Python
PiterPy 2016: Parallelization, Aggregation and Validation of API in PythonPiterPy 2016: Parallelization, Aggregation and Validation of API in Python
PiterPy 2016: Parallelization, Aggregation and Validation of API in PythonMax Klymyshyn
 
Fighting async JavaScript (CSP)
Fighting async JavaScript (CSP)Fighting async JavaScript (CSP)
Fighting async JavaScript (CSP)Max Klymyshyn
 
React.js: Ускоряем UX/UI
React.js: Ускоряем UX/UIReact.js: Ускоряем UX/UI
React.js: Ускоряем UX/UIMax Klymyshyn
 
KharkovPy #12: I/O in Python apps and smart logging (russian)
KharkovPy #12: I/O in Python apps and smart logging (russian)KharkovPy #12: I/O in Python apps and smart logging (russian)
KharkovPy #12: I/O in Python apps and smart logging (russian)Max Klymyshyn
 
5 мифов о производительности баз данных и Python
5 мифов о производительности баз данных и Python5 мифов о производительности баз данных и Python
5 мифов о производительности баз данных и PythonMax Klymyshyn
 
Изоформные приложения на React.js
Изоформные приложения на React.jsИзоформные приложения на React.js
Изоформные приложения на React.jsMax Klymyshyn
 
Изоморфный JavaScript (iForum 2015)
Изоморфный JavaScript (iForum 2015)Изоморфный JavaScript (iForum 2015)
Изоморфный JavaScript (iForum 2015)Max Klymyshyn
 
Трансдюсеры, CSP каналы, неизменяемые структуры данных в JavaScript
Трансдюсеры, CSP каналы, неизменяемые структуры данных в JavaScriptТрансдюсеры, CSP каналы, неизменяемые структуры данных в JavaScript
Трансдюсеры, CSP каналы, неизменяемые структуры данных в JavaScriptMax Klymyshyn
 
PiterPy 2015 - Трансдюсеры и Python
PiterPy 2015 - Трансдюсеры и PythonPiterPy 2015 - Трансдюсеры и Python
PiterPy 2015 - Трансдюсеры и PythonMax Klymyshyn
 
Robust web apps with React.js
Robust web apps with React.jsRobust web apps with React.js
Robust web apps with React.jsMax Klymyshyn
 
LvivJS 2014 - Win-win c React.js
LvivJS 2014 - Win-win c React.jsLvivJS 2014 - Win-win c React.js
LvivJS 2014 - Win-win c React.jsMax Klymyshyn
 
Инновации и JavaScript
Инновации и JavaScriptИнновации и JavaScript
Инновации и JavaScriptMax Klymyshyn
 
Odessapy2013 - Graph databases and Python
Odessapy2013 - Graph databases and PythonOdessapy2013 - Graph databases and Python
Odessapy2013 - Graph databases and PythonMax Klymyshyn
 
Зачем читать чужой код?
Зачем читать чужой код?Зачем читать чужой код?
Зачем читать чужой код?Max Klymyshyn
 
AgileBaseCamp 2013 - Start Up and Get Done
AgileBaseCamp 2013 - Start Up and Get DoneAgileBaseCamp 2013 - Start Up and Get Done
AgileBaseCamp 2013 - Start Up and Get DoneMax Klymyshyn
 

Mehr von Max Klymyshyn (20)

Papers We Love Kyiv, July 2018: A Conflict-Free Replicated JSON Datatype
Papers We Love Kyiv, July 2018: A Conflict-Free Replicated JSON DatatypePapers We Love Kyiv, July 2018: A Conflict-Free Replicated JSON Datatype
Papers We Love Kyiv, July 2018: A Conflict-Free Replicated JSON Datatype
 
KharkivJS 2017: Коллаборативные системы и CRDT
KharkivJS 2017: Коллаборативные системы и CRDTKharkivJS 2017: Коллаборативные системы и CRDT
KharkivJS 2017: Коллаборативные системы и CRDT
 
OdessaJS 2017: Groupware Systems for fun and profit
OdessaJS 2017: Groupware Systems for fun and profitOdessaJS 2017: Groupware Systems for fun and profit
OdessaJS 2017: Groupware Systems for fun and profit
 
PyCon Ukraine 2017: Operational Transformation
PyCon Ukraine 2017: Operational Transformation PyCon Ukraine 2017: Operational Transformation
PyCon Ukraine 2017: Operational Transformation
 
Communicating Sequential Processes (CSP) in JavaScript
Communicating Sequential Processes (CSP) in JavaScriptCommunicating Sequential Processes (CSP) in JavaScript
Communicating Sequential Processes (CSP) in JavaScript
 
PiterPy 2016: Parallelization, Aggregation and Validation of API in Python
PiterPy 2016: Parallelization, Aggregation and Validation of API in PythonPiterPy 2016: Parallelization, Aggregation and Validation of API in Python
PiterPy 2016: Parallelization, Aggregation and Validation of API in Python
 
Fighting async JavaScript (CSP)
Fighting async JavaScript (CSP)Fighting async JavaScript (CSP)
Fighting async JavaScript (CSP)
 
React.js: Ускоряем UX/UI
React.js: Ускоряем UX/UIReact.js: Ускоряем UX/UI
React.js: Ускоряем UX/UI
 
KharkovPy #12: I/O in Python apps and smart logging (russian)
KharkovPy #12: I/O in Python apps and smart logging (russian)KharkovPy #12: I/O in Python apps and smart logging (russian)
KharkovPy #12: I/O in Python apps and smart logging (russian)
 
5 мифов о производительности баз данных и Python
5 мифов о производительности баз данных и Python5 мифов о производительности баз данных и Python
5 мифов о производительности баз данных и Python
 
Изоформные приложения на React.js
Изоформные приложения на React.jsИзоформные приложения на React.js
Изоформные приложения на React.js
 
Изоморфный JavaScript (iForum 2015)
Изоморфный JavaScript (iForum 2015)Изоморфный JavaScript (iForum 2015)
Изоморфный JavaScript (iForum 2015)
 
Трансдюсеры, CSP каналы, неизменяемые структуры данных в JavaScript
Трансдюсеры, CSP каналы, неизменяемые структуры данных в JavaScriptТрансдюсеры, CSP каналы, неизменяемые структуры данных в JavaScript
Трансдюсеры, CSP каналы, неизменяемые структуры данных в JavaScript
 
PiterPy 2015 - Трансдюсеры и Python
PiterPy 2015 - Трансдюсеры и PythonPiterPy 2015 - Трансдюсеры и Python
PiterPy 2015 - Трансдюсеры и Python
 
Robust web apps with React.js
Robust web apps with React.jsRobust web apps with React.js
Robust web apps with React.js
 
LvivJS 2014 - Win-win c React.js
LvivJS 2014 - Win-win c React.jsLvivJS 2014 - Win-win c React.js
LvivJS 2014 - Win-win c React.js
 
Инновации и JavaScript
Инновации и JavaScriptИнновации и JavaScript
Инновации и JavaScript
 
Odessapy2013 - Graph databases and Python
Odessapy2013 - Graph databases and PythonOdessapy2013 - Graph databases and Python
Odessapy2013 - Graph databases and Python
 
Зачем читать чужой код?
Зачем читать чужой код?Зачем читать чужой код?
Зачем читать чужой код?
 
AgileBaseCamp 2013 - Start Up and Get Done
AgileBaseCamp 2013 - Start Up and Get DoneAgileBaseCamp 2013 - Start Up and Get Done
AgileBaseCamp 2013 - Start Up and Get Done
 

Angular.js - JS Camp UKraine 2013

  • 1. AngularJS Superheroic JavaScript Framework Friday, February 22, 13
  • 2. Maksym Klymyshyn CTO at GVMachines Inc. (Zakaz.ua) @maxmaxmaxmax Friday, February 22, 13
  • 3. Background • Lead both-end developer @oDesk Inc. • Front-end consultant @Helios • OpenSource contributor • Conferences organizer Friday, February 22, 13
  • 4. Now • Doesn’t work with front-end 6+ month • Never used AngularJS on production • Understand VALUE of AngularJS for business Friday, February 22, 13
  • 6. Toc • What is AngularJS • Technical details • Numbers and value for business owners Friday, February 22, 13
  • 8. What is it? MVC framework by Google built around belief that declarative programming for building UIs, while imperative programming is excellent for expressing business logic Friday, February 22, 13
  • 9. Author • Originally written by Misko Hevery • Created at Google as internal project Friday, February 22, 13
  • 10. Key points • 2-way data binding • dependency injection • directives (custom tags and attrs) • Form validation • RESTful • Binders, watches, events etc. Friday, February 22, 13
  • 11. Difference • Lack of boilerplate code • Easy-to-create reusable components • Dead simple templates, no way to put business logic • Simple support of UI consistency • All-in-one solution Friday, February 22, 13
  • 12. It fits well • CRUD applications • CRMs, Admin-panels • Single-page apps • Push-notification-based apps • Mobile apps Friday, February 22, 13
  • 13. That won’t fly On Jun 8, 4:34 am, ganaraj p r <ganara...@gmail.com> wrote: > There should be some generic set of apps > for which angular would be > considered the wrong choice? > > Anyone figured out what set this would be? Good: Gmail Bad: Wikipedia Friday, February 22, 13
  • 14. Definitely not the first tool to develop a game Friday, February 22, 13
  • 16. Bootstrap $ yeoman init angular $ ls Gruntfile.js! ! test app testacular.conf.js package.json Friday, February 22, 13
  • 17. Bootstrap Structure app/views app/scripts/vendor app/scripts/controllers/ app/scripts/app.js app/index.html Server $ yeoman server Friday, February 22, 13
  • 22. Major parts • Scope • Filters • Model • Module • View • Injector • Controller • Services • Directive Friday, February 22, 13
  • 23. Scope The scope detecting changes to the model section and provides the execution context for expressions. • Provide context for • Isolated scopes (for expressions widgets) • Scopes are hierarchical • Watches nested Friday, February 22, 13
  • 25. Model Model is view’s data. No requirements. No restrictions Friday, February 22, 13
  • 26. Model Controller: $scope.data = { title: “Test title”, id: 1, content: “Some content” }; View: <div id=”{{ data.id }}”> <h1>{{ data.title }}</h1> <p>{{ data.content }}</p> </div> Friday, February 22, 13
  • 28. View • View looks like template • It’s declarative • Very close to HTML markup • It handle directives • Update DOM partially Friday, February 22, 13
  • 29. View $scope.content = [ “paragraph 1”, “paragraph 2”, “paragraph 3” ]; <div ng-repeat=”p in content”> <p>{{ p }}</p> </div> Friday, February 22, 13
  • 31. Controller JavaScript code behind the view • Manage application behavior • Support of many views, for example desktop and mobile versions with different views but same controller Friday, February 22, 13
  • 32. Controller MyModule.controller('MainCtrl', [ "$scope", function($scope) { $scope.name = "Max"; $scope.content = [ "paragraph 1", "paragraph 2", "paragraph 3" ]; }]); Friday, February 22, 13
  • 33. Directive Directive is a behavior or DOM transformation • Provide ability to extend HTML • Custom tags, attributes or classes • Bi-directional binding of nested scopes • Async directives processing Friday, February 22, 13
  • 34. Directive MyApp.directive('message', function factory() { return { template: '<div class="msg" ng-transclude>’ + ‘</div>', replace: true, // replace original tag transclude: true, // put content to template // Element, possible Attr, Class, coMment restrict: 'E' }; }); Friday, February 22, 13
  • 35. Filters Perform data transformation • Very useful with locales • Number formatters, text highlighting and so on Friday, February 22, 13
  • 36. Filters MyApp.filter('title', function factory() { return function (input) { var ch = input.substring(0, 1); var rest = input.substring(1, input.length); return ch.toUpperCase () + rest; }; }); Friday, February 22, 13
  • 37. Module Services, directives, filters, and configuration var MyApp = angular.module('MyApp', []) .config([ '$routeProvider', function($routeProvider) { $routeProvider.when('/', { templateUrl: 'views/main.html', controller: 'MainCtrl' }).otherwise({ redirectTo: '/' }); }]); Friday, February 22, 13
  • 38. Injector Service locator, Dependency Injection pattern Friday, February 22, 13
  • 39. Why? Minification $ yeoman build ... # Error: Unknown provider: aProvider <- a Wrong ... 'MainCtrl', function($scope) { ... Correct ... 'MainCtrl', ["$scope", function($scope) { ... Friday, February 22, 13
  • 40. Services • $compile - dynamic views compilation from string • $cookies - read/write cookies • $locatoin - work with browser’s location • $resource - factory to work with third- party services/REST Friday, February 22, 13
  • 41. Toolchain • End-to-end - e2e testing, similar to Jasmine • Yeoman - dev & build server, projects skeleton • Batarang - plugin for Chrome • Testicular - tests framework Friday, February 22, 13
  • 42. Third-party apps • Angular-UI • Anglebars.js • jQuery mobile + Angular.js • ngGrid Friday, February 22, 13
  • 43. Show me the money Friday, February 22, 13
  • 44. Rapid prototyping • No boilerplate code === less code to maintain • Simple tests suite === more motivation to write more tests • Two-way data binding === easy to develop push-based services, like PBX<->CRM, chats, notifications etc. Friday, February 22, 13
  • 45. Structured by design • Well structured codebase by design • Easy-to-understand templates • Fast and maintainable prototypes may become fast hypothesis check and robust solution. Recommended for startups Friday, February 22, 13
  • 46. Community • 7001 followers on • 9371 followers on github twitter • 1158 forks! • 316 videos on YouTube • 1619 closed issues • 127 presentations on SlideShare • 391 open issues Friday, February 22, 13
  • 47. AWESOME Text Friday, February 22, 13