I have a directive which I can use like this:
<input type="file" ng-file-select="onFileSelect($files)" multiple>
This works just fine in the main scope, but when I try to use it within a repeater and then inside include:
<div ng-repeat="tab in tabs">
<div ng-include="tab.url"></div>
</div>
tab.url:
<input type="file" ng-file-select="onFileSelect($files)" multiple>
It stops working, no data is sent to the scope.
ngFileSelect directive:
app.directive("ngFileSelect", function () {
return {
link: function ($scope, el) {
el.bind("change", function (e) {
for (var i = 0; i < e.target.files.length; i++) {
$scope.file = (e.srcElement || e.target).files[i];
$scope.getFile();
}
});
}
};
});
In my controller i have:
$scope.getFile = function() {
fileReader.readAsDataUrl($scope.file, $scope)
.then(function(result) {
$scope.images.push(result);
});
};
How can I access the files selected inside the included file in a tab?