cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

              <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<script src="https://code.angularjs.org/1.2.6/angular.min.js"></script>
<script src="https://cdn.firebase.com/v0/firebase.js"></script>
<script src="https://cdn.firebase.com/libs/angularfire/0.5.0/angularfire.min.js"></script>

<body ng-controller="DemoCtrl" class="container"  ng-app="DemoApp">

<h2>Realtime ToDo list with AngularJS and AngularFire</h2>
<h4>Try it opening two browsers and adding / removing a TODO</h4>

 <form name="myForm">

         <input type="text"
                placeholder="Add new task (min 3 chars)"
                required ng-minlength="3"
                ng-keyup="($event.keyCode == 13 && todoName.length > 2) ? addItem() : return"
                style="margin-bottom: 10px"

         <button ng-click="addItem()"
                         class="btn btn-primary" type="button"
                         >Save Todo</button>



<!--TODO LIST-->
<div ng-repeat="item in todos" class=" list-group-item row">

    <div  class="col-md-6">
        <!--COMPLETED ICON-->
         <span class="glyphicon glyphicon-thumbs-up"
               ng-show="item.completed"> </span>

        <!--todo label-->
        <span>{{item.name}} </span>

        <small  class="text-warning"> [ {{item.id}} ]</small>

    <div  class="col-md-6">
        <!--Delete Todo button-->
        <a class="btn btn-danger" ng-click="removeItem($index, item, $event)">
            <i class="icon-remove-sign"></i>Delete

        <a class="btn btn-warning" ng-click="changeStatus(item)">
            <i class="icon-remove-sign"></i>Change Status


              var myApp = angular.module('DemoApp', ['firebase']);

myApp.constant("FIREBASE_URL", "https://codepen-public.firebaseio.com/firebase1demo/codepen/" )

function DemoCtrl($scope, $firebase, FIREBASE_URL) {

    // Get Stored TODOs
    var todosRef = new Firebase(FIREBASE_URL);
    $scope.todos = $firebase(todosRef);

    // Update the "completed" status
    $scope.changeStatus   = function (item) {

        // Get the Firebase reference of the item
        var itemRef = new  Firebase(FIREBASE_URL + item.id);

        // Firebase : Update the item
            id: item.id,
            name : item.name,
            completed: !item.completed


    // Remove a Todo
    $scope.removeItem   = function (index, item, event) {

       // Avoid wrong removing
       if (item.id == undefined)return;

       // Firebase: Remove item from the list


    // Add new TODO
    $scope.addItem  = function () {

        // Create a unique ID
        var timestamp = new Date().valueOf()

        // Get the Firebase reference of the item
        var itemRef = new Firebase(FIREBASE_URL + timestamp);

            id: timestamp,
            name : $scope.todoName,
            completed: false

        $scope.todoName = "";


🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................