Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSrdjan Cestic
6,855 Pointsng-class?
When I code ng-class="{'div.actions': editing}"; or ng-class="{'editing-item': editing}"; I always have some little padding when I click edit. Am I miss something? Please take a look on my workspace: https://w.trhou.se/q36dog428u
2 Answers
Stephen Rust
497 PointsYour ng-class directive should read:
ng-class="{'editing-item': editing}"
This applies the CSS class .editing-item to the .item div when the editing variable is true.
Your ng-class directive is incorrect. There's no need to include 'div.actions', as that's not a CSS class and the ng-class directive is already living in the div in on to which the new class will be applied.
Only include the .editing-item class in the first part of the directive.
Srdjan Cestic
6,855 PointsOk, but why're we using object to set value? Is that because we use CSS selector or that's just a way that ng-class work?
Thanks