Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalidFiles does not apply to scope from my directive. #2024

Open
krptodr opened this issue Nov 20, 2017 · 0 comments
Open

invalidFiles does not apply to scope from my directive. #2024

krptodr opened this issue Nov 20, 2017 · 0 comments

Comments

@krptodr
Copy link

krptodr commented Nov 20, 2017

I have a directive, that I am calling Upload.upload on. My directive template is specifying that ngf-model-invalid="invalidFiles"
here is my example:

scope.invalidFiles = [];
            scope.invalidFile=null;
            scope.$watch('invalidFile', function(invalidFile){
                if  (invalidFile) 
                    scope.invalidFiles.push(invalidFile);
            });
<div ngf-drop="selectFile(picFile)" ngf-model-invalid="invalidFile" ngf-select="selectFile(picFile)" type="file" ngf-multiple="false" ng-model="picFile" name="file" ng-attr-ngf-pattern="{{form.schema.pattern && form.schema.pattern.mimeType ? form.schema.pattern.mimeType : undefined }}" ng-attr-ngf-max-size="{{form.schema.maxSize && form.schema.maxSize.maximum ? form.schema.maxSize.maximum : undefined }}" ng-required="form.required" accept="{{form.schema.pattern && form.schema.pattern.mimeType}}" ng-model-options="form.ngModelOptions && { allowInvalid: true, debounce: 1000}" ngf-drag-over-class="dragover" class="drop-box dragAndDropDescription">       
    </div>

However, upon line L559 below, the scope contains the invalidFile, but my scope.$watch('invalidFile') is never called.

var invalidModel = upload.attrGetter('ngfModelInvalid', attr);
if (invalidModel) {
$timeout(function () {
$parse(invalidModel).assign(scope, isSingleModel ? invalidFile : invalidFiles);
});
}

if I were to run ng-file-upload directly from my controller, then my $scope.$watches work fine.

Any idea for a solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant