cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

    <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" />
    <script src="https://code.angularjs.org/1.3.3/angular.min.js"></script>
    <script src="app.js"></script>
<body ng-app="validationApp" ng-controller="mainController">
<div class="container">

  <h1>AngularJS form validation example</h1>
    <form name="form" ng-submit="submitForm(form.$valid)" novalidate>

        <div class="form-group" ng-class="{ 'has-error' : form.name.$invalid && (!form.name.$pristine || submitted)}">
            <input type="text" name="name" class="form-control" ng-model="userForm.name" required>
            <p ng-show="form.name.$invalid && (!form.name.$pristine || submitted)" class="help-block">Please enter a name</p>
        <div class="form-group" ng-class="{ 'has-error' : form.username.$invalid && (!form.username.$pristine|| submitted)}">
            <input type="text" name="username" class="form-control" ng-model="userForm.username" ng-minlength="3" ng-maxlength="8">
            <p ng-show="form.username.$error.minlength" class="help-block">Username is too short.</p>
            <p ng-show="form.username.$error.maxlength" class="help-block">Username is too long.</p>
        <!-- EMAIL -->
        <div class="form-group" ng-class="{ 'has-error' : form.email.$invalid && !form.email.$pristine }">
            <input type="email" name="email" class="form-control" ng-model="userForm.email">
            <p ng-show="form.email.$invalid && !form.email.$pristine" class="help-block">Please enter a valid email.</p>
        <button type="submit" class="btn btn-primary">Submit</button>

              // create angular app
var app = angular.module('validationApp', []);

// create angular controller
app.controller('mainController', function($scope) {

	// function to submit the form after all validation has occurred			
	$scope.submitForm = function(isValid) {
    $scope.submitted = true;
		// check to make sure the form is completely valid
		if (isValid) { 
			alert('form is valid');


Loading ..................