mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
55 lines
1.9 KiB
HTML
55 lines
1.9 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
<head>
|
|
<script type="text/javascript" src="../lib/underscore/underscore.js"></script>
|
|
<script type="text/javascript" src="../lib/jquery/jquery-1.3.2.js"></script>
|
|
<script type="text/javascript" src="../src/angular-bootstrap.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){
|
|
var scope = angular.compile(document);
|
|
scope.init();
|
|
scope.set("add", function(){
|
|
var partial = $("#partial");
|
|
//id++;
|
|
partial.html('<div>{{ error() }}<br/></div>');
|
|
var scope = angular.compile(partial);
|
|
scope.set("hello", function (){
|
|
return 'who dat?';
|
|
});
|
|
scope.set("error", function (){
|
|
this.misko.length;
|
|
});
|
|
function XXXXXXXXX(){};
|
|
scope.set('xxx', new XXXXXXXXX());
|
|
scope.set("names", ["adam", "misko", "shyam"]);
|
|
scope.init();
|
|
});
|
|
scope.set("remove", function(){
|
|
var partial = $("#partial");
|
|
/*
|
|
partial.find('*').andSelf().each(function(){
|
|
var scope = $(this).data('scope');
|
|
if (scope) {
|
|
delete scope.state;
|
|
delete scope.widgets;
|
|
}
|
|
var cntl = $(this).data('controller');
|
|
if (cntl) {
|
|
delete cntl.view;
|
|
}
|
|
$(this).removeData();
|
|
});
|
|
*/
|
|
partial.removeData('scope');
|
|
partial.children().remove();
|
|
});
|
|
});
|
|
</script>
|
|
<link rel="StyleSheet" type="text/css" href="../css/angular.css"/>
|
|
</head>
|
|
<body>
|
|
<input type="button" value="add" ng:click="add()"/>
|
|
<input type="button" value="remove" ng:click="remove()"/>
|
|
<div id="partial"></div>
|
|
</body>
|
|
</html>
|