The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

472027 (2) [Avatar] Offline
Hi All,
I am getting the following error while developing program for upload file in AngularJS

$rootScope.get_request_param.indexOf is not a function

Please reply as soon as possible.

Thanks in advance.
Harish Pathak

The code is as :

app.directive('fileModel', ['$parse', function ($parse) {
   return {
      restrict: 'A',
      link: function(scope, element, attrs) {
         var model = $parse(attrs.fileModel);
         var modelSetter = model.assign;

         element.bind('change', function(){
               modelSetter(scope, element[0].files[0]);

$scope.uploadFile = function() {


if($scope.myFile==undefined) {

toaster.pop('fail', '', 'Please select a file');


var payload = new FormData();

payload.append("file", $scope.myFile);

payload.append("taskPerform", "upload_file");

payload.append("issueid", issueid);


headers: { 'Content-Type': undefined},

url: './assets/tools/classes/view_issue_info_­class.php',

method: "POST",

data: payload,

transformRequest: angular.identity


.success(function(result) {

if(result==1) {

toaster.pop('success', 'Success', 'File uploaded successfully');





If I comment following line in the code, error doesn't appear.
data: payload.

Please tell, what could be the problem. ?

Please help. Its urgent.