在ionic1中屏幕旋转时出现Whitescreen

时间:2017-09-13 13:33:25

标签: javascript angularjs ionic-framework ionic-v1

我有一个屏幕,当我改变方向时,我已经给出了方向,屏幕需要一些时间来改变方向,我得到白屏可以有人告诉我为什么它会发生,即使我尝试过使用

window.addEventListener("orientationchange", function() {
    $ionicScrollDelegate.resize(); 
  }, false);

在奔跑但我仍然遇到同样的问题。

方向更改代码:

function toggleOrientation () {
  $log.log('orientation: ', vm.orientation);
  if (vm.orientation === 'portrait') {
    vm.orientation = 'landscape';
    screen.orientation.lock('landscape');
    $log.log('TrackeventLandscape', Track.Orientation_landscape);
    Analytics.trackEvent(Track.Orientation_landscape);
  } else {
    vm.orientation = 'portrait';
    screen.orientation.lock('portrait');
    $log.log('Trackeventportrait', Track.Orientation_portrait);
    Analytics.trackEvent(Track.Orientation_portrait);
  }
}

HTML:

<ion-content>
  <div class="list nodata padding-15" ng-if="vm.daybooks.length === 0">
     <h4>
        <p>{{"nodatatoshow_message" | translate}}</p>
     </h4>
  </div>
  <ul class="trans-item m-t-20 m-r-10 m-l-10">
     <li ng-repeat="date in vm.uniqueDaybooks" class="FramerList list">            
        <a class="item item-icon-right dblist"> {{date}}
        <i class="icon ion-android-download" ng-click="vm.download(date)"></i>
        </a>            
        <div class="tableContainer">
          <table class="ledgerTable" cellspacing="10">
             <thead>
                <tr class="ledgerTblHeader">
                   <th>{{"user_message" | translate}}</th>
                   <th>{{"name_message" | translate}}</th>
                   <th>{{"desc_message" | translate}}</th>
                   <th>{{"income_message" | translate}}</th>
                   <th>{{"expenses_message" | translate}}</th>
                </tr>
             </thead>                 
             <tbody>
                <tr ng-repeat="daybook in vm.daybooks | filter: {date: date}" ng-click="vm.gotoDaybookDetail(daybook)">
                   <td>{{daybook.user_type === 'User' ? 'Expense' : daybook.user_type}}</td>
                   <!-- <td>{{daybook.location | limit }}</td> -->
                   <td>{{daybook.transaction_type === 'Expense' ? daybook.category : daybook.location | limit }}</td>
                   <td ng-if="daybook.transaction_type === 'FarmerTrade'">Bill-No: {{daybook.bill_no}}</td>
                   <td ng-if="daybook.transaction_type === 'Expense'">{{daybook.description | isNullExpense}}</td>
                   <td ng-if="daybook.transaction_type !== 'BuyerPayment' && daybook.transaction_type !== 'FarmerTrade' && daybook.transaction_type !== 'Expense'">{{daybook.category ? daybook.category : daybook.description | isNullAdvance}}</td>
                   <td ng-if="daybook.transaction_type === 'BuyerPayment'">{{daybook.category ? daybook.category : daybook.description | isNullPayment}}</td>
                   <td align="right">{{daybook.amount_in}}</td>
                   <td align="right">{{daybook.amount_out}}</td>
                </tr>
             </tbody>
          </table>
        </div>
     </div>
     </li>
  </ul>

0 个答案:

没有答案