You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Step 3: Add directive to HTML node you want to split and template ID to reference this Directive in Component (example: #text):
<p#textngGxSplitText>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus amet consequuntur culpa
delectus, doloribus exercitationem ipsam, laudantium molestiae non numquam odit omnis optio praesentium quae ratione
similique sit soluta voluptatem?</p>
Step 4: Add @ViewChild to access node words, lines and chars by previously assigned ID:
Defer initiation (for manual initiation use initSplit())
mask
boolean
false
Add mask/wrap (overflow: hidden) for words
onlyWords
boolean
false
Split only words without chars
Example:
<p#textngGxSplitText>Lorem ipsum dolor...</p> // Default options
<p#textngGxSplitText[splitOptions]="{defer: true, ...}">Lorem ipsum dolor...</p> // Custom options
Properties
Name
Type
Description
isInit
boolean
Is Split Text applied
nativeElement
HTMLElement
Container HTMLElement
words
HTMLElement[]
Words HTMLElement array
chars
HTMLElement[]
Chars HTMLElement array
line-words
HTMLElement[][]
Line array with words HTMLElement array
line-chars
HTMLElement[][]
Line array with chars HTMLElement array
Example:
this.text.isInit// console.log(true);this.text.srcText// console.log(Lorem ipsum dolor...);
Methods
Name
Description
initSplit()
Initialize Split Text (For using in case defer: true)
resetSplit()
Reset to source text
Example:
ngAfterViewInit(): void{// if Split Text already initialized (defer: false)this.text.initSplit();// Return WARNING! Text already initialized// if Split Text not initialized (defer: true)this.text.initSplit();// It's OK!}