Restangular: long url with params

Issue

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)

Answered By – Mikko Viitala

Answer Checked By – Cary Denson (AngularFixing Admin)

Leave a Reply

Your email address will not be published.