fix $parse and allow $urlRoot be a function

- method $parse was implemented but didn't uses - fixed
- $urlRoot now can be a function