Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ngf-accept
Message
 
 
To
All
General information
Forum:
AngularJS
Category:
Coding, syntax & commands
Title:
Ngf-accept
Miscellaneous
Thread ID:
01648301
Message ID:
01648301
Views:
36
UPDATE. I think I got it to work by changing in the template to
 ngf-accept= "{{fileMask}}" 
Hi everybody,

We have a smFileUploaderDirective. In the template for that directive I use
<div class="btn btn-primary pull-left" 
                 ngf-multiple=multiFile 
                 title="@Labels.selectFile" 
                 ngf-select 
                 ngf-accept= fileMask 
                 ngf-change="$scope.filesloading=$files.length;onFileSelect($files, $event)">
                {{ uploadTitle }}
            </div>
In the script file for the directive we have
return {
            restrict: 'AE',
            transclude: false,
            scope: {
                okLabel: '@?',
                cancelLabel: '@?',
                confirmTitle: '@?',
                message: '=?',
                errorMessage: '=?',
                fileMask: '@?',
                uploadTitle:  '@?',
                onOpen: '&?',
                okAction: '&',
                disableAction: '=?',
                stopPropagation: '@',
                uploadOptions: '=',
                showDropZone: '@',
                uploadTemplate: '@?'
            },
            link: function (scope, element, attrs) {
                element.click(function (e) {
                    scope.click(e);

                });
            },
            controller: ['$scope', '$uibModal', 'Upload', 'resourceFactory', '$timeout', function ($scope, $uibModal, Upload, resourceFactory, $timeout) {
                // Set scope default values
                $scope.okLabel = $scope.okLabel || resourceFactory.getResource('Labels', 'uploadComplete');
                $scope.cancelLabel = $scope.cancelLabel || resourceFactory.getResource('Labels', 'cancel');
                $scope.title = $scope.confirmTitle || resourceFactory.getResource('Labels', 'uploadFile');
                $scope.uploadTitle = $scope.uploadTitle || resourceFactory.getResource('Labels', 'uploadFile');
                $scope.fileMask = $scope.fileMask || "'.*'";
(double quote, then single quote)

-----------------
In the HTML that uses that directive I use
file-mask="'.rdl'"
Unfortunately, it doesn't seem to work - I see no filter for rdl only. I found this https://github.com/danialfarid/ng-file-upload/issues/755 and tried the fiddle.

Do you see what may be wrong in the way I'm setting it up?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Reply
Map
View

Click here to load this message in the networking platform