Angularjs中的$$ hashkey对象是什么?如何读取多个文件输入?

时间:2013-10-27 23:31:47

标签: javascript angularjs angularjs-directive angularjs-scope angularjs-ng-repeat

我正在尝试使用以下指令从文件输入中获取多个文件附件:

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];
                    });

                });
            }
        };
    });

现在我有以下一些角度/模板代码

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

我正试图通过以下方式访问我的文件:

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

但所有这一切都是返回一些哈希键$$ hashkey。

问题1)这个$$ hashkey对象究竟是什么?它用于什么?

问题2)如何使用$ scope.messages.attachments访问我的文件?

0 个答案:

没有答案