SlideShare a Scribd company logo
1 of 24
KNOCKOUT.JS
Scott Messinger - Baltimore JS Meetup - July 27, 2011
WHO AM I?
WHAT IS KNOCKOUT.JS?
MODEL/VIEW/VIEWMODEL
        MVVM
Pretty Pictures.




DB               DB
KO AUTOMATICALLY
UPDATES YOUR DOM.
HISTORY
MICROSOFT. SILVERLIGHT.
        WPF.
LET’S CHECK IT OUT.
PART 1: CONTACT EDITOR.
 HTTP://JSBIN.COM/UVUBEM/6/EDIT
PART 2:
      TO DO LIST
http://jsfiddle.net/scottmessinger/pC4zY/16/
LET ME SHOW YOU AROUND.
TASK 1:
 SHOW SOME TODOS
     http://jsfiddle.net/scottmessinger/RtGyu/5/
http://knockoutjs.com/documentation/introduction.html
Do the highlights.
                                 Add “todo done” classes if done
                                    Add “todo” if not done.
      <script id="todoitemtemplate"type="text/html">
        <li>
          <div data-bind="">
            <div class="display">
              <input class="check"type="checkbox" data-bind="" />
              <div class="todo-content"contenteditable="true" data-bind=""></div>
              <span class="todo-destroy" data-bind=""></span>
            </div>
          </div>
        </li>
      </script>
      


                     http://jsfiddle.net/scottmessinger/RtGyu/5/
The answer!
      <ul id="todo-list" data-bind="template: { name: 'todoitemtemplate', foreach: todos }">
      </ul>
      <script id="todoitemtemplate"type="text/html">
        <li>
          <div data-bind="attr: { class : done() ? 'todo done' : 'todo'}">
            <div class="display">
              <input class="check"type="checkbox" data-bind="checked: done" />
              <div class="todo-content"contenteditable="true" data-bind="text: content"></di
              <span class="todo-destroy" data-bind="click: viewModel.remove"></span>
            </div>
          </div>
        </li>
      </script>
TASK 2:
REMOVE SOME TODOS
        http://jsfiddle.net/scottmessinger/RtGyu/5/

http://knockoutjs.com/documentation/introduction.html
Do the highlights.
         
        <div id="todo-stats" >
         
            // CODE
         
            <span class="todo-clear" data-bind="visible: done().length > 0">
         
              <a href="#" data-bind="">
               // CODE
              </a>
            </span>
        </div>


              <script id="todoitemtemplate"type="text/html">
                <li>
                  <div data-bind="attr: { class : done() ? 'todo done' : 'todo'}">
                    <div class="display">
                      <input class="check"type="checkbox" data-bind="checked: done" />
                      <div class="todo-content"contenteditable="true" data-bind="text: content"></div>
                      <span class="todo-destroy" data-bind=""></span>
                    </div>
                  </div>
                </li>
              </script>
Do the highlights.
         
        <div id="todo-stats" >
         
            // CODE
         
            <span class="todo-clear" data-bind="visible: done().length > 0">
         
              <a href="#" data-bind="click: viewModel.removeCompleted">
               // CODE
              </a>
            </span>
        </div>


              <script id="todoitemtemplate"type="text/html">
                <li>
                  <div data-bind="attr: { class : done() ? 'todo done' : 'todo'}">
                    <div class="display">
                      <input class="check"type="checkbox" data-bind="checked: done" />
                      <div class="todo-content"contenteditable="true" data-bind="text: content"></div>
                      <span class="todo-destroy" data-bind="click: viewModel.remove"></span>
                    </div>
                  </div>
                </li>
              </script>
Do the highlights
// VIEWMODEL
var viewModel = {
    todos: ko.observableArray(),
    current: ko.observable(),
    add: function (event) {
        if (event.keyCode === 13) {
            var newTodo = new Todo(this.current());
            this.todos.push(newTodo);                  Methods to
            console.log(newTodo)
                                                         Know:
            this.current("");
        }
    },                                                  remove()
                                                       removeAll()
    remove: function (event) {
        viewModel.todos.remove(this);
    },

    removeCompleted: function (event) {
        viewModel.todos.removeAll(viewModel.done());
    }
};
Do the highlights
// VIEWMODEL
var viewModel = {
    todos: ko.observableArray(),
    current: ko.observable(),
    add: function (event) {
        if (event.keyCode === 13) {
            var newTodo = new Todo(this.current());
            this.todos.push(newTodo);                 Methods to
            console.log(newTodo)                        Know:
            this.current("");
        }
    },
                                                       remove()

    remove: function (event) {                        removeAll()
    },

    removeCompleted: function (event) {

    }
};
PROBLEMS WITH MVVM
CODE WALK
https://gist.github.com/1109917
Learning more about
          knockout.js
knockoutjs.com

knockmeout.net

https://groups.google.com/
forum/#!forum/knockoutjs
QUESTIONS.

More Related Content

What's hot

Dom selecting & jQuery
Dom selecting & jQueryDom selecting & jQuery
Dom selecting & jQueryKim Hunmin
 
React 소개 및 구현방법 Demo
React 소개 및 구현방법 DemoReact 소개 및 구현방법 Demo
React 소개 및 구현방법 DemoDaesung Kim
 
AngularJS for designers and developers
AngularJS for designers and developersAngularJS for designers and developers
AngularJS for designers and developersKai Koenig
 
Modern frontend development with VueJs
Modern frontend development with VueJsModern frontend development with VueJs
Modern frontend development with VueJsTudor Barbu
 
Modern Web Application Development Workflow - EclipseCon Europe 2014
Modern Web Application Development Workflow - EclipseCon Europe 2014Modern Web Application Development Workflow - EclipseCon Europe 2014
Modern Web Application Development Workflow - EclipseCon Europe 2014Stéphane Bégaudeau
 
The Complementarity of React and Web Components
The Complementarity of React and Web ComponentsThe Complementarity of React and Web Components
The Complementarity of React and Web ComponentsAndrew Rota
 
Why and How to Use Virtual DOM
Why and How to Use Virtual DOMWhy and How to Use Virtual DOM
Why and How to Use Virtual DOMDaiwei Lu
 
Web Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing CombinationWeb Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing CombinationAndrew Rota
 
Levent-Gurses' Introduction to Web Components & Polymer
Levent-Gurses' Introduction to Web Components & PolymerLevent-Gurses' Introduction to Web Components & Polymer
Levent-Gurses' Introduction to Web Components & PolymerErik Isaksen
 
[FEConf Korea 2017]Angular 컴포넌트 대화법
[FEConf Korea 2017]Angular 컴포넌트 대화법[FEConf Korea 2017]Angular 컴포넌트 대화법
[FEConf Korea 2017]Angular 컴포넌트 대화법Jeado Ko
 
Building a Startup Stack with AngularJS
Building a Startup Stack with AngularJSBuilding a Startup Stack with AngularJS
Building a Startup Stack with AngularJSFITC
 
Week 8
Week 8Week 8
Week 8A VD
 
JavaScript - Chapter 11 - Events
 JavaScript - Chapter 11 - Events  JavaScript - Chapter 11 - Events
JavaScript - Chapter 11 - Events WebStackAcademy
 

What's hot (20)

Backbone js
Backbone jsBackbone js
Backbone js
 
Dom selecting & jQuery
Dom selecting & jQueryDom selecting & jQuery
Dom selecting & jQuery
 
React 소개 및 구현방법 Demo
React 소개 및 구현방법 DemoReact 소개 및 구현방법 Demo
React 소개 및 구현방법 Demo
 
Data binding w Androidzie
Data binding w AndroidzieData binding w Androidzie
Data binding w Androidzie
 
AngularJS for designers and developers
AngularJS for designers and developersAngularJS for designers and developers
AngularJS for designers and developers
 
Modern frontend development with VueJs
Modern frontend development with VueJsModern frontend development with VueJs
Modern frontend development with VueJs
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
Client Web
Client WebClient Web
Client Web
 
Modern Web Application Development Workflow - EclipseCon Europe 2014
Modern Web Application Development Workflow - EclipseCon Europe 2014Modern Web Application Development Workflow - EclipseCon Europe 2014
Modern Web Application Development Workflow - EclipseCon Europe 2014
 
The Complementarity of React and Web Components
The Complementarity of React and Web ComponentsThe Complementarity of React and Web Components
The Complementarity of React and Web Components
 
React
React React
React
 
Why and How to Use Virtual DOM
Why and How to Use Virtual DOMWhy and How to Use Virtual DOM
Why and How to Use Virtual DOM
 
The AngularJS way
The AngularJS wayThe AngularJS way
The AngularJS way
 
Web Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing CombinationWeb Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing Combination
 
Levent-Gurses' Introduction to Web Components & Polymer
Levent-Gurses' Introduction to Web Components & PolymerLevent-Gurses' Introduction to Web Components & Polymer
Levent-Gurses' Introduction to Web Components & Polymer
 
[FEConf Korea 2017]Angular 컴포넌트 대화법
[FEConf Korea 2017]Angular 컴포넌트 대화법[FEConf Korea 2017]Angular 컴포넌트 대화법
[FEConf Korea 2017]Angular 컴포넌트 대화법
 
Building a Startup Stack with AngularJS
Building a Startup Stack with AngularJSBuilding a Startup Stack with AngularJS
Building a Startup Stack with AngularJS
 
Week 8
Week 8Week 8
Week 8
 
JavaScript - Chapter 11 - Events
 JavaScript - Chapter 11 - Events  JavaScript - Chapter 11 - Events
JavaScript - Chapter 11 - Events
 
Web Components
Web ComponentsWeb Components
Web Components
 

Viewers also liked

An introduction to knockout.js
An introduction to knockout.jsAn introduction to knockout.js
An introduction to knockout.jsEmanuele DelBono
 
Introduction to Knockoutjs
Introduction to KnockoutjsIntroduction to Knockoutjs
Introduction to Knockoutjsjhoguet
 
Knockout (support slides for presentation)
Knockout (support slides for presentation)Knockout (support slides for presentation)
Knockout (support slides for presentation)Aymeric Gaurat-Apelli
 
Knockout js
Knockout jsKnockout js
Knockout jshhassann
 
Asp.Net MVC - Razor Syntax
Asp.Net MVC - Razor SyntaxAsp.Net MVC - Razor Syntax
Asp.Net MVC - Razor SyntaxRenier Serven
 
HTML 5, ASP.NET MVC & Windows Azure sessie voor Ivo Brugge
HTML 5, ASP.NET MVC & Windows Azure sessie voor Ivo BruggeHTML 5, ASP.NET MVC & Windows Azure sessie voor Ivo Brugge
HTML 5, ASP.NET MVC & Windows Azure sessie voor Ivo BruggePureplexity
 
Knockout JS Development - a Quick Understanding
Knockout JS Development - a Quick UnderstandingKnockout JS Development - a Quick Understanding
Knockout JS Development - a Quick UnderstandingUdaya Kumar
 
#2 Hanoi Magento Meetup - Part 2: Knockout JS
#2 Hanoi Magento Meetup - Part 2: Knockout JS#2 Hanoi Magento Meetup - Part 2: Knockout JS
#2 Hanoi Magento Meetup - Part 2: Knockout JSHanoi MagentoMeetup
 
An Introduction to Ajax Programming
An Introduction to Ajax ProgrammingAn Introduction to Ajax Programming
An Introduction to Ajax Programminghchen1
 
Design for Developers: Introduction to Bootstrap 3
Design for Developers: Introduction to Bootstrap 3Design for Developers: Introduction to Bootstrap 3
Design for Developers: Introduction to Bootstrap 3John Bertucci
 

Viewers also liked (20)

An introduction to knockout.js
An introduction to knockout.jsAn introduction to knockout.js
An introduction to knockout.js
 
Introduction to Knockoutjs
Introduction to KnockoutjsIntroduction to Knockoutjs
Introduction to Knockoutjs
 
Knockout.js explained
Knockout.js explainedKnockout.js explained
Knockout.js explained
 
Wcf
WcfWcf
Wcf
 
jQuery in 10 minuten
jQuery in 10 minutenjQuery in 10 minuten
jQuery in 10 minuten
 
Knockout js
Knockout jsKnockout js
Knockout js
 
Knockout js (Dennis Haney)
Knockout js (Dennis Haney)Knockout js (Dennis Haney)
Knockout js (Dennis Haney)
 
knockout.js
knockout.jsknockout.js
knockout.js
 
Knockout (support slides for presentation)
Knockout (support slides for presentation)Knockout (support slides for presentation)
Knockout (support slides for presentation)
 
Knockout.js
Knockout.jsKnockout.js
Knockout.js
 
Knockout js
Knockout jsKnockout js
Knockout js
 
Asp.Net MVC - Razor Syntax
Asp.Net MVC - Razor SyntaxAsp.Net MVC - Razor Syntax
Asp.Net MVC - Razor Syntax
 
HTML 5, ASP.NET MVC & Windows Azure sessie voor Ivo Brugge
HTML 5, ASP.NET MVC & Windows Azure sessie voor Ivo BruggeHTML 5, ASP.NET MVC & Windows Azure sessie voor Ivo Brugge
HTML 5, ASP.NET MVC & Windows Azure sessie voor Ivo Brugge
 
Knockout JS Development - a Quick Understanding
Knockout JS Development - a Quick UnderstandingKnockout JS Development - a Quick Understanding
Knockout JS Development - a Quick Understanding
 
Knockout js
Knockout jsKnockout js
Knockout js
 
#2 Hanoi Magento Meetup - Part 2: Knockout JS
#2 Hanoi Magento Meetup - Part 2: Knockout JS#2 Hanoi Magento Meetup - Part 2: Knockout JS
#2 Hanoi Magento Meetup - Part 2: Knockout JS
 
An Introduction to Ajax Programming
An Introduction to Ajax ProgrammingAn Introduction to Ajax Programming
An Introduction to Ajax Programming
 
Design for Developers: Introduction to Bootstrap 3
Design for Developers: Introduction to Bootstrap 3Design for Developers: Introduction to Bootstrap 3
Design for Developers: Introduction to Bootstrap 3
 
Ajax Ppt
Ajax PptAjax Ppt
Ajax Ppt
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
 

Similar to KNOCKOUT.JS INTRO AND TODO APP

Private slideshow
Private slideshowPrivate slideshow
Private slideshowsblackman
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoRob Bontekoe
 
Backbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVCBackbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVCpootsbook
 
Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007Netvibes
 
Single page webapps & javascript-testing
Single page webapps & javascript-testingSingle page webapps & javascript-testing
Single page webapps & javascript-testingsmontanari
 
Vidéo approche en immobilier
Vidéo approche en immobilierVidéo approche en immobilier
Vidéo approche en immobilierhervepouliot
 
Reactive Type-safe WebComponents
Reactive Type-safe WebComponentsReactive Type-safe WebComponents
Reactive Type-safe WebComponentsMartin Hochel
 
Big Data for each one of us
Big Data for each one of usBig Data for each one of us
Big Data for each one of usOSCON Byrum
 
How to Mess Up Your Angular UI Components
How to Mess Up Your Angular UI ComponentsHow to Mess Up Your Angular UI Components
How to Mess Up Your Angular UI Componentscagataycivici
 
Elinvoimaa hunajasta-yleist-hunajatietoa-ja-kyttvinkkej
Elinvoimaa hunajasta-yleist-hunajatietoa-ja-kyttvinkkejElinvoimaa hunajasta-yleist-hunajatietoa-ja-kyttvinkkej
Elinvoimaa hunajasta-yleist-hunajatietoa-ja-kyttvinkkejPertti Paavola
 

Similar to KNOCKOUT.JS INTRO AND TODO APP (20)

Backbone - TDC 2011 Floripa
Backbone - TDC 2011 FloripaBackbone - TDC 2011 Floripa
Backbone - TDC 2011 Floripa
 
Django quickstart
Django quickstartDjango quickstart
Django quickstart
 
Private slideshow
Private slideshowPrivate slideshow
Private slideshow
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" Domino
 
Backbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVCBackbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVC
 
Xxx
XxxXxx
Xxx
 
Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007
 
Single page webapps & javascript-testing
Single page webapps & javascript-testingSingle page webapps & javascript-testing
Single page webapps & javascript-testing
 
Vidéo approche en immobilier
Vidéo approche en immobilierVidéo approche en immobilier
Vidéo approche en immobilier
 
Reactive Type-safe WebComponents
Reactive Type-safe WebComponentsReactive Type-safe WebComponents
Reactive Type-safe WebComponents
 
Clean Javascript
Clean JavascriptClean Javascript
Clean Javascript
 
course js day 3
course js day 3course js day 3
course js day 3
 
Stole16
Stole16Stole16
Stole16
 
JavaScript Refactoring
JavaScript RefactoringJavaScript Refactoring
JavaScript Refactoring
 
Big Data for each one of us
Big Data for each one of usBig Data for each one of us
Big Data for each one of us
 
Frontin like-a-backer
Frontin like-a-backerFrontin like-a-backer
Frontin like-a-backer
 
How to Mess Up Your Angular UI Components
How to Mess Up Your Angular UI ComponentsHow to Mess Up Your Angular UI Components
How to Mess Up Your Angular UI Components
 
Elinvoimaa hunajasta-yleist-hunajatietoa-ja-kyttvinkkej
Elinvoimaa hunajasta-yleist-hunajatietoa-ja-kyttvinkkejElinvoimaa hunajasta-yleist-hunajatietoa-ja-kyttvinkkej
Elinvoimaa hunajasta-yleist-hunajatietoa-ja-kyttvinkkej
 
Meteor Day Talk
Meteor Day TalkMeteor Day Talk
Meteor Day Talk
 
前端概述
前端概述前端概述
前端概述
 

Recently uploaded

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Recently uploaded (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

KNOCKOUT.JS INTRO AND TODO APP

  • 1. KNOCKOUT.JS Scott Messinger - Baltimore JS Meetup - July 27, 2011
  • 10. PART 1: CONTACT EDITOR. HTTP://JSBIN.COM/UVUBEM/6/EDIT
  • 11. PART 2: TO DO LIST http://jsfiddle.net/scottmessinger/pC4zY/16/
  • 12. LET ME SHOW YOU AROUND.
  • 13. TASK 1: SHOW SOME TODOS http://jsfiddle.net/scottmessinger/RtGyu/5/ http://knockoutjs.com/documentation/introduction.html
  • 14. Do the highlights. Add “todo done” classes if done Add “todo” if not done.     <script id="todoitemtemplate"type="text/html">       <li>         <div data-bind="">           <div class="display">             <input class="check"type="checkbox" data-bind="" />             <div class="todo-content"contenteditable="true" data-bind=""></div>             <span class="todo-destroy" data-bind=""></span>           </div>         </div>       </li>     </script>      http://jsfiddle.net/scottmessinger/RtGyu/5/
  • 15. The answer!       <ul id="todo-list" data-bind="template: { name: 'todoitemtemplate', foreach: todos }">       </ul>     <script id="todoitemtemplate"type="text/html">       <li>         <div data-bind="attr: { class : done() ? 'todo done' : 'todo'}">           <div class="display">             <input class="check"type="checkbox" data-bind="checked: done" />             <div class="todo-content"contenteditable="true" data-bind="text: content"></di             <span class="todo-destroy" data-bind="click: viewModel.remove"></span>           </div>         </div>       </li>     </script>
  • 16. TASK 2: REMOVE SOME TODOS http://jsfiddle.net/scottmessinger/RtGyu/5/ http://knockoutjs.com/documentation/introduction.html
  • 17. Do the highlights.         <div id="todo-stats" >             // CODE             <span class="todo-clear" data-bind="visible: done().length > 0">               <a href="#" data-bind=""> // CODE               </a>             </span>         </div>     <script id="todoitemtemplate"type="text/html">       <li>         <div data-bind="attr: { class : done() ? 'todo done' : 'todo'}">           <div class="display">             <input class="check"type="checkbox" data-bind="checked: done" />             <div class="todo-content"contenteditable="true" data-bind="text: content"></div>             <span class="todo-destroy" data-bind=""></span>           </div>         </div>       </li>     </script>
  • 18. Do the highlights.         <div id="todo-stats" >             // CODE             <span class="todo-clear" data-bind="visible: done().length > 0">               <a href="#" data-bind="click: viewModel.removeCompleted"> // CODE               </a>             </span>         </div>     <script id="todoitemtemplate"type="text/html">       <li>         <div data-bind="attr: { class : done() ? 'todo done' : 'todo'}">           <div class="display">             <input class="check"type="checkbox" data-bind="checked: done" />             <div class="todo-content"contenteditable="true" data-bind="text: content"></div>             <span class="todo-destroy" data-bind="click: viewModel.remove"></span>           </div>         </div>       </li>     </script>
  • 19. Do the highlights // VIEWMODEL var viewModel = {     todos: ko.observableArray(),     current: ko.observable(),     add: function (event) {         if (event.keyCode === 13) {             var newTodo = new Todo(this.current());             this.todos.push(newTodo); Methods to             console.log(newTodo) Know:             this.current("");         }     }, remove() removeAll()     remove: function (event) {         viewModel.todos.remove(this);     },     removeCompleted: function (event) {         viewModel.todos.removeAll(viewModel.done());     } };
  • 20. Do the highlights // VIEWMODEL var viewModel = {     todos: ko.observableArray(),     current: ko.observable(),     add: function (event) {         if (event.keyCode === 13) {             var newTodo = new Todo(this.current());             this.todos.push(newTodo); Methods to             console.log(newTodo) Know:             this.current("");         }     }, remove()     remove: function (event) { removeAll()     },     removeCompleted: function (event) {     } };
  • 23. Learning more about knockout.js knockoutjs.com knockmeout.net https://groups.google.com/ forum/#!forum/knockoutjs

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n