Created
August 29, 2010 18:48
-
-
Save mhevery/556555 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html xmlns:ng="http://angularjs.org"> | |
<head> | |
<script type="text/javascript" src="http://angularjs.org/ng/js/angular-debug.js" ng:autobind></script> | |
<script> | |
function Texts(){ | |
this.items = []; | |
} | |
Texts.prototype.addText = function(){ | |
this.items.push(new Text()); | |
} | |
function Text(){ | |
} | |
Text.prototype.copy = function() { | |
this.contentCopy = angular.copy(this.content); | |
} | |
</script> | |
</head> | |
<body> | |
<div ng:controller="Texts"> | |
<button type="submit" ng:click="addText()">more!</button> | |
<ul id="texts"> | |
<div ng:repeat="text in items"> | |
<li ng:controller="Text"> | |
<button ng:click="text.copy()">copy</button> | |
<button ng:click="items.$remove(text)">delete</button> | |
<input name="text.content" type="text"/> -> {{text.contentCopy}} | |
</li> | |
</div> | |
</ul> | |
</div> | |
<hr/> | |
<!--Debug View:--> | |
<pre>items={{items}}</pre> | |
<!-- --> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment