Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Communicating use more clearly. #4914

Closed
wants to merge 1 commit into from
Closed

Communicating use more clearly. #4914

wants to merge 1 commit into from

Conversation

kentcdodds
Copy link

With both the class and the expression having the exact same name it makes it difficult to learn how to use this directive just from looking at this example. By making this simple change it makes the example of the ngClass directive much more clear.

With both the class and the expression having the exact same name it makes it difficult to learn how to use this directive just from looking at this example. By making this simple change it makes the example of the `ngClass` directive much more clear.
@@ -98,7 +98,7 @@ function classDirective(name, selector) {
* @example Example that demonstrates basic bindings via ngClass directive.
<example>
<file name="index.html">
<p ng-class="{strike: strike, bold: bold, red: red}">Map Syntax Example</p>
<p ng-class="{strikeClass: strike, boldClass: bold, redClass: red}">Map Syntax Example</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might make the intent more clear to call the expression variables shouldStrike and shouldBold and shouldRed, too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to do that, but below we allow them to type "bold" and have it bold. I would rather not force them to type shouldBold

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kentcdodds - Actually, the opposite is true. What you type in below is the name of the CSS class, so given you change you would need to type in boldClass to get it to work.

@petebacondarwin
Copy link
Contributor

@kentcdodds - thanks for this PR but your change actually broke the other parts of the demo.
I made a different change to make the scope properties and CSS classes more distinct.
If you think it can be improved further please provide another PR.

@kentcdodds
Copy link
Author

I guess that's what I get for using the github editor and not double checking my assumptions :) Glad it'll be more clear now!

@kentcdodds kentcdodds deleted the patch-1 branch November 14, 2013 14:08
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants