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.



  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">


  <link href="" rel="stylesheet">
  <script src=""></script>
  <script src=""></script>

<body ng-app="starter">

   <ion-pane ng-controller="TodoController">
     <ion-header-bar class="bar-stable">
       <div class="buttons">
        <button class="button button-icon icon ion-ios-minus-outline"
          ng-click="showDelete = !showDelete"></button>
       <h1 class="title">ToDo</h1>
       <button class="right button button-icon icon ion-plus" ng-click="create()"></button>
       <ion-list show-delete="showDelete">
         <ion-item ng-repeat="todo in todos | orderBy:'done'">
           <ion-checkbox ng-model="todo.done" ng-change="update(todo)">{{todo.title}}</ion-checkbox>
            <ion-delete-button class="ion-minus-circled" ng-click="todos.splice($index, 1)">







                // Ionic Starter App
var localDB = new PouchDB("todos");
var remoteDB = new PouchDB("");

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
var app = angular.module('starter', ['ionic'])

.run(function($ionicPlatform) {
  localDB.sync(remoteDB, {
    live: true

app.factory('PouchDBListener', ['$rootScope', function($rootScope) {
    continuous: true,
    onChange: function(change) {
      if (!change.deleted) {
        $rootScope.$apply(function() {
          localDB.get(, function(err, doc) {
            $rootScope.$apply(function() {
              if (err) console.log(err);
              $rootScope.$broadcast('add', doc);
      } else {
        $rootScope.$apply(function() {
  return true;

app.controller("TodoController", function($scope, $ionicPopup, PouchDBListener) {
  $scope.todos = [];
  $scope.showDelete = false;
  $scope.create = function() {
        title: 'Enter a new TODO',
        inputType: 'text'
      .then(function(result) {
        if (result) {
          if ($scope.hasOwnProperty("todos") !== true) {
            $scope.todos = [];
            title: result,
            done: false
        } else {
          console.log("Action cancelled.");

  $scope.update = function(todo) {
        _id: todo._id,
        _rev: todo._rev,
        title: todo.title,
        done: todo.done
      .then(function(result) {
        // You set some action after the item was updated.
  $scope.$on('add', function(event, todo) {
    var add = true;
    angular.forEach($scope.todos, function(value, key) {
      if (value._id == todo._id) {
        $scope.todos[key] = todo;
        add = false;
    if (add) {

  $scope.$on('delete', function(event, id) {
    for (var i = 0; i < $scope.todos.length; i++) {
      if ($scope.todos[i]._id === id) {
        $scope.todos.splice(i, 1);