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.

Quick-add: + add another resource

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.

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;

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