Ionic Buttons that return text


#1

Hi there…

I was hoping somebody could help me understand how I can code up the following :

The user is presented with a selection of buttons .
When the user clicks on a selection of these buttons/options, text/data associated with all the buttons/options that were selected are returned to the screen?
I am just starting out, so any info on buttons that can return text based on it being clicked would be great!

Thank you in advance :slight_smile:


#2

HTML:

<button class="button button-light" ng-click="displayData('Hi this is the associated text')">
  Click Me
</button>

Controller:

// I'd recommend using $cordovaDialogs.alert instead of the default JavaScript alert
$scope.displayData = function(data) {
	alert(data);
};

#3

Hi @seanhill,

Thank you so much :slight_smile: