Many people are complaining that there isn't an example of how to use the "map" syntax. I've updated ng-class example to use the map approach.
@xjamundx - thanks for this PR. I think that it would be best if we showed all the types of syntax that ng-class can take rather than just replacing the string version with the object version. There is also an array syntax too.
Can you update your PR accordingly?
Example updated to show an example as seen here:
Now the array example is a bit contrived. Let me know if you have any better idea :)
Oh and the E2E test example will be broken. I'll try to get onto that next....
I've updated the docs, but can't figure out how to run the tests locally, they seem to fail on travis on (seemingly) unrelated things.
I've simplified the example and locally the tests (related to my example) all pass. If its failing it's because of a problem with master. See example here:
@xjamundx some thoughts:
Thanks for the great feedback, I'll keep messing with it!
Cool! If you update the PR, can you tag me in a comment so I'll be sure to get a notification?
Okay, I left the demo basically the same, but I believe by combining most of the code into the HTML it becomes much more apparent what's going on and is hopefully a more useful example.
@jeffbcross Adding an interactive array example I think was non-trivial and would complicate the example. I was going to do something with select boxes and letting people remove them, but I couldn't figure out how to do it without adding back a <script> which is way less fun :-p Any other ideas?
I have an idea for a decent example....multiple text boxes. I'll give it a shot.
Let me know what you think about the new version @jeffbcross
Will do! I'll take a look once I wrap up another issue.
Any feedback yet @jeffbcross. I'd love to get this merged if possible :)
@xjamundx it looks like you need to rebase against master. There were some upstream changes that are causing conflicts.
Updated the class example to include string, map and array syntax
Okay so I did rebase and removed the new animation stuff. Obviously it may be a requirement to add it back in, but in my opinion it makes the actual class demo way more confusing and for my demo it becomes 9x more complicated (3x as many classes per class)......so let me know if you want me to re-think my demo to add animations or if this will work. Thanks @jeffbcross
Perhaps add an "expression" syntax too?
bold === true ? 'bold' : "italic"
@xjamundx @ksheedlo and I reviewed the latest, and we like the way this works now, but the animation example needs to be included, not removed. I'm not sure where the complexity lies with including animations AND your new examples, but could you find a simple way to have both?
docs(ngClass): updated the example with string, map and array syntax
yay thanks for merging this!