Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Programmatically set active segment button? #4

Open
tverilytt opened this issue May 11, 2017 · 1 comment
Open

Programmatically set active segment button? #4

tverilytt opened this issue May 11, 2017 · 1 comment

Comments

@tverilytt
Copy link

Thanks for making this for Ionic 1, it is working well for me :-)

I wonder if it could be possible to enable programmatically setting which segment button is the active one?

Cheers
-jo

@tverilytt
Copy link
Author

tverilytt commented Aug 22, 2017

Ended up using querySelect to modify the class attribute of the segment buttons...
E.g.
var lineSegment = document.querySelector('li[value="line"]');
var timeSegment = document.querySelector('li[value="time"]');
if (segment === 'line && lineSegment && timeSegment) {
lineSegment.setAttribute('class', 'active');
timeSegment.removeAttribute('class');
}
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant