Skip to content

Commit 005b40a

Browse files
Merge pull request #93 from angular/master
Update upstreamUpdate upstream
2 parents 7895e7d + 84d80be commit 005b40a

File tree

12 files changed

+1206
-67
lines changed

12 files changed

+1206
-67
lines changed

angularFiles.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ var angularFiles = {
7474
'src/ng/directive/ngNonBindable.js',
7575
'src/ng/directive/ngOptions.js',
7676
'src/ng/directive/ngPluralize.js',
77+
'src/ng/directive/ngRef.js',
7778
'src/ng/directive/ngRepeat.js',
7879
'src/ng/directive/ngShowHide.js',
7980
'src/ng/directive/ngStyle.js',

docs/content/error/ngRef/noctrl.ngdoc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@ngdoc error
2+
@name ngRef:noctrl
3+
@fullName A controller for the value of `ngRefRead` could not be found on the element.
4+
@description
5+
6+
This error occurs when the {@link ng.ngRef ngRef directive} specifies
7+
a value in `ngRefRead` that cannot be resolved to a directive / component controller.
8+
9+
Causes for this error can be:
10+
11+
1. Your `ngRefRead` value has a typo.
12+
2. You have a typo in the *registered* directive / component name.
13+
3. The directive / component does not have a controller.
14+
15+
Note that `ngRefRead` takes the name of the component / directive, not the name of controller, and
16+
also not the combination of directive and 'Controller'. For example, for a directive called 'myDirective',
17+
the correct declaration is `<div ng-ref="$ctrl.ref" ng-ref-read="myDirective">`.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@ngdoc error
2+
@name ngRef:nonassign
3+
@fullName Non-Assignable Expression
4+
@description
5+
6+
This error occurs when ngRef defines an expression that is not-assignable.
7+
8+
In order for ngRef to work, it must be possible to write the reference into the path defined with the expression.
9+
10+
For example, the following expressions are non-assignable:
11+
12+
```
13+
<my-directive ng-ref="{}"></my-directive>
14+
15+
<my-directive ng-ref="myFn()"></my-directive>
16+
17+
<!-- missing attribute value is also invalid -->
18+
<my-directive ng-ref></my-directive>
19+
20+
```
21+
22+
To resolve this error, use a path expression that is assignable:
23+
24+
```
25+
<my-directive ng-ref="$ctrl.reference"></my-directive>
26+
27+
```

src/AngularPublic.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
ngInitDirective,
2929
ngNonBindableDirective,
3030
ngPluralizeDirective,
31+
ngRefDirective,
3132
ngRepeatDirective,
3233
ngShowDirective,
3334
ngStyleDirective,
@@ -194,6 +195,7 @@ function publishExternalAPI(angular) {
194195
ngInit: ngInitDirective,
195196
ngNonBindable: ngNonBindableDirective,
196197
ngPluralize: ngPluralizeDirective,
198+
ngRef: ngRefDirective,
197199
ngRepeat: ngRepeatDirective,
198200
ngShow: ngShowDirective,
199201
ngStyle: ngStyleDirective,

src/minErr.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
*/
88

99
var minErrConfig = {
10-
objectMaxDepth: 5
10+
objectMaxDepth: 5,
11+
urlErrorParamsEnabled: true
1112
};
1213

1314
/**
@@ -30,12 +31,21 @@ var minErrConfig = {
3031
* * `objectMaxDepth` **{Number}** - The max depth for stringifying objects. Setting to a
3132
* non-positive or non-numeric value, removes the max depth limit.
3233
* Default: 5
34+
*
35+
* * `urlErrorParamsEnabled` **{Boolean}** - Specifies wether the generated error url will
36+
* contain the parameters of the thrown error. Disabling the parameters can be useful if the
37+
* generated error url is very long.
38+
*
39+
* Default: true. When used without argument, it returns the current value.
3340
*/
3441
function errorHandlingConfig(config) {
3542
if (isObject(config)) {
3643
if (isDefined(config.objectMaxDepth)) {
3744
minErrConfig.objectMaxDepth = isValidObjectMaxDepth(config.objectMaxDepth) ? config.objectMaxDepth : NaN;
3845
}
46+
if (isDefined(config.urlErrorParamsEnabled) && isBoolean(config.urlErrorParamsEnabled)) {
47+
minErrConfig.urlErrorParamsEnabled = config.urlErrorParamsEnabled;
48+
}
3949
} else {
4050
return minErrConfig;
4151
}
@@ -50,6 +60,7 @@ function isValidObjectMaxDepth(maxDepth) {
5060
return isNumber(maxDepth) && maxDepth > 0;
5161
}
5262

63+
5364
/**
5465
* @description
5566
*
@@ -113,8 +124,10 @@ function minErr(module, ErrorConstructor) {
113124

114125
message += '\n' + url + (module ? module + '/' : '') + code;
115126

116-
for (i = 0, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
117-
message += paramPrefix + 'p' + i + '=' + encodeURIComponent(templateArgs[i]);
127+
if (minErrConfig.urlErrorParamsEnabled) {
128+
for (i = 0, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
129+
message += paramPrefix + 'p' + i + '=' + encodeURIComponent(templateArgs[i]);
130+
}
118131
}
119132

120133
return new ErrorConstructor(message);

0 commit comments

Comments
 (0)