扫码关注官方订阅号
html:controller:$scope.editPic = function(){
console.log(1);
};我想在选择图片后,触发一个事件,为什么这样不会触发controller里的事件?谢谢。
认证0级讲师
我这里有一个 angular 中 input type="file" 的指令,用法是 <input type="file" file-read="uploadMe" />
<input type="file" file-read="uploadMe" />
coffeeScript的格式,自己转换成JS就好
angular.module "ws.fileRead", [] .directive "fileRead", [ -> scope: fileRead: "=" link: (scope, element, attributes)-> element.bind "change", (changeEvent)-> reader = new FileReader() reader.onload = (loadEvent)-> scope.$apply -> scope.fileread = loadEvent.target.result return return ]
首先,请把代码贴完整;其次,你这里只是绑定了input的change事件,跟图片有啥关系??
你可以试试ng-file-upload,很强大
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
我这里有一个 angular 中 input type="file" 的指令,用法是
<input type="file" file-read="uploadMe" />coffeeScript的格式,自己转换成JS就好
首先,请把代码贴完整;
其次,你这里只是绑定了input的change事件,跟图片有啥关系??
你可以试试ng-file-upload,很强大