0

I am trying to get multiple file attachments from file inputs using the following directive:

var app = angular.module('app',['ui.bootstrap']).config(function($interpolateProvider){
        $interpolateProvider.startSymbol('{|');
        $interpolateProvider.endSymbol('|}');
    }
).directive('ngFile',function(){
            return {
            scope: {
                ngFile: '='
            },
            link: function(scope, el, attrs){
                el.bind('change', function(event){
                    scope.$apply(function(){
                        scope.ngFile = event.target.files[0];
                    });

                });
            }
        };
    });

Now I have the following bit of angular/template code bellow

<div ng-repeat="attachment in messages.attachments">
    ... some html code
    <input type="file" ng-file="attachment">
    ... some more html
</div>

I'm trying to access my files via:

$scope.messages.attachments[ someIndex ] // Returns $$hashkey

But all this is doing is return some hash key $$hashkey.

Question 1) What exactly is this $$hashkey object and what is it used for?

Question 2) How can I access my files use $scope.messages.attachments?

Dr.Knowitall
  • 10,080
  • 23
  • 82
  • 133
  • 1
    `$$hashkey` is a property that angular adds to every object utilized within any scope. It is for internal angular use. Probably need to use the browser formData API to get more on files – charlietfl Oct 27 '13 at 23:38
  • 1
    See this: http://stackoverflow.com/a/23656919/1444541 – JaKXz Dec 23 '14 at 00:16
  • possible duplicate of [What is the $$hashKey added to my JSON.stringify result](http://stackoverflow.com/questions/18826320/what-is-the-hashkey-added-to-my-json-stringify-result) – talonmies Jun 02 '15 at 01:03

0 Answers0