In a hypothetical scenario, picture a facility where inmates are housed in individual cells. My goal is to access a particular cell by invoking the API '/getparameters' which will provide me with the cell number. Subsequently, I intend to utilize this variable as the id for my factory implementation. Although no errors are being thrown, I'm not receiving any data either. What could be causing this issue?
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){
//employ $http to retrieve parameters, specifically, the cell number
$http.get('/getparameters')
.success(
function(data) {
var cellnumber = data.cellnum;
CellID.get({id:cellnumber}), function(data){
$scope.info = data;
}
}
)
});