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.


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

        <link href="" rel="stylesheet">
    <link rel="stylesheet" href="css/app.css">

    <script src=""></script>
    <script src="js/app.js"></script>
  <body ng-app="todo" ng-controller="TodoCtrl">
      <!-- Center content -->
        <ion-header-bar class="bar-positive">
          <button class="button button-icon" menu-toggle="left">
            <i class="icon ion-navicon"></i>
          <h1 class="title">{{activeProject.title}}</h1>
          <!-- New Task button-->
          <button class="button button-clear" ng-click="newTask()">
          <ion-list class="fade-in-not-out">
            <ion-checkbox ng-repeat="task in activeProject.tasks" ng-change="completionChanged()" ng-model="task.isComplete" ng-class="{complete: task.isComplete}">

      <!-- Left menu -->
      <ion-side-menu side="left">
        <ion-header-bar class="bar-positive">
          <h1 class="title">Projects</h1>
          <button class="button button-icon" ng-click="newProject()">
            <i class="ion ion-plus"></i>
            <ion-item ng-repeat="project in projects" ng-click="selectProject(project, $index)" ng-class="{active: activeProject == project}">

    <script id="new-task.html" type="text/ng-template">
      <div class="modal">
        <ion-header-bar class="bar-positive">
          <h1 class="title">New Task</h1>
          <button class="button button-clear" ng-click="closeNewTask()">Cancel</button>

          <form ng-submit="createTask(task)">
            <div class="list">
              <label class="item item-input">
                <input type="text"  ng-model="task.title">
            <div class="padding">
              <button type="submit" class="button button-block button-primary">Create Task</button>





                angular.module('todo', ['ionic'])

 * The Projects factory handles saving and loading projects
 * from local storage, and also lets us save and load the
 * last active project index.
.factory('Projects', function() {
  return {
    all: function() {
      var projectString = window.localStorage['projects'];
      if (projectString) {
        return angular.fromJson(projectString);
      return [];
    save: function(projects) {
      window.localStorage['projects'] = angular.toJson(projects);
    newProject: function(projectTitle) {
      // Add a new project
      return {
        title: projectTitle,
        tasks: []
    getLastActiveIndex: function() {
      return parseInt(window.localStorage['lastActiveProject']) || 0;
    setLastActiveIndex: function(index) {
      window.localStorage['lastActiveProject'] = index;

.controller('TodoCtrl', function($scope, $timeout, $ionicModal, Projects) {

  // A utility function for creating a new project
  // with the given projectTitle
  var createProject = function(projectTitle) {
    var newProject = Projects.newProject(projectTitle);
    $scope.selectProject(newProject, $scope.projects.length - 1);

  // Load or initialize projects
  $scope.projects = Projects.all();

  // Grab the last active, or the first project
  $scope.activeProject = $scope.projects[Projects.getLastActiveIndex()];

  // Called to create a new project
  $scope.newProject = function() {
    var projectTitle = prompt('Project name');
    if (projectTitle) {

  // Called to select the given project
  $scope.selectProject = function(project, index) {
    $scope.activeProject = project;

  $scope.completionChanged = function() {$scope.projects);

  // Create our modal
  $ionicModal.fromTemplateUrl('new-task.html', function(modal) {
    $scope.taskModal = modal;
  }, {
    focusFirstInput: false,
    scope: $scope

  $scope.createTask = function(task) {
    if (!$scope.activeProject) {
      title: task.title

    // Inefficient, but save all the projects$scope.projects);

    task.title = "";

  $scope.newTask = function() {

  $scope.closeNewTask = function() {

  $scope.toggleProjects = function() {

  // Try to create the first project, make sure to defer
  // this by using $timeout so everything is initialized
  // properly
  $timeout(function() {
    if ($scope.projects.length == 0) {
      while (true) {
        var projectTitle = prompt('Your first project title:');
        if (projectTitle) {