Prev Home Next

10 Two containers data-linked to the same array

Script:

// Render to string and data-link to people (compact syntax)
$( "#details" ).link( people, "#personTmpl1" );

$( "#details2" ).link( people, "#personTmpl2" );

// Observable array change
$( "#insertPerson" ).click( function() {
	$.observable( people ).insert( 0, { firstName: "NewPerson" });
});