I am writing an application with AngularJS 1.5.3. I use the $ ionicModal service to show modalities to my users.
I want to move my code to the controller-like syntax, but I'm not sure how to do this using the $ ionicModal service.
Here is my controller code:
(function () {
"use strict";
angular
.module('myApp')
.controller('myController', myController);
myController.$inject = [
'$scope',
'$ionicModal',
'myService'
];
function myController($scope, $ionicModal, myService) {
$scope.data = myService.data;
$scope.openModal = openModal;
$ionicModal.fromTemplateUrl('./myPath/modal.html', function ($ionicModal) {
$scope.modal = $ionicModal;
}, {
scope: $scope,
animation: 'slide-in-up'
});
$scope.$on('$destroy', function () {
$scope.modal.remove();
});
function openModal() {
$scope.modal.show();
};
}
})();
source
share