Pen Settings

HTML

CSS

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.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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.

+ add another resource

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container" ng-app="formApp">
  <form role="form" class="form-horizontal" name="userForm" ng-submit="submitForm()" ng-controller="FormCtr"
    novalidate>
    <div class="form-group" ng-class="{'has-error': userForm.username.$touched && userForm.username.$invalid}">
      <label class="col-sm-4 control-label" for="username">Name: </label>
      <div class="col-sm-7">
        <input id="username" name="username" placeholder="Name" class="form-control"
          ng-minlength="3" ng-maxlength="8" ng-required="true" ng-model="user.username" />
        <div class="help-block" ng-messages="userForm.username.$touched && userForm.username.$error">
          <div ng-message="required">Name should't be empty</div>
          <div ng-message="minlength">Name should't be less than 3 chars</div>
          <div ng-message="maxlength">Name should't be more than 8 chars</div>
        </div>
      </div>
    </div>
    <div class="form-group" ng-class="{'has-error': userForm.password.$touched && userForm.password.$invalid}">
      <label class="col-sm-4 control-label" for="password">Password: </label>
      <div class="col-sm-7">
        <input type="password" id="password" name="password" placeholder="Password" class="form-control"
          ng-model="user.password" ng-required="true" ng-minlength="6" maxlength="20" />
        <div class="help-block" ng-messages="userForm.password.$touched && userForm.password.$error">
          <div ng-message="required">Password should't be empty</div>
          <div ng-message="minlength">Password should't be less than 6 chars</div>
        </div>
      </div>
    </div>
    <div class="form-group offset">
      <div class="col-sm-offset-4 col-sm-8">
        <button type="submit" class="btn btn-primary" ng-disabled="userForm.$invalid">Submit</button>
        <button type="reset" class="btn btn-default" ng-click="userForm.$setUntouched()">Reset</button>
      </div>
    </div>
  </form>
</div>
              
            
!

CSS

              
                body {
  margin-top: 20px;
}

.help-block {
  color: #a94442;
}

.form-group.has-error label {
  color: #a94442;
}

.form-group.has-error .form-control {
  border-color: #a94442;
  outline: none;
  box-shadow: none;
}

.form-control {
  width: auto;
}
              
            
!

JS

              
                angular.module('formApp', ['ngMessages'])
  .controller('FormCtr', function($scope) {
    $scope.submitForm = function() {
      alert('Passed');
    };
  });
              
            
!
999px

Console