Model.io : keep an eye on it [team]

posted in: AngularJS, JavaScript | 0

http://browsenpm.org/package/model.io https://github.com/model-io/model.io model.io tries to be a thin layer between frontend and backend by only sharing models and data. This is done throught websockets bases on sock.js and a small multi-channel-layer sock-channels.

Implementing the IndexedDB Factory [team]

posted in: AngularJS, JavaScript | 0

Using the IndexedDB Factory is not a complete example with querying, but simply a brute force approach to dumping and retrieving data through the IndexedDB Factory for the moment. We will refine this later.   angular.module(‘todomvc’) .service(‘todoModel’, [‘$rootScope’, ‘todoREST’, ‘indexedDBDataService’, function … Continued

IndexedDB Factory in AngularJS [team]

posted in: AngularJS, JavaScript | 0

The Factory   angular.module(‘todomvc’) .factory(‘indexedDBDataService’, [‘$window’, ‘$q’, function ($window, $q) { var indexedDB = $window.indexedDB; var db = null; var lastIndex = -1; var open = function () { var deferred = $q.defer(); var version = 1; var request = indexedDB.open(“todoData”, … Continued

Filtering in your Angular Model [team]

posted in: AngularJS, JavaScript | 0

Assume you loaded all the todos into an array in the model // model var todos; var todosFilterd; function getAllTodos(){ todoREST.getAll().then(function(result) { $rootScope.$broadcast(‘todoModel::gotTodosFromRestEvent’); transformTitles(result.data); todos = result.data; }); } function filterTodos() { this.todosFilterd = this.todos.filter(function (val) { return val.completed === … Continued

Rest Call in Model with Event to Controller in AngularJS [team]

posted in: AngularJS | 0

This is a Model loading the REST data and firing an event. The Controller listens for that event and assigns the Model STATE to $scope. // Controller angular.module(‘todomvc’) .controller(‘TodoCtrl’, function TodoCtrl($scope, $routeParams, $filter, todoEntity, todoREST, todoModel) { ‘use strict’; $scope.$on(‘todoModel::gotTodosFromRestEvent’, … Continued

Events from Model to Controller in Angular [team]

posted in: AngularJS | 0

This is how an event is triggered in the Model and Caught in the Controller.   // Model angular.module(‘todomvc’) .service(‘todoModel’,[‘$rootScope’, function ($rootScope) { ‘use strict’; var todos; function clearCompletedTodos () { this.todos = this.todos.filter(function (val) { return !val.completed; }); $rootScope.$broadcast(‘todoModel::clearCompletedTodosEvent’); … Continued

1 2 3 4 5 6 7 8 10