Hacker News new | ask | show | jobs
by aikah 4305 days ago
Why does this has to be an angular library ? there's no need for that.

You could provide a generic js library with a way to opt-in angularjs,that way,your data access layer isnt tied to a presentation framework.

Can I use this lib with Backbone or React ? why this fixation on making everything depend on angular ? like jQuery in the past ? are we destined to repeat the same mistakes over and over again in the client js world ?

5 comments

The "generic js library" is just your browser's localStorage. Open your browser console, type "window.localStorage['test'] = 'whatever'", refresh your browser, then type "window.localStorage.test". Did you want some library that makes it easier to add a key-value pair to an object?

This is just Angular-specific boilerplate to access window/$window and add/retrieve objects without writing a bunch of low-level services. Backbone and Ember already have these model layers but they come with heavy wrappers and getter/setter methods, and the author said he wanted to keep these as POJO objects (which Angular is loved for) without polluting them with ride-along getter/setter methods.

> Plain Old Javascript Objects objects

Plan on visiting the ATM machine later?

Yes, I could generify it, but I'd have implement $q and $http (or introduce other dependencies), and extract angular-specific things like hooking into Angular's $digest cycle for change detection (when the browser doesn't support Object.observe).

This definitely warrants some thought. The next time I write a non-trivial application in a framework other than Angular then this will move up on my priority list. Or perhaps when the community wills it into existence :)

Breeze.js seems like it would be the framework agnostic version of this (I think). Its got client caching, querying, and change tracking.

http://www.breezejs.com/

AFAIK Breeze doesn't support < IE9 which is why I can't use it for certain client projects.
I agree, but it has the convenience of being able to npm install and immediately begin injecting into your app.