1

I want to create a my directive for read the input type="file" but I fail in this problem. I write the my code in page html in this way:

<body ng-controller="insertController">
    <div>
        <input type="file" file-model="myFile"/>
    </div>
    <div>
        {{message}}
    </div>
</body>

So I want read the file and show the result in {{message}}. So I created a directive in this way:

modulo.directive('fileModel', function() {
    return {
        restrict: 'AEC',
        templateUrl: 'insert.html',
        link: function(scope, element, attrs) {
            scope.message = attrs.fileModel;
        }
    };
});

Moreover I read my controller but it's empty...

modulo.controller('insertController', function($scope, $http) {

});

How can I fix the problem?Thanks!

Alessandro
  • 905
  • 3
  • 17
  • 32
  • You use one of the solutions from this thread. http://stackoverflow.com/questions/17063000/ng-model-for-input-type-file – Harish Apr 17 '15 at 11:10

0 Answers0