Javascript 将节点webkit nwdirectory绑定到ngmodel
Node Webkit提供了一种使用Javascript 将节点webkit nwdirectory绑定到ngmodel,javascript,node.js,angularjs,node-webkit,Javascript,Node.js,Angularjs,Node Webkit,Node Webkit提供了一种使用选择目录的方法,但是如何将角度模型绑定到所选文件夹 我试过: .directive("getDir", [function () { return { scope: { getDir: "=" }, link: function (scope, element, attributes) { element.bind("change", function (c
选择目录的方法,但是如何将角度模型绑定到所选文件夹
我试过:
.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}}
getDir=“location”
writeget dir=“location”
。请参阅以供参考{{location}
,但在指令中,您将文件目标的值分配给scope.getDir
,因此可以使用与{{getDir}相同的变量名打印它{{ location }}
<div class="uk-form-file">
<button class="uk-button">New Location</button>
<input type="file" getDir="location" nwdirectory>
</div>
.controller('HomeCtrl', function($scope) {
})