Skip to content

Commit ee5c2c3

Browse files
Merge pull request #94 from angular/master
Update upstream
2 parents 005b40a + ad0ba99 commit ee5c2c3

File tree

5 files changed

+750
-79
lines changed

5 files changed

+750
-79
lines changed

CHANGELOG.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,59 @@
1+
<a name="1.7.1"></a>
2+
# 1.7.1 momentum-defiance (2018-06-08)
3+
4+
5+
## Bug Fixes
6+
- **$compile:** support transcluding multi-element directives
7+
([789db8](https://github.com/angular/angular.js/commit/789db83a8ae0e2db5db13289b2c29e56093d967a),
8+
[#15554](https://github.com/angular/angular.js/issues/15554),
9+
[#15555](https://github.com/angular/angular.js/issues/15555))
10+
- **ngModel:** do not throw if view value changes on destroyed scope
11+
([2b6c98](https://github.com/angular/angular.js/commit/2b6c9867369fd3ef1ddb687af1153478ab62ee1b),
12+
[#16583](https://github.com/angular/angular.js/issues/16583),
13+
[#16585](https://github.com/angular/angular.js/issues/16585))
14+
15+
16+
## New Features
17+
- **$compile:** add one-way collection bindings
18+
([f9d1ca](https://github.com/angular/angular.js/commit/f9d1ca20c38f065f15769fbe23aee5314cb58bd4),
19+
[#14039](https://github.com/angular/angular.js/issues/14039),
20+
[#16553](https://github.com/angular/angular.js/issues/16553),
21+
[#15874](https://github.com/angular/angular.js/issues/15874))
22+
- **ngRef:** add directive to publish controller, or element into scope
23+
([bf841d](https://github.com/angular/angular.js/commit/bf841d35120bf3c4655fde46af4105c85a0f1cdc),
24+
[#16511](https://github.com/angular/angular.js/issues/16511))
25+
- **errorHandlingConfig:** add option to exclude error params from url
26+
([3d6c45](https://github.com/angular/angular.js/commit/3d6c45d76e30b1b3c4eb9672cf4a93e5251c06b3),
27+
[#14744](https://github.com/angular/angular.js/issues/14744),
28+
[#15707](https://github.com/angular/angular.js/issues/15707),
29+
[#16283](https://github.com/angular/angular.js/issues/16283),
30+
[#16299](https://github.com/angular/angular.js/issues/16299),
31+
[#16591](https://github.com/angular/angular.js/issues/16591))
32+
- **ngAria:** add support for ignoring a specific element
33+
([7d9d38](https://github.com/angular/angular.js/commit/7d9d387195292cb5e04984602b752d31853cfea6),
34+
[#14602](https://github.com/angular/angular.js/issues/14602),
35+
[#14672](https://github.com/angular/angular.js/issues/14672),
36+
[#14833](https://github.com/angular/angular.js/issues/14833))
37+
- **ngCookies:** support samesite option
38+
([10a229](https://github.com/angular/angular.js/commit/10a229ce1befdeaf6295d1635dc11391c252a91a),
39+
[#16543](https://github.com/angular/angular.js/issues/16543),
40+
[#16544](https://github.com/angular/angular.js/issues/16544))
41+
- **ngMessages:** add support for default message
42+
([a8c263](https://github.com/angular/angular.js/commit/a8c263c1947cc85ee60b4732f7e4bcdc7ba463e8),
43+
[#12008](https://github.com/angular/angular.js/issues/12008),
44+
[#12213](https://github.com/angular/angular.js/issues/12213),
45+
[#16587](https://github.com/angular/angular.js/issues/16587))
46+
- **ngMock, ngMockE2E:** add option to match latest definition for `$httpBackend` request
47+
([773f39](https://github.com/angular/angular.js/commit/773f39c9345479f5f8b6321236ce6ad96f77aa92),
48+
[#16251](https://github.com/angular/angular.js/issues/16251),
49+
[#11637](https://github.com/angular/angular.js/issues/11637),
50+
[#16560](https://github.com/angular/angular.js/issues/16560))
51+
- **$route:** add support for the `reloadOnUrl` configuration option
52+
([f4f571](https://github.com/angular/angular.js/commit/f4f571efdf86d6acbcd5c6b1de66b4b33a259125),
53+
[#7925](https://github.com/angular/angular.js/issues/7925),
54+
[#15002](https://github.com/angular/angular.js/issues/15002))
55+
56+
157
<a name="1.7.0"></a>
258
# 1.7.0 nonexistent-physiology (2018-05-11)
359

src/ngAria/aria.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
*
1515
* For ngAria to do its magic, simply include the module `ngAria` as a dependency. The following
1616
* directives are supported:
17-
* `ngModel`, `ngChecked`, `ngReadonly`, `ngRequired`, `ngValue`, `ngDisabled`, `ngShow`, `ngHide`, `ngClick`,
18-
* `ngDblClick`, and `ngMessages`.
17+
* `ngModel`, `ngChecked`, `ngReadonly`, `ngRequired`, `ngValue`, `ngDisabled`, `ngShow`, `ngHide`,
18+
* `ngClick`, `ngDblClick`, and `ngMessages`.
1919
*
2020
* Below is a more detailed breakdown of the attributes handled by ngAria:
2121
*
@@ -46,11 +46,17 @@
4646
* <md-checkbox ng-disabled="disabled" aria-disabled="true">
4747
* ```
4848
*
49-
* ## Disabling Attributes
50-
* It's possible to disable individual attributes added by ngAria with the
49+
* ## Disabling Specific Attributes
50+
* It is possible to disable individual attributes added by ngAria with the
5151
* {@link ngAria.$ariaProvider#config config} method. For more details, see the
5252
* {@link guide/accessibility Developer Guide}.
53+
*
54+
* ## Disabling `ngAria` on Specific Elements
55+
* It is possible to make `ngAria` ignore a specific element, by adding the `ng-aria-disable`
56+
* attribute on it. Note that only the element itself (and not its child elements) will be ignored.
5357
*/
58+
var ARIA_DISABLE_ATTR = 'ngAriaDisable';
59+
5460
var ngAriaModule = angular.module('ngAria', ['ng']).
5561
info({ angularVersion: '"NG_VERSION_FULL"' }).
5662
provider('$aria', $AriaProvider);
@@ -132,6 +138,8 @@ function $AriaProvider() {
132138

133139
function watchExpr(attrName, ariaAttr, nodeBlackList, negate) {
134140
return function(scope, elem, attr) {
141+
if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return;
142+
135143
var ariaCamelName = attr.$normalize(ariaAttr);
136144
if (config[ariaCamelName] && !isNodeOneOf(elem, nodeBlackList) && !attr[ariaCamelName]) {
137145
scope.$watch(attr[attrName], function(boolVal) {
@@ -251,6 +259,8 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
251259
require: 'ngModel',
252260
priority: 200, //Make sure watches are fired after any other directives that affect the ngModel value
253261
compile: function(elem, attr) {
262+
if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return;
263+
254264
var shape = getShape(attr, elem);
255265

256266
return {
@@ -347,6 +357,8 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
347357
restrict: 'A',
348358
require: '?ngMessages',
349359
link: function(scope, elem, attr, ngMessages) {
360+
if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return;
361+
350362
if (!elem.attr('aria-live')) {
351363
elem.attr('aria-live', 'assertive');
352364
}
@@ -357,6 +369,8 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
357369
return {
358370
restrict: 'A',
359371
compile: function(elem, attr) {
372+
if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return;
373+
360374
var fn = $parse(attr.ngClick);
361375
return function(scope, elem, attr) {
362376

@@ -389,6 +403,8 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
389403
}])
390404
.directive('ngDblclick', ['$aria', function($aria) {
391405
return function(scope, elem, attr) {
406+
if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return;
407+
392408
if ($aria.config('tabindex') && !elem.attr('tabindex') && !isNodeOneOf(elem, nodeBlackList)) {
393409
elem.attr('tabindex', 0);
394410
}

src/ngRoute/route.js

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,22 @@ function $RouteProvider() {
183183
* `redirectTo` takes precedence over `resolveRedirectTo`, so specifying both on the same
184184
* route definition, will cause the latter to be ignored.
185185
*
186+
* - `[reloadOnUrl=true]` - `{boolean=}` - reload route when any part of the URL changes
187+
* (inluding the path) even if the new URL maps to the same route.
188+
*
189+
* If the option is set to `false` and the URL in the browser changes, but the new URL maps
190+
* to the same route, then a `$routeUpdate` event is broadcasted on the root scope (without
191+
* reloading the route).
192+
*
186193
* - `[reloadOnSearch=true]` - `{boolean=}` - reload route when only `$location.search()`
187194
* or `$location.hash()` changes.
188195
*
189-
* If the option is set to `false` and url in the browser changes, then
190-
* `$routeUpdate` event is broadcasted on the root scope.
196+
* If the option is set to `false` and the URL in the browser changes, then a `$routeUpdate`
197+
* event is broadcasted on the root scope (without reloading the route).
198+
*
199+
* <div class="alert alert-warning">
200+
* **Note:** This option has no effect if `reloadOnUrl` is set to `false`.
201+
* </div>
191202
*
192203
* - `[caseInsensitiveMatch=false]` - `{boolean=}` - match routes without being case sensitive
193204
*
@@ -202,6 +213,9 @@ function $RouteProvider() {
202213
this.when = function(path, route) {
203214
//copy original route object to preserve params inherited from proto chain
204215
var routeCopy = shallowCopy(route);
216+
if (angular.isUndefined(routeCopy.reloadOnUrl)) {
217+
routeCopy.reloadOnUrl = true;
218+
}
205219
if (angular.isUndefined(routeCopy.reloadOnSearch)) {
206220
routeCopy.reloadOnSearch = true;
207221
}
@@ -544,8 +558,9 @@ function $RouteProvider() {
544558
* @name $route#$routeUpdate
545559
* @eventType broadcast on root scope
546560
* @description
547-
* The `reloadOnSearch` property has been set to false, and we are reusing the same
548-
* instance of the Controller.
561+
* Broadcasted if the same instance of a route (including template, controller instance,
562+
* resolved dependencies, etc.) is being reused. This can happen if either `reloadOnSearch` or
563+
* `reloadOnUrl` has been set to `false`.
549564
*
550565
* @param {Object} angularEvent Synthetic event object
551566
* @param {Route} current Current/previous route information.
@@ -653,9 +668,7 @@ function $RouteProvider() {
653668
var lastRoute = $route.current;
654669

655670
preparedRoute = parseRoute();
656-
preparedRouteIsUpdateOnly = preparedRoute && lastRoute && preparedRoute.$$route === lastRoute.$$route
657-
&& angular.equals(preparedRoute.pathParams, lastRoute.pathParams)
658-
&& !preparedRoute.reloadOnSearch && !forceReload;
671+
preparedRouteIsUpdateOnly = isNavigationUpdateOnly(preparedRoute, lastRoute);
659672

660673
if (!preparedRouteIsUpdateOnly && (lastRoute || preparedRoute)) {
661674
if ($rootScope.$broadcast('$routeChangeStart', preparedRoute, lastRoute).defaultPrevented) {
@@ -835,6 +848,29 @@ function $RouteProvider() {
835848
return match || routes[null] && inherit(routes[null], {params: {}, pathParams:{}});
836849
}
837850

851+
/**
852+
* @param {Object} newRoute - The new route configuration (as returned by `parseRoute()`).
853+
* @param {Object} oldRoute - The previous route configuration (as returned by `parseRoute()`).
854+
* @returns {boolean} Whether this is an "update-only" navigation, i.e. the URL maps to the same
855+
* route and it can be reused (based on the config and the type of change).
856+
*/
857+
function isNavigationUpdateOnly(newRoute, oldRoute) {
858+
// IF this is not a forced reload
859+
return !forceReload
860+
// AND both `newRoute`/`oldRoute` are defined
861+
&& newRoute && oldRoute
862+
// AND they map to the same Route Definition Object
863+
&& (newRoute.$$route === oldRoute.$$route)
864+
// AND `reloadOnUrl` is disabled
865+
&& (!newRoute.reloadOnUrl
866+
// OR `reloadOnSearch` is disabled
867+
|| (!newRoute.reloadOnSearch
868+
// AND both routes have the same path params
869+
&& angular.equals(newRoute.pathParams, oldRoute.pathParams)
870+
)
871+
);
872+
}
873+
838874
/**
839875
* @returns {string} interpolation of the redirect path with the parameters
840876
*/

0 commit comments

Comments
 (0)