Recommended Posts

Anyone have any luck with angular2 and split text.

 

when i try and run it on a component thats part of a template it bombs out complaining about SplitText .length   which to me just says its not getting the template from Angular?? 

 

export class AboutBgComponent implements AfterViewInit {

private spicy = "this is my text";
private mySplitText:any;
constructor() {}

ngAfterViewInit() {
this.mySplitText = new SplitText(this.spicy, {type:"words"});
console.log(this.spicy)
}
}

 

tried in the constructor, tried after init as well as a bunch of other things not included in this demo.  So anyone who can spin up an angular2 app and let me know? :)

Share this post


Link to post
Share on other sites

ok I fixed it. started fresh and got it working. 

Share this post


Link to post
Share on other sites

You'll need to be a little more specific. What's the problem? The code above obviously won't work because it's targeting a string.

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.