Hi I am new to isolated scope in custom directive
This is my directive
restrict: 'E',
scope: {},
template: '<input type="file" ng-model="myFile" />{{myFile.name}}',
link: function(scope, element, attrs, sharedServices) {
var model = $parse(attrs.fileBrowser);
var modelSetter = model.assign;
element.bind("change", function(e) {
scope.fileForImagepreview = (e.srcElement || e.target).files[0];
if (scope.fileForImagepreview.type === "image/jpeg" ||
scope.fileForImagepreview.type === "image/jpg" ||
scope.fileForImagepreview.type === "image/png") {
scope.$apply(function() {
modelSetter(scope, element[0].firstChild.files[0]);
});
}
var promise = fileReader.readAsDataURL(scope.fileForImagepreview, scope);
promise.then(function(result) {
scope.imageSrcForPreview = result;
});
});
}
and in html i just include it as
<file-browser></file-browser>
I want file in scope of directive