有图像时如何更改拍照文字以重拍照片文字 [英] how to change take photo text to retake photo text when there is image
本文介绍了有图像时如何更改拍照文字以重拍照片文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发一款相机应用程序。有一个名为拍照
的按钮,用户可以拍照并显示在该按钮的下面。
I am working on one camera app. There is one button called Take Photo
where user can take photo and it will show in below of that button.
我需要的是。一旦我拍摄照片n =并且当照片显示在拍照按钮下时。我想更改拍照以重拍照片的文字。如果没有图像可用,我需要显示拍照文字。如何做到这一点?
What i need is. Once i took picture n=and when photo is show under take photo button. I want to change the text from take photo to retake photo. If no images are available i need to show take photo text. How to do that ?
这里我的代码 html
:
<button class="button button-energized" ng-click="getPhoto()">
Take Photos
</button>
<div class="spacer" style="height: 10px;" ></div>
<div style="padding-left: 20px; padding-top: 10px; padding-bottom: 30px;">
<img ng-src="{{lastPhoto}}" style="max-width: 70%;max-height: 70%;">
</div>
我的控制器代码:
My controller code :
$scope.getPhoto = function() {
Camera.getPicture().then(function(imageURI) {
console.log(imageURI);
$scope.lastPhoto = imageURI;
}, function(err) {
console.err(err);
}, {
quality: 75,
targetWidth: 320,
targetHeight: 320,
saveToPhotoAlbum: false
});
};
推荐答案
您可以使用 ng-show 或 ng-if 为此
You can use ng-show or ng-if for this
<button class="button button-energized" ng-click="getPhoto()"><span ng-if="!lastPhoto ">Take Photos</span><span ng-if="lastPhoto">Retake Photo</span></button>
这篇关于有图像时如何更改拍照文字以重拍照片文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文