Pregunta

I like all of the functions of Restangular for AngularJS, except that I can't find (and it may not support) a way of just passing a full URL to it. I realize the benefit of the .one('something','someparam') but my issue is that I'm passed various URL strings, and I really don't want to have to split() them just to use Restangular.

Also, I know about the baseURL function; but these URLs I'm being passed don't necessarily derive from the same base path.

For example, I might have:

/us/en/product/17726
/us/es/products
/us/es/product/991A0
/ca/en/accounts

All I'm given are the Strings...

¿Fue útil?

Solución

I'm the creator of Restangular.

You have 2 options to do that.

1) Creating scoped Restangulars with different BaseURLs in each case: https://github.com/mgonto/restangular#how-to-create-a-restangular-service-with-a-different-configuration-from-the-global-one

2) You can use it like Restangular.all('us/en/').one('products', 1726) or Restangular.one('us/en/product', 1234)

Hope it works for you :)

Otros consejos

I needed to simply GET an absolute url and came across this question.

Here's how:

Restangular.oneUrl('routeName', 'http://absolute.url').get();

restangular#restangular-methods

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top