我正在尝试使用 ng-flow 在 javascript 中使用图像以使用 RPC 调用将其发送到后端服务器。问题是我按照他们在他的页面中的教程进行操作,但我没有找到如何访问 AngularJS 应用程序内的 JavaScript 控制器中的图像。
我还是 Angular 的新手,也许这个问题不是什么大问题,但我没有找到解决方法。
我的代码很简单,一个简单的html代码:
<div class="container" flow-init
flow-file-added="!!{png:1,gif:1,jpg:1,jpeg:1}[$file.getExtension()]"
flow-files-submitted="$flow.upload()">
<h1>flow image example</h1>
<hr class="soften"/>
<div>
<div class="thumbnail" ng-hide="$flow.files.length">
<img src="http://www.placehold.it/200x150/EFEFEF/AAAAAA&text=no+image" />
</div>
<div class="thumbnail" ng-show="$flow.files.length">
<img flow-img="$flow.files[0]" />
<h2>{{$flow.files[0].name}}</h2>
</div>
<div>
<span class="uk-button" ng-hide="$flow.files.length" flow-btn flow-attrs="{accept:'image/*'}">Select image</span>
<a href="#" class="btn" ng-show="$flow.files.length" flow-btn flow-attrs="{accept:'image/*'}">Change</a>
<a href="#" class="btn btn-danger" ng-show="$flow.files.length" ng-click="$flow.cancel()"> Remove </a>
<span class="uk-button" flow-btn>Upload File</span>
</div>
<p>
Only PNG,GIF,JPG files allowed.
</p>
</div>
</div>
ng-flow 需要的工厂是:
routerApp.config(['flowFactoryProvider', function (flowFactoryProvider) {
flowFactoryProvider.defaults = {
target: 'upload.php',
permanentErrors: [404, 500, 501],
maxChunkRetries: 1,
chunkRetryInterval: 5000,
simultaneousUploads: 4,
singleFile: true
};
flowFactoryProvider.on('catchAll', function (event) {
console.log('catchAll', arguments);
});
}]);
我也有这个页面的控制器代码。我试图访问图像,但我不知道该怎么做。
任何想法?
如果您知道使用其他工具执行此操作的任何方法或知道一个好的教程,我真的很想知道。
谢谢大家。