离子模态 - document.getElementById不适用于模态

时间:2016-01-04 16:39:02

标签: javascript angularjs cordova ionic

我有一个像这样的离子模式:

$ionicModal.fromTemplateUrl('templates/my-modal.html', {
  scope: $scope,
  animation: 'slide-in-up'
}).then(function(modal) {
  $scope.modal = modal
  $scope.modal.show()
})

模态看起来像这样:

<ion-modal-view ng-controller="EditCtrl" class="modal">
  <ion-header-bar class="modal-header-bar">
    <button class="button button-clear">Cancel</button>
    <h1 class="title">Edit</h1>
    <button class="button button-clear">Save</button>
  </ion-header-bar>
  <ion-content>
    <div id="foo"></div>
  </ion-content>
</ion-modal-view>

然后在edit_controller.js

document.getElementById('foo')

返回null。如何document引用当前显示的模态?

0 个答案:

没有答案