Angular JS

This is a demo I created to try out AngularJS, one of several new javascript libraries (or frameworks) that are trending right now.

Type some text here:

You typed: {{ user.text }}
You made a copy: {{ user.copy }}

Source Code

<p>
	Type some text here: 
	<input type="text" ng-model="user.text" />
	<button ng-click="duplicate(user)">Make a copy
	<button ng-click="clear(user)">Clear
</p>
<p>
	You typed: {{ user.text }}
You made a copy: {{ user.copy }} </p>
// javascript code
function controller($scope) {
	
	// make a copy of the form
	$scope.duplicate = function(user) {
		$scope.user.copy = angular.copy(user.text);
	}
	// clear the form
	$scope.clear = function(user) {
		$scope.user.text = "";
		$scope.user.copy = "";
	}
}