由网友(丢了天真失了美好)分享简介:在我的应用程序,您好我已经用于登录的离子态Hi in my app i have already a ionic modal for login $ionicModal.fromTemplateUrl('templates/login.html', {scope: $scope}).then(function(mo...
在我的应用程序,您好我已经用于登录的离子态
Hi in my app i have already a ionic modal for login
$ionicModal.fromTemplateUrl('templates/login.html', {
scope: $scope
}).then(function(modal) {
$scope.modal = modal;
});
现在我需要创建一个新的HTML页新的离子态。我怎样才能做到这一点?
Now i need to create a new ionic modal with new html page. How can I do this?
推荐答案
虽然答案是完全有效的,但你并不需要每次你需要一个模态时创建新的控制器。
While the answer is completely valid, but you don't need to create new controller every time you need a modal.
app.controller('Ctrl1' function($scope, $ionicModal){
$ionicModal.fromTemplateUrl('modalA.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.ModalA= modal;
});
$ionicModal.fromTemplateUrl('modalB.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.ModalB= modal;
});
//now you can indivitaully call any modal to show
$scope.ShowModalA = function (){
$scope.ModalA.show()
}
$scope.ShowModalB= function (){
$scope.ModalB.show()
}
})
相关推荐
最新文章