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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

              <body ng-controller="DemoCtrl" class="container" ng-app="myTodoApp" ng-init="readList()">
  <h2>Backand Real-time Todo Example</h2>
  <h4>Try it by opening two browsers and update / add / remove a TODO</h4>
    <!-- Todos input -->
    <form role="form" ng-submit="create({'description': description}); description = '';">
        <div class="row">
            <div class="input-group">
                <input type="text" ng-model="description" placeholder="What needs to be done?" class="form-control">
                <span class="input-group-btn">
                  <input type="submit" class="btn btn-primary" value="Add" ng-disabled="!description">

    <!-- Todos list -->
        <p  class="input-group"
            ng-repeat="todo in todos | orderBy:'-id'"
            style="padding:5px 10px; cursor: move;"
            ng-class="{'todo-completed': todo.completed}">
            <span class="input-group-btn">
                <button class="btn"><input type="checkbox" class="btn btn-primary" ng-model="todo.completed" ng-click="update(todo)"></button> 
            <input  type="text"
                    ng-model-options="{updateOn: 'blur'}"
                    class="form-control" >
            <span class="input-group-btn">
                <button class="btn btn-danger" ng-click="delete(todo)" aria-label="Remove">X</button>
              var myApp = angular.module('myTodoApp', ['backand']);

myApp.config(function (BackandProvider) {
    // BackandProvider.setAppName('backandtodoapp');
    // BackandProvider.setSignUpToken('76a0ed19-c9d4-405a-9e20-493d637b131c');
    // BackandProvider.setAnonymousToken('6adbc622-36b5-496c-b288-19ea28816f10');
    // BackandProvider.runSocket(true);

myApp.controller('DemoCtrl', ['$scope', 'Backand', DemoCtrl]);

function DemoCtrl($scope, Backand) {

    var objectName = 'todo';
    $scope.todos = null;
    Backand.on('todo_updated', function (data) {
      //Get the event and refresh the list
      console.log("event:" + data);
    $scope.readList = function() {
      var params = {
        pageSize: 30,
        pageNumber: 1,
        filter: null,
        sort: [{fieldName:'id', order:'desc'}]
      Backand.object.getList(objectName, params).then(function(response) {
        $scope.todos = response.data;
    $scope.readOne = function(id) {
      Backand.object.getOne(objectName, id).then(function(response) {
        return response.data;

    $scope.create = function(newTodo) {
      console.log("create new socket");
      Backand.object.create(objectName, newTodo, {returnObject: true}).then(function(response) {
        return response.data;

    $scope.update = function(todo) {
      Backand.object.update(objectName, todo.id, todo).then(function(response) {
        return response.data;

    $scope.delete = function(todo) {
      Backand.object.remove(objectName, todo.id).then(function(response) {
        return response.data;


Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.


Loading ..................