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.







  .factory('YOUR_FACTORY', function($http){
    // This function will return an http promise
    var updateListing = function(listingId, YOUR_NEW_DATA) {
      Here is the data we are passing to the backend
      You can access this data on your server by doing something like this
      (if you are using node.js)
      var listingID = req.body.listingId
      var newData =
      var putData = {
        listingId : listingId,
        data : YOUR_NEW_DATA
      return $http({
        method: 'PUT',
        url : YOUR_END_POINT, // for example http://localhost:3000/api/listings
        data: putData
    // We return the functions we created so they can be accessed outside this factory
    return {
      updateListing : updateListing

// In your controller do something like

  .controller('YOUR_CONTROLLER', function($scope, YOUR_FACTORY){
    $scope.updateListing = function(listingId, newData) {
      Call the function we created in the service
      The function returns a promise, which has a .then .catch and .finally
      .then will run if the http request is successful
      .catch will run if the http request is unsuccessful
      .finally always runs, regardless if the request was successful or not
      YOUR_FACTORY.updateListing(listingId, newData)
          // do something with response
        .catch(function(err) {
          // do something with error
          // this will run everytime