【发布时间】:2014-08-23 14:11:02
【问题描述】:
Node-Webkit 公开了一种使用<input type='file' nwdirectory/> 选择目录的方法,但是如何将角度模型绑定到所选文件夹?
我试过了:
.directive("getDir", [function () {
return {
scope: {
getDir: "="
},
link: function (scope, element, attributes) {
element.bind("change", function (changeEvent) {
scope.$apply(function () {
scope.getDir = changeEvent.target.files[0]
})
})
}
}
}])
在控制器的 HTML 上(路由部分):
{{ location }}
<div class="uk-form-file">
<button class="uk-button">New Location</button>
<input type="file" getDir="location" nwdirectory>
</div>
实际控制人:
.controller('HomeCtrl', function($scope) {
})
但选择后{{ location }}上仍然没有显示
【问题讨论】:
标签: javascript node.js angularjs node-webkit