$ watch не работает, когда модель обновляется в области видимости. $ apply в директиве

у меня есть директива, где я добавил часы наexistingfiles' модель области действия директивы. Когда происходит изменение в модели с помощью scope. $ Apply, прослушиватель не отслеживается.

Вот код директивы, пожалуйста, дайте мне знать, если я что-то здесь упускаю,

   directive('fileuploadPlugin', function() {
    var linkFn;
    linkFn = function(scope, element, attrs) {
        angular.element(element).ready(function() {
            jQuery('#fileupload').fileupload({
                done: function (e, data) {
                    scope.$apply(function(scope) {
                        for(var i=0; i < data.result.filesuploaded.length; i++){
                                      scope.existingfiles.push(data.result.filesuploaded[i]);
                    };                              
                    });
                }
        });
        scope.$watch('existingfiles', function(newValue, oldValue) {
                element.imagesLoaded(function() {
                scope.$apply( function() {
                    element.masonry({
                        itemSelector : '.box'
                    });
                });
            });
        });
    };
    return {
        templateUrl : 'templates/fileupload_plugin.htm',
        restrict    : 'A',
        scope       : {
            existingfiles   : '=ngModel',
        },
        link        : linkFn
    };  
     })

Вот мой призыв к директиве,


Пожалуйста, дайте мне знать, как убедиться, что модель смотрится правильно

Ответы на вопрос(1)

Ваш ответ на вопрос