|
9 | 9 | * The `ngStyle` directive allows you to set CSS style on an HTML element conditionally.
|
10 | 10 | *
|
11 | 11 | * @element ANY
|
12 |
| - * @param {expression} ngStyle {@link guide/expression Expression} which evals to an |
13 |
| - * object whose keys are CSS style names and values are corresponding values for those CSS |
14 |
| - * keys. |
| 12 | + * @param {expression} ngStyle |
| 13 | + * |
| 14 | + * {@link guide/expression Expression} which evals to an |
| 15 | + * object whose keys are CSS style names and values are corresponding values for those CSS |
| 16 | + * keys. |
| 17 | + * |
| 18 | + * Since some CSS style names are not valid keys for an object, they must be quoted. |
| 19 | + * See the 'background-color' style in the example below. |
15 | 20 | *
|
16 | 21 | * @example
|
17 | 22 | <example>
|
18 | 23 | <file name="index.html">
|
19 |
| - <input type="button" value="set" ng-click="myStyle={color:'red'}"> |
| 24 | + <input type="button" value="set color" ng-click="myStyle={color:'red'}"> |
| 25 | + <input type="button" value="set background" ng-click="myStyle={'background-color':'blue'}"> |
20 | 26 | <input type="button" value="clear" ng-click="myStyle={}">
|
21 | 27 | <br/>
|
22 | 28 | <span ng-style="myStyle">Sample Text</span>
|
|
30 | 36 | <file name="protractor.js" type="protractor">
|
31 | 37 | var colorSpan = element(by.css('span'));
|
32 | 38 |
|
33 |
| - it('should check ng-style', function() { |
| 39 | + iit('should check ng-style', function() { |
34 | 40 | expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');
|
35 |
| - element(by.css('input[value=set]')).click(); |
| 41 | + element(by.css('input[value=\'set color\']')).click(); |
36 | 42 | expect(colorSpan.getCssValue('color')).toBe('rgba(255, 0, 0, 1)');
|
37 | 43 | element(by.css('input[value=clear]')).click();
|
38 | 44 | expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');
|
|
0 commit comments