If I am using a factory/service to access my API in DreamFactory.
FoundationApp.factory('testAPI', function($resource, ChildID) {
return $resource('http://Domain.com/rest/RemoteDB/_proc/TimeLog_Checkin(:ChildID)/?app_name=App&fields=*', {ChildID: @ChildID}, {
update: {
method: 'PUT'
}
});
})
How can I modify the ChildID using a control with a GET function to make an API call with a specific ChildID entered by the user?
.controller('testCtrl', ['$scope','$resource','$routeParams','testAPI', function($scope,$resource,$routeParams,testAPI) {
console.log("Welcome to Test");
$scope.TestFunction = function() {
test.get($scope.ChildID);
};
}])
The child id is obtained from the HTML document. Here is the code for that.
<div class="well">
<button class="btn btn-default" ng-click="TestFunction()">Get all Clients</button>
<div>
<input type="text" class="form-control" ng-model="ChildID">
</div>
</div>
I have done some testing and successfully made the call by replacing ChildID in the URL with the desired ChildID.
http://Domain.com/rest/RemoteDB/_proc/TimeLog_Checkin(1)/?app_name=App&fields=*
However, I need a dynamic URL to accommodate user input.
I have researched various approaches to implementing this idea, but none of the examples quite fit my situation to help solve the problem.
Any assistance would be greatly appreciated as I have spent several hours working on this issue.