8000 docs(ngClass): add class 'has-error' to demonstrate hyphen use by qbzzt · Pull Request #12027 · angular/angular.js · GitHub
[go: up one dir, main page]

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

docs(ngClass): add class 'has-error' to demonstrate hyphen use #12027

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added class red-error to demonstrate hyphen use
Because hyphens, such as those you find in the Bootstrap theme, require special handling (quotes) when ngClass uses an object.
  • Loading branch information
qbzzt committed Jun 4, 2015
commit 1f6b814af7f6ff328b9409cf143c9d9d27f54090
6 changes: 5 additions & 1 deletion src/ng/directive/ngClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function classDirective(name, selector) {
* @example Example that demonstrates basic bindings via ngClass directive.
<example>
<file name="index.html">
<p ng-class="{strike: deleted, bold: important, red: error}">Map Syntax Example</p>
<p ng-class="{strike: deleted, bold: important, 'red-error': error}">Map Syntax Example</p>
Copy link
Member

Choose a reason for hiding this comment

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

This is too similar to red (and not very intuitive) :)
How about changing it to 'has-error': error.

Then you need to change the CSS class (to has-error) and also update the text on line 176 to error (apply "has-error" class).

<label>
<input type="checkbox" ng-model="deleted">
deleted (apply "strike" class)
Expand Down Expand Up @@ -202,6 +202,10 @@ function classDirective(name, selector) {
.red {
color: red;
}
.red-error {
color: red;
background-color: yellow;
}
.orange {
color: orange;
}
Expand Down
0