dir.by  
Поиск >>

Компьютер, программы
→
Knockout.js - JavaScript library for binding an HTML element to a js variable
  Html  
<html>
<body>

     <!-- подключаем библиотеку knockout -->
     <script src="knockout-3.5.0rc2.js"></script>

     <!-- html элементы -->
     <p><text data-bind="text: fullName"></text></p>

     <!-- data model -->
     <script>
          var MyModel = function() {

               this.fullName = ko.pureComputed(
                                                       function () { return "Hello Evgen"; } ,
                                                       this
                                                       );
          };
     </script>

     <script>
          // свзяываем нашу модель MyModel с knockout
          ko.applyBindings(new MyModel());
     </script>

</body>
</html>
 
← Previous topic
Linking the HTML element to the model
 
Next topic →
observable computed
 
Your feedback ... Comments ...
   
Your Name
Your comment (www links can only be added by a logged-in user)

Новость "Черная пятница" Dreame в Беларуси – две недели скидок до 3400 рублей
 
• Download knockout
• Linking the HTML element to the model
• pureComputed
• observable computed
• New (custom) data-bind in Knockout.js
• Books

  Ваши вопросы присылайте по почте: info@dir.by