i working on ionic app , can't seem find breakdown particular problem. trying serve single user user model , "get http://localhost:3000/api/users/5743a5f9db9e7ce607d47c9c 403 (forbidden)". long number on end of link there user id. cors issue or else? here's code:
from global controller:
.controller('globalctrl', function(users, $rootscope, $state, $stateparams, $window, stocks, $scope){ if ($state.current.name == 'show-user') { console.log("state first time",$state.current.name) users.show($stateparams.userid).success(function(results){ console.log("state second time",$state.current.name) //console.log("globalctrl single user results", results) $scope.user = results console.log("$scope.user", $scope.user) }) } })
from user service:
.factory('users', function($http) { var apiurl = 'http://localhost:3000/api/users/' return { index: function(){ return $http.get(apiurl) }, show: function(userid){ console.log("user service running", userid); return $http.get(apiurl + userid) console.log("userid:",userid) } } })
the states standard. userid identified in index users template in ui-sref follows:
<a ui-sref="show-user({userid: user._id})">{{user._id}}</a>
thanks help! if more info needed let me know.