AngularJS Forms

<!DOCTYPE html>
<html lang=”en”>
<script src=””></script>

<div ng-app=”myApp” ng-controller=”formCtrl”>
<form novalidate>
First Name:<br>
<input type=”text” ng-model=”user.firstName”><br>
Last Name:<br>
<input type=”text” ng-model=”user.lastName”>
<button ng-click=”reset()”>RESET</button>
<p>form = {{user}}</p>
<p>master = {{master}}</p>

var app = angular.module(‘myApp’, []);
app.controller(‘formCtrl’, function($scope) {
$scope.master = {firstName:”John”, lastName:”Doe”};
$scope.reset = function() {
$scope.user = angular.copy($scope.master);


It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *