AngularJS 1.0rc1 copy form to model
HTML
<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/redmond/jquery-ui.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.8.2/css/jquery.dataTables.css">
<div ng-app="example">
<div ng-controller="Ctrl">
<form name="myForm">
<input type="text" ng-model="x.value1" value="This does work now" />
<input type="text" ng:model="x.value2" value="This does work now" />
<input type="text" ng_model="x.value3" value="This does work now" />
<input type="text" ng-model="unnested" value="This does work now" />
<br>
<a ng-href='#here' ng-click='go()' >click me</a>
</form>
<hr/>
{{x}}
</div>
</div>
<input type="text" value="This Works" />
CSS
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
<!-- DataTables -->
<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.8.2/jquery.dataTables.min.js"></script>
<script src="http://code.angularjs.org/angular-1.0.0rc1.js"></script>
<style>
.ng-invalid { border: 1px solid red; }
body { font-family: Arial,Helvetica,sans-serif; }
body, td, th { font-size: 14px; margin: 0; }
table { border-collapse: separate; border-spacing: 2px; display: table; margin-bottom: 0; margin-top: 0; -moz-box-sizing: border-box; text-indent: 0; }
a:link, a:visited, a:hover { color: #5D6DB6; text-decoration: none; }
.error { color: red; }
.ui-helper-hidden { display: none;}
JavaScript
var dialogApp = angular.module('example', []);
dialogApp.directive('value', function($parse) {
return function(scope, element, attrs) {
$parse(attrs.ngModel).assign(scope, attrs.value);
}
});
$scope.go = function() {
$scope.msg = 'clicked';
}
function Ctrl($scope) {
//$scope.x = {};
}