ng-mouseover for class change

6,441 views
Skip to first unread message

Paul

unread,
Feb 26, 2013, 4:00:08 AM2/26/13
to ang...@googlegroups.com
Hi,

I am trying to have a div change textcolor on mouseover. I was under the impression that it was possible to do this directly with the
class directive like this:
<div class="ng-mouseover:'someclass'">test</div>

But I can't seem to get it to work. The fiddle is here:

Thank you for your help,
Paul

Pawel Kozlowski

unread,
Feb 26, 2013, 4:37:52 AM2/26/13
to ang...@googlegroups.com
Hi!

On Tue, Feb 26, 2013 at 10:00 AM, Paul <i...@paal.dk> wrote:
> I am trying to have a div change textcolor on mouseover. I was under the
> impression that it was possible to do this directly with the
> class directive like this:
> <div class="ng-mouseover:'someclass'">test</div>

Nope, this syntax doesn't work.

You will have to type a bit more: http://jsfiddle.net/E8nM5/

Cheers,
Pawel


--
Looking for bootstrap-based widget library for AngularJS?
http://angular-ui.github.com/bootstrap/

Paul

unread,
Feb 26, 2013, 4:51:57 AM2/26/13
to ang...@googlegroups.com
Yeah that did the trick. I guess I'll have to live with the extra directive, thanks!

Cheers,
Paul

Marius Kubrakov

unread,
Oct 8, 2013, 3:12:01 AM10/8/13
to ang...@googlegroups.com
Hello, 

You should use something like this    ng-class="{'ibActive':expandedInfoBox}" ng-mouseenter="expandedInfoBox=true" ng-mouseleave="expandedInfoBox=false"
Reply all
Reply to author
Forward
0 new messages