有这么一个需求:
用IoNic做移动端前端的时候,需要放大和缩小图片,用了好几种办法都不行,由于这款app是嵌套在类似于微信的app使用的,你就把它当做是仿微信的小程序算了。只有一种办法能够实现放大和缩小功能,哪就是直接给出a标签或者直接打开一个新窗口,这样用户可以双指滑动放大和缩小。
现在问题是:当用户点击a标签的时候,进去新的窗口,虽然说新窗口把久窗口覆盖,但是用户按返回键的时候,当初的页面的参数不在了。显示的是一堆angluar表达式。这方法如果用jQuery来做的话,返回的时候带参数回来就行,但是angluarJs怎么做的?
<div class="row row-wrap">
<div class="col col-33" ng-repeat="attach in data.attaches" ng-switch on="attach.mime | limitTo:5">
<a ng-href="#/image/{{attach.id}}" ng-switch-when="image"><img class="image-tb" ng-src="../../action/comm/file/image-tb/{{attach.id}}"></img></a>
<a ng-href="#/video/{{attach.id}}" ng-switch-when="video"><img class="image-tb" ng-src="../../images/play.png"></img></a>
</div>
</div>
<script id="image.html" type="text/ng-template">
<ion-view>
<ion-content>
<img width="100%" height="100%" ng-src="../../action/comm/file/online/{{fileId}}"></img>
</ion-content>
</ion-view>
</script>
// 图片查看页面的控制器
.controller('ImageCtrl', function($scope, $stateParams, $state, dqDataLoader) {
$scope.fileId = $stateParams.fileId;
})