REVISION
As I have come to truly understand my question, I have modified this question in search for a better answer. Although this link was helpful for MIME types of the 'accept' attribute, my question stems deeper.
I am writing an application where I allow users to upload files, and the files must be of a specific MIME type.
The directive is used in many places, and the MIME type needs to change across these places. I need to dynamically construct the template
of my directive
in order to accommodate for each implementation of the directive.
Assume that I write HTML as so:
<cmc-file-upload mimeType="text/html" ng-if="reportFileUploadSettings.showFileUploader" upload-complete-callback="importReportFile(content)" ></cmc-file-upload>
I would then wish to apply that MIME type to the template
of the directive
:
components.directive('cmcFileUpload', function ()
{
return {
restrict: 'E',
scope: {
uploadCompleteCallback: "&",
mimeType: "&",
},
replace: false,
template: '<input type="file" id="files" name="files[]" accept="' + scope.mimeType + '" multiple /><output id="list"></output>',
Unfortunately, this code does not seem to work this way.
How can I make this work?
REFERENCE ERROR: scope
is undefined...