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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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-app="app" ng-controller="mainController">
  <h3>$scope.hasOwnProperty('myEvent'): {{ showEvent() }}</h3>
  <button custom-click="showEventType(myEvent)">Show myEvent.type</button>


                body {
  background-color: #eee;

h3 {
  margin: 5px;


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

app.controller('mainController', function ($scope) {
  $scope.showEvent = function () {
    return $scope.hasOwnProperty('myEvent');
  $scope.showEventType = function (e) {

app.directive('customClick', function () {
  return {
    // Restrict this directive to attributes only.
    restrict: 'A',
    // Whatever is passed to the "ng-click" attribute is an angular expression
    // and that expression will be stored on our isolate scope as "expression".
    scope: {
      expression: '&customClick'
    link: function (scope, element) {
      // "element" is the jQuery representation of the DOM element that was clicked.
      // We can simply call .on('click' just like we would in jQuery.
      element.on('click', function (e) {
        // Because this handler can be invoked at any time outside the Angular digest
        // loop, we need to tell Angular to track the logic about to happen so we call
        // scope.$apply.
        scope.$apply(function() {
          // Invoke our "expression" as a method. This triggers Angular to evaluate the
          // expression that was passed in. Also pass a hash with any variables this
          // directive has access to that the user of the directive might need to use
          // within the expression. In this case, define a variable called "$event" and
          // set it to the jQuery event that we received on click, "e".
          scope.expression({ myEvent: e });