angularjsng-file-upload

ng-file-upload getting TypeError: Illegal invocation with ngf-drop


The TypeError: Illegal invocation occurs when adding a $watch with objectEquality set to true on a model which contains a file(s) property used by ngf-drop.

Also as reported here.

How can I $watch the model without getting this error?


Solution

  • Solved without having to use a separate scope variable for the files.

    Instead of $watching the model, I $watched a function that returns Json.stringify(model) -- with objectEquality true.

    It works, and does not seem to harm perfomance in a user-visible manner.