Search code examples
angularjsionic-frameworkngresource

Angularjs ngresources cannot get the url


i have the following url "http://localhost:3000/api/user/" and is work fine in the browser, but when i put it in my ionic service code return $resource('/api/user/'); is return

data : cannot Get /api/user\n

and when i change the url to url from some api in the web is work fine and get the data right .. please what the wrong here.


Solution

  • Your problem is link to the port :3000. When you write /api/user/, angular go to search your url on http://localhost/api/user/ and not http://localhost:3000/api/user/.

    So to resolved this issue you have to pass all your url to the $ressource() and not only the last part.