bali
bali

Reputation: 337

how to apply text decoration:line thorough on clicking a checkbox in angular

I made an Activity tracker that adds activity on clicking Add Activity and deletes all activities on clicking Clear All buttons and displays list of activities with a checkbox. Now what I want is to apply text-decoration: line-through and change the color of the activity text to red when checkbox of that particular activity is clicked. Here is a Working demo and picture of what i m trying to do. I tried several ways to do this but I guess there will be some quick and smart way to do this using ngClass directive(that I m not finding a way to implement). So I am expecting a smart way not classic and lengthy.

enter image description here

Upvotes: 2

Views: 613

Answers (1)

user4676340
user4676340

Reputation:

Why would you need NgClass ?

Just use CSS.

Demo

input[type="checkbox"]:checked+span {
  text-decoration: line-through;
  color: red;
}

Upvotes: 5

Related Questions