Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

Add html of button as a paramater for button's ng click function

$
0
0

Hi,

I'm pulling through a json file into my Ionic html file. For some lines of text, I have transformed them into a button.

My plan is that when the user clicks the button, the html of that button is passed as an argument to the 'ng-click' function (on the button).

But I'm struggling to do this - despite Google searches.

My HTML for the two buttons is:

        <p><span class="button button-positive button-small" ng-click=personalBest()>{{workout[0].box.cfhackney.daily[0].strength.exercise[0].movement.type[0]}}</span></p>

When, I run 'Ionic serve', the HTML text for the above button is "Deadlift"

         <p><span class="button button-positive button-small button-text" ng-click=personalBest()> {{workout[0].box.cfhackney.daily[0].strength.exercise[0].movement.type[1]}}</p>

The HTML text in the above button is "Squat"

I'ld like both Deadlift and Squat to be passed as arguments to the 'ng-click=personalBest()' function on the buttons.

How can I do this? I've tried putting the whole data-call as an argument to ng-click - but am looking for a better way as the button's html will likely change and I would like the ng-click argument to correspond with this.

    <span class="button button-positive button-small" ng-click=personalBest(workout[0].box.cfhackney.daily[0].strength.exercise[0].movement.type[0])>
        {{workout[0].box.cfhackney.daily[0].strength.exercise[0].movement.type[0]}}
    </span>

My github reference is https://github.com/elinnet/protocf (the html file is located at
testapp/www/templates/tab-wod.html)

Many thanks.


Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>