TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Angular-data: data store and caching for Angular.js

164 点作者 n8agrin超过 10 年前

15 条评论

simonrobb超过 10 年前
&quot;Angular-data is very optimistic when it comes to caching. If you do DS.find(&#x27;user&#x27;, 5) angular-data will first look for that user in the data store. If that user is already in the data store then the promise returned by DS.find(&#x27;user&#x27;, 5) will immediately resolve with the user. If no user exists then (if using the http adapter) a GET request will be made, and the user returned by the server will be injected into the data store.&quot;<p>I couldn&#x27;t find anything in the docs about invalidation. Is anybody aware of how to force invalidation of an object&#x2F;collection?
评论 #8298679 未加载
评论 #8298956 未加载
Bahamut超过 10 年前
This looks interesting, but I&#x27;m not sure whether it&#x27;s worth tying into a complex project using angular. I have found angular already has a large learning curve for new developers, and adding another layer with its own syntax on top of it adds some complexity that I&#x27;m not necessarily convinced that is good in that situation.<p>It looks alright though in terms of what it offers on first inspection though. It does solve some problems that I have found myself having to solve in a similar manner with homebrewed code &amp; structure.
评论 #8303557 未加载
spencera超过 10 年前
So excited to try this out. An Angular specific smart model layer is something I&#x27;ve been wanting to contribute to the community for a while. Thanks for doing much of the hard work!
neebz超过 10 年前
This is superb work.<p>Just one question, does it have the feature to add offline custom methods to the model e.g. I want to add instance calculateAge() for each User ? I couldn&#x27;t find it in the guides.<p>Angular-RestMod provides it &gt; <a href="https://github.com/platanus/angular-restmod#custom-methods" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;platanus&#x2F;angular-restmod#custom-methods</a><p>(basically we use node on the server and many times we just want to reuse the same server side methods on the client)
评论 #8298681 未加载
EGreg超过 10 年前
From building <a href="http://platform.qbix.com/features/streams" rel="nofollow">http:&#x2F;&#x2F;platform.qbix.com&#x2F;features&#x2F;streams</a> I know that there are a lot of challenges here. Caching, throttling and batching requests is of course really useful. My biggest question is how do you implement:<p><pre><code> * multi-user access * realtime updates to connected clients, and * offline editing and sync? </code></pre> When multiple users access a resource, you have to consider things like consistency issues (making sure all users see the same changes applied in the same order). Also other stuff would be nice like access control (perhaps integrated with the publishing user&#x27;s address book) as well as subscriptions notifications when something changes.<p>Does anyone know of a library that implements that? It took me a couple years to get everything right in my own library.
评论 #8298224 未加载
评论 #8298068 未加载
Kiro超过 10 年前
&quot;Before writing angular-data I used to create fleets of services for my various resources, each performing data management and communicating with a persistence layer.&quot;<p>Can someone give me an example of this? I just use $http and populte the $scope models in callbacks so I don&#x27;t really recognize the problem.
评论 #8298407 未加载
评论 #8301447 未加载
评论 #8298261 未加载
评论 #8298232 未加载
Jgrubb超过 10 年前
Hey pseudobry, thanks for the hard work first of all. I started using the 2.x branch on a large project and it saved me soooo much time and code over what I was trying to write around localStorage caching and expiration while trying to learn Angular at the same time.<p>I tried following the advice to upgrade to 3.x when it appeared on the API docs, but it broke my app completely which, after spending 5 minutes reading the 3.x branch&#x27;s docs made complete sense - you&#x27;re going for something much larger here.<p>I haven&#x27;t personally played with Ember yet, but this seems like it might be inspired by Ember Data? Is that right? From what I hear, that&#x27;s one of the many thing that Ember has gotten really right.<p>Thanks again!
评论 #8303550 未加载
robbs超过 10 年前
This looks great! I wrote something similar but Angular-data looks more polished. One of the problems I was trying to solve was synchronizing the same piece of data in multiple places in the client app after the server had validated the data. To do this, I broadcast an event on the rootscope in the http callback. <a href="https://github.com/robbyronk/angular-model-sync/blob/master/src/modelSync.js#L87" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;robbyronk&#x2F;angular-model-sync&#x2F;blob&#x2F;master&#x2F;...</a>
aikah超过 10 年前
Why does this has to be an angular library ? there&#x27;s no need for that.<p>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.<p>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 ?
评论 #8298126 未加载
评论 #8298182 未加载
评论 #8298256 未加载
评论 #8298750 未加载
评论 #8298078 未加载
grumblestumble超过 10 年前
This is great. I&#x27;ve written more application-specific angular data stores than I&#x27;d care to admit at this point. From what I understand, this is something that Angular 2.0 will handle better, which was enough for me to justify being too lazy to write a generic library. Thanks for doing the grunt work!
nikon超过 10 年前
I&#x27;ve built something similar recently however also solved client&#x2F;server synchronisation. You make me want to clean it up and put it on Github. The only difference is that the backend API is HATEOAS.
instakill超过 10 年前
ELI5 why I&#x27;d use this in a regular project using say Rails and angular?
评论 #8298506 未加载
simonrobb超过 10 年前
Great work, this exactly what I&#x27;ve been looking for. I&#x27;d resigned myself to writing it from scratch - so I really appreciate your efforts on this. Will try it out right now.
fcoury超过 10 年前
One minor request: if you could add syntax highlighting to the Guide and API, it would be amazing. Otherwise, nice work!
评论 #8297830 未加载
taktikz超过 10 年前
Anyone know why these high point submissions aren&#x27;t on the front page? Is Hacker News ghosting&#x2F;flagging these posts for any specific reason? Sorry to ramble a bit off topic.
评论 #8298322 未加载
评论 #8298424 未加载