[Solved] how to customize angular toaster message


ngFileUpload error event callback receives 4 arguments as in:

https://github.com/danialfarid/ng-file-upload/blob/master/dist/ng-file-upload-all.js#L509-514

promise.error = function (fn) {
   promise.then(null, function (response) {
       fn(response.data, response.status, response.headers, config);
   });
   return promise;
};

headers is the 3rd argument, config is the 4th argument. In your code config is referencing headers. headers.file is undefined so this is how you get the error TypeError: Cannot read property 'name' of undefined.

Change:

.error(function (err, result, config) {
   ...
})

To:

.error(function (err, result, headers, config) {
   ...
})

solved how to customize angular toaster message