1
我一直在關注離子框架文檔嘗試在按鈕上實現離子模態點擊http://ionicframework.com/docs/api/service/ $ ionicModal。 但按鈕click.all幾乎沒有工作。我已閱讀幾乎每個帖子和建議,但它不會工作。離子模型顯示和隱藏不工作
我可以請一些方向,這裏可能會出錯嗎? modal.html:
<ion-modal-view>
<ion-header-bar>
<h1 class="title">Edit Contact</h1>
</ion-header-bar>
<ion-content>
<div class="list">
<label class="item item-input">
<span class="input-label">Name</span>
<input type="text" ng-model="contact.name">
</label>
<label class="item item-input">
<span class="input-label">Info</span>
<input type="text" ng-model="contact.info">
</label>
</div>
<button class="button button-full button-energized" ng-click="closeModal()">Done</button>
</ion-content>
</ion-modal-view>
控制器:
.controller('HomeTabCtrl', function($scope, $ionicModal) {
console.log('HomeTabCtrl');
$ionicModal.fromTemplateUrl('templates/modal.html', {
scope: $scope
}).then(function(modal) {
$scope.modal = modal;
});
$scope.openModal = function(){
$scope.modal.show();
}
})
我稱它在點擊一個按鈕:
<ion-view view-title="Facts" ng-controller="HomeTabCtrl">
<ion-content class="padding">
<div class="buttons" ng-controller="HomeTabCtrl">
<button class="button button-icon ion-compose" ng-click="openModal()">
</button>
</div>n
</ion-content>
</ion-view>
我已經打過電話modal.show()而不是openModal()
功能但沒有幫助。 代碼有什麼問題嗎?我該如何解決?
請按照這個http://stackoverflow.com/questions/37368080/ionic-model-login-window-as-global-method/40621344#40621344答案爲多個模型在離子框架... –