2017-01-16 12 views
0

こんにちは、人々!
私はIonic Frameworkアプリケーションを使用しています。私はギャラリーから写真を選択し、それらをプレビューで見たいと思う。
問題は、$ scopeが更新されていますが、新しい選択した画像を表示するために、アプリで何かをアニメーション化する必要があり、それが私にとって奇妙なことです。

私はPoC hereを作成しました。

イオン情報:私の見解では

Silviu:~ silviu$ ionic info 

Your system information: 

Cordova CLI: 6.4.0 
Ionic CLI Version: 2.1.18 
Ionic App Lib Version: 2.1.9 
ios-deploy version: 1.9.0 
ios-sim version: 5.0.8 
OS: macOS Sierra 
Node Version: v7.4.0 
Xcode version: Xcode 8.2.1 Build version 8C1002 

私はコードを持っている:私のコントローラで

 <label class="item item-input item-stacked-label"> 
     <button class="button" ng-click="doGetImage()">Incarca imagini</button> 
    </label> 
    <ion-list> 
     <ion-item ng-repeat="item in toBeUploaded"> 
     <img ng-src={{item.base_src}} class="image-list-thumb"/> 
     {{item.file_name}} 
     <a ng-click="deleteImage(item)">Sterge</a> 
     </ion-item> 
    </ion-list> 

私は、次の機能があります。



    $scope.toBeUploaded = []; 
    $scope.doGetImage = function() { 
    var options = { 
     maximumImagesCount: 1, // only pick one image 
     width: 800, 
     height: 800, 
     quality: 80 
    }; 

    var fileName, path; 

    var element = {}; 

    $cordovaImagePicker.getPictures(options) 
     .then(function (results) { 
     window.resolveLocalFileSystemURL(results[0], onResolveSuccess, fail); 

     function onResolveSuccess(fileEntry) { 
      // convert to Base64 string 
      fileEntry.file(
      function (file) { 
       //got file 
       var reader = new FileReader(); 
       reader.onloadend = function (evt) { 
       element.base_src = evt.target.result; 
       }; 
       reader.readAsDataURL(file); 

      }, 
      function (evt) { 
       //failed to get file 
      }); 

     } 
     // error callback 
     function fail(fct) { 
      console.log("Error"); 
     } 

     // lets read the image into an array buffer.. 
     // see documentation: 
     // http://ngcordova.com/docs/plugins/file/ 
     fileName = results[0].replace(/^.*[\\\/]/, ''); 
     // modify the image path when on Android 
     if ($ionicPlatform.is("android")) { 
      path = cordova.file.cacheDirectory 
     } else { 
      path = cordova.file.tempDirectory 
     } 
     element.file_name = fileName; 
     element.path = path; 
     $scope.toBeUploaded.push(element); 
     }); 
     } 

答えて

関連する問題