Search code examples
javascriptangularjsrestangular

Restangular: long url with params


I'm trying to do such query url:

Restangular.one('company').one('manager').one(managerId).get(params)

which should be for example:

/company/manager/12/?param1=value1&param2=value2

but something went wrong, and i get:

Error: You're creating a Restangular entity with the number instead of the route or the parent. For example, you can't call .one(12).

What i do wrong?

What is the best way of solving this issue?

sure, i can do this:

Restangular.one('company').one('manager/' + managerId).get(params)

but it's to ugly way...


Solution

  • Restangular.one('company').one('manager', managerId).get(params)