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.

+ add another resource


Babel includes JSX processing.

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


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


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.


                <div ng-controller="InputController">
    <input ng-bind="message"/>   
    <input ng-bind="message"/>   
    <button onclick="onButtonClick()">Click!</button>




                /* Framework code */
(function () {
  var controllers = {};
  var addController = function (name, constructor) {
    // Store controller constructor
    controllers[name] = {
      factory: constructor,
      instances: []

    // Look for elements using the controller 
    var element = document.querySelector('[ng-controller=' + name + ']');
    if (!element){   

    // Create a new instance and save it
    var ctrl = new controllers[name].factory();

    // Get elements bound to properties
    var bindings = {};'[ng-bind]'))
      .map(function (element) {
      var boundValue = element.getAttribute('ng-bind');

      if (!bindings[boundValue]) {
        bindings[boundValue] = {
          boundValue: boundValue,
          elements: []


    // Update DOM element bound when controller property is set
    var proxy = new Proxy (ctrl, {
      set: function (target, prop, value) {    
        var bind = bindings[prop];
        if (bind) {  
          bind.elements.forEach(function (element) {
            element.value = value;
            element.setAttribute('value', value);
        return Reflect.set(target, prop, value);

    // Listen DOM element update to set the controller property
    Object.keys(bindings).forEach(function (boundValue) {
      var bind = bindings[boundValue];
      bind.elements.forEach(function (element) {
        element.addEventListener('input', function (event) {
          proxy[bind.boundValue] =;

    // Fill proxy with ctrl properties
    // and return proxy, not the ctrl !
    Object.assign(proxy, ctrl);
    return proxy;

  // Export framework in window
  this.angular = {
  	controller: addController
/* User code */
function InputController () {
  this.message = 'Hello World!';

var myInputController = angular.controller('InputController', InputController);

function onButtonClick () {
  myInputController.message = 'Clicked!';