Modal Creation Service

I also had to use many modals in my app, furthermore I would like to pass parameters.
I created the service regarding the link below, you can use it inside another service which returns the modals already defined:

Ionic modal service

angular.module('app')
.factory('myModals', ['appModalService', function (appModalService){

var service = {
	showLogin: showLogin,
	showEditUser: showEditUser
};

function showLogin(userInfo){
	// return promise resolved by '$scope.closeModal(data)'
	// Use:
	// myModals.showLogin(userParameters) // get this inject 'parameters' on 'loginModalCtrl'
	//	.then(function (result) {
	//		// result from closeModal parameter
	//	});
	return appModalService.show('templates/modals/login.html', 'loginModalCtrl as vm', userInfo)
	// or not 'as controller'
	// return appModalService.show('templates/modals/login.html', 'loginModalCtrl', userInfo)
}

function showEditUser(address){
	// return appModalService....
}

}]);
1 Like