D
D
Drm2015-10-16 14:50:52
Angular
Drm, 2015-10-16 14:50:52

How to add a class to the body tag in different states?

The problem is the following. there is an Angular application with a standard structure.

<body>
    <ui-view></ui-view>
</body>

Routing works through ui-router, of course.
It is necessary that various states can add their own class to the body tag. For example, state1 could add its own class, and state2 could add its own.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-10-16
@Drm

https://gist.github.com/fesor/226fce4a4aee5fb30454 - like this.
Or in the directive, subscribe to $stateChangeSuccess and replace classes. I used to have one like this somewhere but lost it...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question