Я новичок в angularjs и пытаюсь реализовать простую загрузку файла, но я fetting файл, как определено при попытке получить к нему доступ из контроллеразагрузки файлов в angularjs
articles.html
<section data-ng-controller="ArticlesController" data-ng-init="find()">
<div class="page-header">
</div>
<div >
<input type="file" file-model="myFile"/>
<button ng-click="uploadFile()">upload me</button>
</div>
</section>
Ниже мои контроллер, где я пытаюсь получить доступ к объекту файловой
angular.module('articles').controller('ArticlesController', ['$scope', '$stateParams', '$location','Authentication', 'Articles',
function($scope, $stateParams, $location, Authentication, Articles) {
$scope.authentication = Authentication;
$scope.uploadFile = function() {
console.log('came here');
var file = $scope.myFile;
console.log('file is ' + file);
};
}
]);
Edit:
Я пробовал использовать https://github.com/ghostbar/angular-file-model и работал на кодовой табличке котла Meanjs
Одним из шагов является включение углового файла-model.js в html-страницу. Добавить в HTML-файлы:
в какой файл я должен включать и как включить файл углового файла-model.js.