I up this topic because I have a similiar issue.
I have a bunch of controller, the modal is shown perfectly on browser and on device but only for the first modal. If I try to call a modal inside a new controller in a pushed view, my modal cannot load on device (but it works on browser and ionic lab).
Can anyone help me with this issue ? the only fix I found was to put script inside the html code but I donât like this approach
Here is my index html which have my side menu :
<body ng-app="TrainCommander">
<ion-side-menus ng-controller="MenuCtrl as Menu">
<ion-pane ion-side-menu-content="">
<ion-nav-bar class="bar-tc nav-title-slide-ios7">
<ion-nav-back-button>Retour</ion-nav-back-button>
</ion-nav-bar>
<ion-nav-view></ion-nav-view>
</ion-pane>
<ion-side-menu side="left">
<ion-header-bar class="bar bar-header bar-tc menu-header padding">Bienvenue, msavares !</ion-header-bar>
<ion-content has-header="true" id="content-menu">
<ion-list>
<ion-item class="menu-item" ng-click="openProfile()" menu-close="">
<i class="ion-person"></i> Profil
</ion-item>
<ion-item class="menu-item" ng-click="openAbout()" menu-close="">
<i class="ion-ios-information"></i> A Propos
</ion-item>
<ion-item class="menu-item" ng-click="openContact()" menu-close="">
<i class="ion-email"></i> Contact
</ion-item>
<ion-item class="menu-item logout" ng-click="" menu-close="">
<i class="ion-power"></i> <strong>Se déconnecter</strong>
</ion-item>
</ion-list>
</ion-content>
</ion-side-menu>
</ion-side-menus>
</body>
Here is my menu.js which have my modal and which can be open as normal :
angular.module("TrainCommander.Menu", [])
.controller("MenuCtrl", function($ionicModal, $scope, $state) {
// ABOUT
$ionicModal.fromTemplateUrl("modules/About/about.html", {
scope: $scope,
//controller: "AboutCtrl",
animation: "slide-in-up"
}).then(function(modal) {
$scope.aboutModal = modal;
});
$scope.openAbout = function() {
$scope.aboutModal.show();
};
$scope.closeAbout = function() {
$scope.aboutModal.hide();
};
// CONTACT
$ionicModal.fromTemplateUrl("modules/Contact/contact.html", {
scope: $scope,
animation: "slide-in-up",
controller: "ContactCtrl"
}).then(function(modal) {
$scope.contactModal = modal;
});
$scope.openContact = function() {
$scope.contactModal.show();
};
$scope.closeContact = function() {
$scope.contactModal.hide();
};
$scope.$on("modal.shown", function() {
var map;
var myLatLng = {lat: 43.6958795, lng: 7.2516615};
map = new google.maps.Map(document.getElementById('map'), {
lat: myLatLng,
zoom: 8
});
});
// PROFIL
$ionicModal.fromTemplateUrl("modules/Profile/profile.html", {
scope: $scope,
controller: "ProfileCtrl",
animation: "slide-in-up"
}).then(function(modal) {
$scope.profileModal = modal;
});
$scope.openProfile = function() {
$scope.profileModal.show();
};
$scope.closeProfile = function() {
$scope.profileModal.hide();
};
});
` And here is the same example in another view which is pushed via ion-nav-view, and itâs impossible to get it called on device
angular.module('TrainCommander.SearchResults', [])
.controller('SearchResultsCtrl', function($scope,$ionicModal, $state) {
$ionicModal.fromTemplateUrl("modules/TrainRoute/trainRoute.html", {
scope: $scope,
//controller: "AboutCtrl",
animation: "slide-in-up"
}).then(function(modal) {
$scope.routeModal = modal;
});
$scope.openRoute = function() {
$scope.routeModal.show();
};
$scope.closeRoute = function() {
$scope.routeModal.hide();
};
});
Thanks in advance for your answer