0.1.0 • Published 10 years ago

baobab-angular v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

baobab-angular

A state handling library for Angular, based on Baobab

angular.module('app', ['baobab'])
  .tree('myTree', function () {
    return {
      todos: []
    };
  })
  .controller('MyCtrl', function ($scope, myTree) {
    
    $scope.todos = myTree.select('todos').get();

    $scope.addTodo = function () {
      myTree.todos.push('foo');
    };
  
    $scope.$listenTo(myTree.todos, function () {
      $scope.todos = myTree.select('todos').get();
    });

  });
0.1.0

10 years ago