I am writing an app with AngularJS 1.5.3. I am using the $ionicModal service to show modals to my users.
I want to move my code into the 'controller as' syntax but I am not sure how to do that with 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();
};
}
})();