当前位置: 动力学知识库 > 问答 > 编程问答 >

html5 - Javascript databinding and templating with datasets

问题描述:

Is there any native way of doing data binding with HTML5 attributes and javascript?

I have seen:

  • angular
  • code project dataset - http://www.codeproject.com/Articles/30584/Javascript-Dataset-Data-Repeater-and-Grid
  • Knockout

being used... but was wondering if there is a native way of doing it?

Bing / Google are not being so helpful with this one.

I was imagining something along the lines of this (Just some pseudo code but hoped it might help you to understand what I was asking for):

HTML

<ul id = "People"></ul>

<--Start:DataTemplate:List-->

<li><!--Name--> is <--Age--></li>

<--End:DataTemplate-->

JavaScript

var data = {

{ Name: "James", Age: 25 }

{ Name: "Bob", Age: 55 }

}

var myList = new Templater();

myList.Bind( "List", data, "People" );

data.push( { Name: "Mike", Age: 45 } );

myList.Update();

分享给朋友:
您可能感兴趣的文章:
随机阅读: