Last active
October 3, 2019 15:17
-
-
Save andermoran/e0e5a4e802f77dd585e449972a4827fa to your computer and use it in GitHub Desktop.
This dynamic style in angular allows us to create dynamic css classes at runtime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let hrStyle: string = ` | |
.underline { | |
height: .25rem; | |
width: 0%; | |
margin: 0; | |
background: black; | |
border: none; | |
transition: .3s ease-in-out; | |
position: relative; | |
} | |
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getStyleClass(tab: Tab) { | |
let index = 0; | |
for (let i = 0; i < this.tabs.length; i++) { | |
if (this.selectedTab == this.tabs[i]) { | |
index = i+1; | |
} | |
} | |
let str = '{ "tabSelected tabUnderline" : ' + String(this.selectedTab == tab) + ' }'; | |
return JSON.parse(str); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment