Angular service that converts camel case strings to hyphenated

Issue

I understand that Angular converts directive names from camel case to hyphen separated strings.

Is this functionality accessible through the API, like a function or something?
I would like to convert some strings to hyphenated versions in my angular app and I don’t want to reinvent the wheel if not necessary.

Solution

The function used can be found here

Unfortunately, it is not available through API.

lodash has method kebabCase that does exactly this.

Answered By – Stas

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published