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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

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.

              <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;

🕑 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 ..................