Imagine a prison with prisoners in separate cells, and I want to be able to be able to access a specific cell by calling the API '/getparameters' that will return the cell number, and then pass that variable in as the id for my factory. This is what I have come up with. No error are returned, but no data is being returned either. Where am I going wrong?
var app = angular.module('myApp', ['ngResource']);
//app.factory('Params', function)
app.factory ('CellID', function($resource){
return $resource('/my/api/cell/:id');
});
app.controller('CellCtrl', function($scope, $http, CellID){
//use $http to getparameters, specifically, the cell number
$http.get('/getparameters')
.success(
function(data) {
var cellnumber = data.cellnum;
CellID.get({id:cellnumber}), function(data){
$scope.info = data;
}
}
)
});