I am currently having an issue with populating some textareas with text. When I step through with the debugger it works fine, however when I let it run normally it will only populate the fields with the data on the second time it is loaded. This leads me to believe that the issue is to do with how the page is loading. I am trying to delay the execution of my method that attempts to populate the fields using callbacks however I am completely new to this method of programming in JS, let alone AngularJS.
I keep getting the Callback is not a function error whenever I try this :
$scope.StudyAndUnderstandingContent = []
$http.post('url', {stepNumber: currentStep.currentstep})
.then(function success(response, getCallback) {
$scope.StudyAndUnderstandingContent = response.data.step;
getCallback();
});
And here is my callback function:
function getCallback()
{
$http.post('url2', getData)
.then(function(response)
{
angular.forEach(response.data.answer, function(value, key)
{
$scope.answers.push(response.data.answer[key]);
});
$scope.textBoxes = [];
angular.forEach(angular.element($(".inline-q")), function(value, key)
{
$scope.textBoxes.push(value);
$scope.textBoxes[key].value = $scope.answers[key].answer;
});
});
}
I have looked at the other questions whilst also trying to find my own fix, but I have made 0 progress. Any help would be appreciated.
$scope?getCallback is not a function?