@@ -101,7 +101,7 @@ To migrate the code follow the examples below:
101
101
102
102
BEFORE:
103
103
104
- ```
104
+ ```js
105
105
/* 1 */
106
106
elem.data('my-key', 2);
107
107
elem.data('myKey', 3);
@@ -119,7 +119,7 @@ elem.data('foo-bar'); // 1
119
119
120
120
AFTER:
121
121
122
- ```
122
+ ```js
123
123
/* 1 */
124
124
// Rename one of the keys as they would now map to the same data slot.
125
125
elem.data('my-key', 2);
@@ -152,7 +152,7 @@ Before:
152
152
153
153
HTML:
154
154
155
- ```
155
+ ```html
156
156
// All five versions used to be equivalent.
157
157
<div ng-style={background_color: 'blue'}></div>
158
158
<div ng-style={'background:color': 'blue'}></div>
@@ -163,7 +163,7 @@ HTML:
163
163
164
164
JS:
165
165
166
- ```
166
+ ```js
167
167
// All five versions used to be equivalent.
168
168
elem.css('background_color', 'blue');
169
169
elem.css('background:color', 'blue');
@@ -183,15 +183,15 @@ After:
183
183
184
184
HTML:
185
185
186
- ```
186
+ ```html
187
187
// Previous five versions are no longer equivalent but these two still are.
188
188
<div ng-style={'background-color': 'blue'}></div>
189
189
<div ng-style={backgroundColor: 'blue'}></div>
190
190
```
191
191
192
192
JS:
193
193
194
- ```
194
+ ```js
195
195
// Previous five versions are no longer equivalent but these two still are.
196
196
elem.css('background-color', 'blue');
197
197
elem.css('backgroundColor', 'blue');
@@ -212,19 +212,19 @@ To migrate the code follow the example below:
212
212
213
213
Before:
214
214
215
- ```
215
+ ```js
216
216
elem.attr(booleanAttrName, '');
217
217
```
218
218
219
219
After:
220
220
221
- ```
221
+ ```js
222
222
elem.attr(booleanAttrName, false);
223
223
```
224
224
225
225
or:
226
226
227
- ```
227
+ ```js
228
228
elem.attr(booleanAttrName, null);
229
229
```
230
230
@@ -238,13 +238,13 @@ To migrate the code follow the example below:
238
238
239
239
Before:
240
240
241
- ```
241
+ ```js
242
242
elem.attr(attributeName, null);
243
243
```
244
244
245
245
After:
246
246
247
- ```
247
+ ```js
248
248
elem.attr(attributeName, "null");
249
249
```
250
250
@@ -260,7 +260,7 @@ Before:
260
260
261
261
HTML:
262
262
263
- ```
263
+ ```html
264
264
<select multiple>
265
265
<option>value 1</option>
266
266
<option>value 2</option>
@@ -269,7 +269,7 @@ HTML:
269
269
270
270
JavaScript:
271
271
272
- ```
272
+ ```js
273
273
var value = $element.val();
274
274
if (value) {
275
275
/* do something */
@@ -280,7 +280,7 @@ After:
280
280
281
281
HTML:
282
282
283
- ```
283
+ ```html
284
284
<select multiple>
285
285
<option>value 1</option>
286
286
<option>value 2</option>
@@ -289,7 +289,7 @@ HTML:
289
289
290
290
JavaScript:
291
291
292
- ```
292
+ ```js
293
293
var value = $element.val();
294
294
if (value.length > 0) {
295
295
/* do something */
@@ -326,12 +326,14 @@ NgModelController and FormController methods without context.
326
326
327
327
For example
328
328
329
- `$scope.$watch('something', myNgModelCtrl.$render)`
329
+ ```js
330
+ $scope.$watch('something', myNgModelCtrl.$render)
331
+ ```
330
332
331
333
will no longer work because the `$render` method is passed without any context.
332
334
This must now be replaced with
333
335
334
- ```
336
+ ```js
335
337
$scope.$watch('something', function() {
336
338
myNgModelCtrl.$render();
337
339
})
@@ -490,14 +492,14 @@ the `$http.defaults.jsonpCallbackParam` property, which is `"callback"` by defau
490
492
491
493
Before this change:
492
494
493
- ```
495
+ ```js
494
496
$http.json('trusted/url?callback=JSON_CALLBACK');
495
497
$http.json('other/trusted/url', {params: {cb:'JSON_CALLBACK'}});
496
498
```
497
499
498
500
After this change:
499
501
500
- ```
502
+ ```js
501
503
$http.json('trusted/url');
502
504
$http.json('other/trusted/url', {jsonpCallbackParam:'cb'});
503
505
```
@@ -512,13 +514,13 @@ method.**
512
514
513
515
You configure this list in a module configuration block:
514
516
515
- ```
517
+ ```js
516
518
appModule.config(['$sceDelegateProvider', function($sceDelegateProvider) {
517
519
$sceDelegateProvider.resourceUrlWhiteList([
518
520
// Allow same origin resource loads.
519
521
'self',
520
522
// Allow JSONP calls that match this pattern
521
- 'https://some.dataserver.com/**.jsonp?**`
523
+ 'https://some.dataserver.com/**.jsonp?**'
522
524
]);
523
525
}]);
524
526
```
@@ -529,7 +531,7 @@ method**
529
531
You can pass a trusted object instead of a string as a URL to the `$http`
530
532
service:
531
533
532
- ```
534
+ ```js
533
535
var promise = $http.jsonp($sce.trustAsResourceUrl(url));
534
536
```
535
537
@@ -600,7 +602,7 @@ property in the `ngModelOptions` to prevent it from inheriting from the ancestor
600
602
601
603
For example if you had the following HTML:
602
604
603
- ```
605
+ ```html
604
606
<form ng-model-options="{updateOn: 'blur'}">
605
607
<input ng-model="...">
606
608
</form>
@@ -611,7 +613,7 @@ After this change the input will inherit the option to update on blur.
611
613
If you want the original behaviour then you will need to specify the option
612
614
on the input as well:
613
615
614
- ```
616
+ ```html
615
617
<form ng-model-options="{updateOn: 'blur'}">
616
618
<input ng-model="..." ng-model-options="{updateOn: 'default'}">
617
619
</form>
@@ -754,14 +756,14 @@ A common cases where stray white-space can cause problems is when
754
756
attribute values are compared, for example in an $observer:
755
757
756
758
Before:
757
- ```
759
+ ```js
758
760
$attrs.$observe('myAttr', function(newVal) {
759
761
if (newVal === 'false') ...
760
762
});
761
763
```
762
764
763
765
To migrate, the attribute value should be trimmed manually:
764
- ```
766
+ ```js
765
767
$attrs.$observe('myAttr', function(newVal) {
766
768
if (newVal.trim() === 'false') ...
767
769
});
@@ -1049,7 +1051,7 @@ a "!" prefix. For example, rather than `mydomain.com/#/a/b/c` will become
1049
1051
If you actually wanted to have no hash-prefix then you should configure
1050
1052
this by adding a configuration block to you application:
1051
1053
1052
- ```
1054
+ ```js
1053
1055
appModule.config(['$locationProvider', function($locationProvider) {
1054
1056
$locationProvider.hashPrefix('');
1055
1057
}]);
0 commit comments