Ionic Loading template with ng-click and controller firing


#1

Is it possible to fire a controller function. From a template in ionic loading? Can anyone setup an example?

I can associate a template to a controller, but the ng-click of a button does not fire the function in the controller. Below is the example code.

	show : function() { //code from the ionic framework doc
		// Show the loading overlay and text
		$rootScope.loading = $ionicLoading.show({
			// The text to display in the loading indicator
			//template: 'Loading',
			template: '<div ng-controller="CancelPromise">' + '<button class="button button-medium button-positive"  ng-controller="CancelPromise" ng-click="showAlert()">Cancel</button></div>',
			
			// The animation to use
			animation: 'fade-in',
			// Will a dark overlay or backdrop cover the entire view
			showBackdrop: true,
			// The maximum width of the loading indicator
			// Text will be wrapped if longer than maxWidth
			maxWidth: 200,
			// The delay in showing the indicator
			showDelay: 200
		});
	},

I show ionic loading before making a promise. Ideally id like the button to cancel the promise.