mgonto/restangular — pull request #283 by outsideMyBox (2013-09-04 10:33:09+00:00)
Title: Error if selfLink contains nested properties

First thanks for this nifty library!

I tried to set 'selfLink' with '_links.self.href' (which is the way to define the self reference resource with HAL (http://stateless.co/hal_specification.html) but when I try get a resource from:.Restangular.one('').get() I get the error:
TypeError: Cannot read property 'self' of undefined

It works fine if selfLink doesn't have nested properties (e.g. '_links')

The culprit is config.getFieldFromElem() which assumes that all the nested properties of 'field' exist. Instead of changing it I've modified config.getUrlFromElem() which solves the issue and pass the existing tests.