bing
Flat 10% & upto 50% off + Free additional Courses. Hurry up!
×
UPTO
50%
OFF!

AngularJS Forms

 

A Form is a set of controls for the purpose of grouping related controls together that means it is a collection of input controls. Controls like input, select, textarea are the ways for a user to enter data. Form and controls give validation services so that the user can be informed of invalid input before submitting a form.

 Example

<!DOCTYPE html>

<html lang="en">

<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>

<body>

<div ng-app="formApp" ng-controller="formCtrl">

<form>

First Name:<br>

<input type="text" ng-model="user.Name"><br>

<button ng-click="reset()">Reset</button>

</form>

<p>user = {{user}}</p>

<p>master = {{master}}</p>

</div>

<script>

var app = angular.module('formApp', []);

app.controller('formCtrl', function($scope) {

$scope.master = {Name:"abc"};

$scope.reset = function() {

$scope.user = angular.copy($scope.master);

};

$scope.reset();

});

</script>

</body>

</html>

Output

o16

In this example,

ng-app –It defines the AngularJS application.

ng-model – Connect the values of application data to HTML input controls.

ng-controller – It defines the application controller.

formCtrl – This function puts initial values to the master object and describes the reset() method.

reset() – This method puts the user object equal to the master object.

ng-click – It calls the reset() method only if the button is clicked.

Attribute novalidate can also used with form to override HTML5 validation.

"0 Responses on AngularJS Forms"

100% Secure Payments. All major credit & debit cards accepted Or Pay by Paypal.
top

Sales Offer

  • To avail this offer, enroll before 27th June 2017.
  • This offer cannot be combined with any other offer.
  • This offer is valid on selected courses only.
  • Please use coupon codes mentioned below to avail the offer
offer-june

Sign Up or Login to view the Free AngularJS Forms.