Search Posts

Category: file

How do I upload a file to an ng-repeated model?

I have an angular controller that is supposed to update person data. With text and date fields, that works just fine, I have <ul> <li ng-repeat=”person in $ctrl.persons | filter:$ctrl.query”> … <div ng-show=”person.edit”> <label>Full Name*:</label><input class=”edit-person” ng-model=”person.fullname” /><br /> <label>Birthdate:</label><input class=”edit-person” type=”date” ng-model=”person.birthdate” /><br /> <label>Deathdate:</label><input class=”edit-person” type=”date” ng-model=”person.deathdate” /><br /> <label>Description: </label><input class=”edit-person” type=”text” ng-model=”person.description” /><br /> <img ng-src=”{{person.picture}}” width=”100px” height=”100px” /><br /> <label>Picture: </label><input class=”edit-person” type=”file” accept=”image/*” ng-file-select=”handleEditPersonFiles(this.files);” /><br /> <button ng-click=”$ctrl.submitEdit(person); person.edit […]