Alan2
Alan2

Reputation: 24572

Is there a way to change the label that displays inside a button using AngularJS?

I have button code like this:

<button class="small float-right"
   data-ng-click="tag()"
   data-ng-disabled="qs.tag == true">
   Tag
</button>

Is there a way I could change this so it displays Tagged as the label the button is clicked and qs.tag = true and the displays Tag when I click the button again and qs.tag is false.

Upvotes: 0

Views: 62

Answers (2)

Chandermani
Chandermani

Reputation: 42669

Try this {{qs.tag?"Tagged":"Tag"}}

Upvotes: 1

charlietfl
charlietfl

Reputation: 171669

Try

Tag<span ng-show="qs.tag">ed</span>

Upvotes: 1

Related Questions