angular-jsonapi icon indicating copy to clipboard operation
angular-jsonapi copied to clipboard

Q&A

Open jakubrohleder opened this issue 9 years ago • 18 comments

Topic for questions about the package usage that does not require a new issue. Feel free to ask about anything!

jakubrohleder avatar Sep 30 '15 10:09 jakubrohleder

@jakubrohleder Is there a reason behind the use of validatejs? could one replace it with something else ? like ng-messages - Maybe make the validation part modular - i.e ng-messages is better adapted to multilingual applications.

jsenecal avatar Oct 01 '15 16:10 jsenecal

@jsenecal I like validatejs (from http://validatejs.org/ not http://rickharrison.github.io/validate.js/) because it performs exactly what it promises: takes object, takes constraints, validates it and returns object with errors.

As far as I know ng-messages handles visual aspect of errors presentation and requires other directives (like ng-maxlenght or required).

I'm still looking for the right solution. For me perfect flow would be: object is validated, error codes are saved in the object.errors, in the view you translate error codes to messages using e.g. angular-translate. Maybe it's not perfect but it separates abstract objects layer from presentation layer.

I've added issue about internationalization to validate.js (ansman/validate.js#74)

jakubrohleder avatar Oct 01 '15 19:10 jakubrohleder

Why makes the service names so long, like AngularJsonAPISynchronizerSimple ?

hardywu avatar Oct 07 '15 10:10 hardywu

@hardywu Current implementation of angular does not support namespaces nor module private services, so I just wanted to avoid names collisions with other packages.

It's not very likely with SynchronizerSimple, but e.g. Collection is quite a common name, thats why I added AngularJsonAPI prefix to all services.

jakubrohleder avatar Oct 07 '15 10:10 jakubrohleder

@jakubrohleder Can't we namespace with the a - though? In fact, isn't that the preferred way to apply a namespace (https://github.com/angular/angular.js/wiki/Best-Practices)? E.g.: jsonapi-synchronizerSimple.

dallas avatar Oct 14 '15 18:10 dallas

@dallas thanks for the article, I haven't seen it before. the - namespace is valid for directives, but for services that are meant to be injected I do not see it as a good idea - it is interpreted as the subtract. Same goes for ..

This kind name can be used in the "minification" style, but at the end of a day you still have to use some underscored/camelcased name.

The only reasonable idea I have to solve this problem is making services available via $jsonapi provider. Then both $jsonapi.synchronizerSimple and AngularJsonAPISourceRest would be available. What do you think about such a solution?

jakubrohleder avatar Oct 20 '15 08:10 jakubrohleder

@jakubrohleder I'm starting to implement websocket support for our backend app...

I thought of implementing something that could push object updates to clients when they are changed on the server (and then replace the existing cached data with the new data) does that makes sense to you ?

jsenecal avatar Nov 06 '15 21:11 jsenecal

@jsenecal it does! Current architecture is not really 'prepared' for push updates (as synchronization is always triggered by the user). Nevertheless it is totally possible to do socket style synchronization.

Recently I did not have much time to develop the project, as I'm leaving for three weeks long trip to South America (Peru to be exact) tomorrow and had to finish my work projects. I won't have much internet access and I'm leaving my laptop at home, but I'll try to help you as much as I can.

jakubrohleder avatar Nov 06 '15 21:11 jakubrohleder

@jakubrohleder I heard that you were back - So, I currently have a websocket implementation that I would like to propose to you - Shall we open an issue dedicated to that ?

jsenecal avatar Dec 02 '15 16:12 jsenecal

@jsenecal would be great! I need few days to sync with my everyday life, but I'll surely will review it by the end of a week.

jakubrohleder avatar Dec 02 '15 16:12 jakubrohleder

@jsenecal Do you push updates since connection started, or it's also possible to ask for updates since specific timestamp?

xpopov avatar Dec 02 '15 18:12 xpopov

@xpopov Well, my websocket implementation is mostly SSE (Sever Side Events) So the client's browser is not actually requesting anything :P My implementation "Subscribes" the browser websocket to the content fetched in the past through regular HTTP GET (including includes) so that if some other user/client updates/deletes an entry all "subscribed" websockets would get the updated version or creation/deletion notification.

Makes sense ? I created issue #26 for further discussion

jsenecal avatar Dec 02 '15 18:12 jsenecal

@jakubrohleder We are using your JsonApi in a slightly different way to your Demo App. We are injecting an accounts resource factory (return $jsonapi.getResource('accounts')) into our controller and using accounts.all().promise to get a collection of accounts.

On the return of the promise, we populate our view model using vm.accountsList = accounts.cache.index(). Is this an acceptable way to use the JsonApi?

I know this is a different approach to your demo app, but we just want to make sure we are not making any fundamental mistakes. Any help appreciated. Regards, Paul

plwade avatar Dec 14 '15 15:12 plwade

Hey there, wondering if the project is still active.

Thanks!

mustela avatar Jan 04 '16 17:01 mustela

@mustela yes and no :).

Recently I've been traveling a lot, changed job and been working on other big project. So for past two months I haven't got time to work on angular-jsonapi.

Nevertheless I'm still determined to keep this project alive. I hope to find some time to resolve posted issue in the near feature.

Sorry for no recent project activity.

jakubrohleder avatar Jan 05 '16 11:01 jakubrohleder

Thanks for your comments @jakubrohleder!!

mustela avatar Jan 05 '16 11:01 mustela

@jakubrohleder I really want to thank you a lot for the effort you have given to develop this project and if someone could help you, it'd be great for community. I'm currently developing a project based on this project and I'd be one of those contributors if I had more time (maybe in a months I could). By now, I'd like to ask if you could find some time for checking pull requests at least, because there are useful suggestions that can improve this project (well, it's on your own :) )

Sorry for my bad english :D

eduardmartinez avatar Jan 22 '16 19:01 eduardmartinez

Sorry if this question was already posted somewhere. Is this library compatible with json api 1.0? I'm asking cause I'm not sure when 1.0 was released exactly and if this library stopped being actively maintained before that time.

zoamel avatar Mar 19 '16 17:03 zoamel