Angular2 module similar to ngResource / $resource
Asked Answered
J

3

32

When I take a look into Angular2 docs I can't find any REST helper module like Angular1's ngResource. I find it very useful in Angular1, so I would like to have something similar in Angular2, but the only thing I can find is 'angular2/http' which does not contain anything like that (or maybe I am not searching good enough?).

Although it is pretty much clear that it would be easy to implement a similar service on my own, is there any ready-to-use module shipped by Angular2 team or is there going to be one?

Jalap answered 25/4, 2016 at 12:28 Comment(5)
did you find any good replacement for ngResource?Bagdad
Yep, ng2-resource-rest is a really good option. It is well supported, yet comfortable and extendable.Jalap
have you find any missing thing, as compared to ng-resource?Bagdad
nope, furthermore in my opinion it is a step forward compare to the original one. Just try it and you won't regretJalap
Thanks, for your insights. I'd be using it from tomorrow onlym thanks ;)Bagdad
T
14

There are a few thirdparty libs that do this and tie in with RXjs.

Take a look at https://github.com/troyanskiy/ng2-resource-rest

Tipcat answered 25/4, 2016 at 12:50 Comment(0)
A
2

js-data-angular (formerly angular-data) is well-engineered counterpart to ngResource in Angular 1.x and a wrapper for main package, js-data.

As it is shown in the examples, js-data provides framework-agnostic models and can be successfully used with Angular 2 directly.

Astrophotography answered 22/6, 2016 at 20:49 Comment(2)
+ for the answer. Is there websockets / observables support (don't see it on their website)?Jalap
They are not built in. Observables can be easily added. Websocket support is not provided, but can be added too (see Angular 1.x examples from the issues).Astrophotography
B
2

Restangular is going to Angular2, they already have made a good job with AngularJS version. May worth the try.

[Edit] I tried it on an Angular-Seed root and it didn't integrate very well during the bundle phase. In dev mode I was easily able to send requests to the server.

The Typescript isn't really interesting since they put "any" on every object, it will need some more work to become fully production friendly.

Bawdyhouse answered 17/1, 2017 at 17:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.