Skip to content

Commit 5ef8b62

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 00b2403 + ec59be6 commit 5ef8b62

23 files changed

+157
-101
lines changed

CHANGELOG.md

-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
- **$rootScope:** prevent infinite $digest by checking if asyncQueue is empty when decrementing ttl
2121
([2cd09c9f](https://github.com/angular/angular.js/commit/2cd09c9f0e7766bcd191662841b7b1ffc3b6dc3f),
2222
[#2622](https://github.com/angular/angular.js/issues/2622))
23-
- **$route:** update current route upon $route instantiation
24-
([2b344dbd](https://github.com/angular/angular.js/commit/2b344dbd20777fb1283b3a5bcf35a6ae8d09469d),
25-
[#4957](https://github.com/angular/angular.js/issues/4957))
2623

2724

2825
## Features

docs/content/api/index.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
# AngularJS API Docs
66
Welcome to the AngularJS API docs page. These pages contain the AngularJS reference materials for version <strong ng-bind="version"></strong>.
77

8-
The documentation is organized into **modules** which contain various components of an AngularJS application.
9-
These components are directives, services, filters, providers, types, global APIs and testing mocks.
8+
The documentation is organized into **{@link guide/module modules}** which contain various components of an AngularJS application.
9+
These components are {@link guide/directive directives}, {@link guide/dev_guide.services services}, {@link guide/filter filters}, {@link guide/providers providers}, {@link guide/templates types}, global APIs and testing mocks.
1010

1111
<div class="alert alert-info">
1212
**Angular Namespaces `$` and `$$`**

docs/content/guide/controller.ngdoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ starts with capital letter and ends with "Ctrl" or "Controller".
168168
- Assigning a property to `$scope` creates or updates the model.
169169
- Controller methods can be created through direct assignment to scope (see the `chiliSpicy` method)
170170
- The Controller methods and properties are available in the template (for the `<div>` element and
171-
and its children).
171+
its children).
172172

173173
## Spicy Arguments Example
174174

docs/content/guide/dev_guide.services.managing_dependencies.ngdoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ of which depend on other services that are provided by the Angular framework:
5555

5656
function log() {
5757
if (messageQueue.length) {
58-
$log('batchLog messages: ', messageQueue);
58+
$log.log('batchLog messages: ', messageQueue);
5959
messageQueue = [];
6060
}
6161
}

docs/content/guide/directive.ngdoc

+6-5
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The following also **matches** `ngModel`:
5555

5656
Angular **normalizes** an element's tag and attribute name to determine which elements match which
5757
directives. We typically refer to directives by their case-sensitive
58-
{@link http://en.wikipedia.org/wiki/CamelCase camelCase} **normalized** name (e.g. `ngModel`).
58+
{@link http://en.wikipedia.org/wiki/CamelCase camelCase} **normalized** name (e.g. `ngModel`).
5959
However, since HTML is case-insensitive, we refer to directives in the DOM by lower-case
6060
forms, typically using {@link http://en.wikipedia.org/wiki/Letter_case#Computers dash-delimited}
6161
attributes on DOM elements (e.g. `ng-model`).
@@ -174,9 +174,9 @@ For example, we could fix the example above by instead writing:
174174

175175
## Creating Directives
176176

177-
First let's talk about the API for registering directives. Much like controllers, directives are
178-
registered on modules. To register a directive, you use the `module.directive` API.
179-
`module.directive` takes the
177+
First let's talk about the {@link api/ng.$compileProvider#methods_directive API for registering directives}. Much like
178+
controllers, directives are registered on modules. To register a directive, you use the
179+
`module.directive` API. `module.directive` takes the
180180
{@link guide/directive#creating-custom-directives_matching-directives normalized} directive name
181181
followed by a **factory function.** This factory function should return an object with the different
182182
options to tell `$compile` how the directive should behave when matched.
@@ -527,7 +527,8 @@ where:
527527

528528
* `scope` is an Angular scope object.
529529
* `element` is the jqLite-wrapped element that this directive matches.
530-
* `attrs` is an object with the normalized attribute names and their corresponding values.
530+
* `attrs` is a hash object with key-value pairs of normalized attribute names and their
531+
corresponding attribute values.
531532

532533
In our `link` function, we want to update the displayed time once a second, or whenever a user
533534
changes the time formatting string that our directive binds to. We will use the `$interval` service

docs/content/misc/contribute.ngdoc

+10
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ grunt package
8787
Administrator). This is because `grunt package` creates some symbolic links.
8888
</div>
8989

90+
<div class="alert alert-warning">
91+
**Note:** If you're using Linux, and npm install fails with the message
92+
'Please try running this command again as root/Administrator.', you may need to globally install grunt and bower:
93+
<ul>
94+
<li>sudo npm install -g grunt-cli</li>
95+
<li>sudo npm install -g bower</li>
96+
</ul>
97+
98+
</div>
99+
90100
The build output can be located under the `build` directory. It consists of the following files and
91101
directories:
92102

docs/content/tutorial/step_00.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ angular-seed, and run the application in the browser.
7373
You can now see the page in your browser. It's not very exciting, but that's OK.
7474

7575
The HTML page that displays "Nothing here yet!" was constructed with the HTML code shown below.
76-
The code contains some key Angular elements that we will need going forward.
76+
The code contains some key Angular elements that we will need as we progress.
7777

7878
__`app/index.html`:__
7979
<pre>
@@ -104,7 +104,7 @@ __`app/index.html`:__
104104

105105
The `ng-app` attribute represents an Angular directive named `ngApp` (Angular uses
106106
`name-with-dashes` for its custom attributes and `camelCase` for the corresponding directives
107-
that implements them).
107+
which implement them).
108108
This directive is used to flag the html element that Angular should consider to be the root element
109109
of our application.
110110
This gives application developers the freedom to tell Angular if the entire html page or only a

docs/content/tutorial/step_02.ngdoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ To run the test, do the following:
217217

218218
* Create a new model property in the controller and bind to it from the template. For example:
219219

220-
$scope.name = "World"
220+
$scope.name = "World";
221221

222222
Then add a new binding to `index.html`:
223223

docs/content/tutorial/step_12.ngdoc

+50-37
Original file line numberDiff line numberDiff line change
@@ -340,45 +340,58 @@ Although we could do that, let's take the opportunity to learn how to create Jav
340340

341341
__`app/js/animations.js`.__
342342
<pre>
343-
angular.module('phonecatAnimations', ['ngAnimate'])
344-
345-
.animation('.phone', function() {
346-
return {
347-
addClass : function(element, className, done) {
348-
if(className != 'active') {
349-
return;
350-
}
351-
element.css({
352-
position: 'absolute',
353-
top: 500,
354-
left: 0,
355-
display: 'block'
356-
});
357-
jQuery(element).animate({
358-
top: 0
359-
}, done);
360-
361-
return function(cancel) {
362-
if(cancel) element.stop();
363-
};
364-
},
365-
removeClass : function(element, className, done) {
366-
if(className != 'active') return;
367-
element.css({
368-
position: 'absolute',
369-
left: 0,
370-
top: 0
371-
});
372-
jQuery(element).animate({
373-
top: -500
374-
}, done);
375-
376-
return function(cancel) {
377-
if(cancel) element.stop();
378-
};
343+
var phonecatAnimations = angular.module('phonecatAnimations', ['ngAnimate']);
344+
345+
phonecatAnimations.animation('.phone', function() {
346+
347+
var animateUp = function(element, className, done) {
348+
if(className != 'active') {
349+
return;
350+
}
351+
element.css({
352+
position: 'absolute',
353+
top: 500,
354+
left: 0,
355+
display: 'block'
356+
});
357+
358+
jQuery(element).animate({
359+
top: 0
360+
}, done);
361+
362+
return function(cancel) {
363+
if(cancel) {
364+
element.stop();
379365
}
380366
};
381-
});
367+
}
368+
369+
var animateDown = function(element, className, done) {
370+
if(className != 'active') {
371+
return;
372+
}
373+
element.css({
374+
position: 'absolute',
375+
left: 0,
376+
top: 0
377+
});
378+
379+
jQuery(element).animate({
380+
top: -500
381+
}, done);
382+
383+
return function(cancel) {
384+
if(cancel) {
385+
element.stop();
386+
}
387+
};
388+
}
389+
390+
return {
391+
addClass: animateUp,
392+
removeClass: animateDown
393+
};
394+
});
382395
</pre>
383396

384397
Note that we're using {@link http://jquery.com/ jQuery} to implement the animation. jQuery

docs/src/templates/css/docs.css

+4
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ ul.events > li > h3 {
246246
text-decoration: none;
247247
}
248248

249+
.tutorial-nav li {
250+
margin-right: 5px;
251+
}
252+
249253
.clear {
250254
clear: both;
251255
}

src/auto/injector.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,9 @@ function annotate(fn) {
354354
* @param {(Object|function())} provider If the provider is:
355355
*
356356
* - `Object`: then it should have a `$get` method. The `$get` method will be invoked using
357-
* {@link AUTO.$injector#invoke $injector.invoke()} when an instance needs to be
358-
* created.
359-
* - `Constructor`: a new instance of the provider will be created using
360-
* {@link AUTO.$injector#instantiate $injector.instantiate()}, then treated as
361-
* `object`.
357+
* {@link AUTO.$injector#invoke $injector.invoke()} when an instance needs to be created.
358+
* - `Constructor`: a new instance of the provider will be created using
359+
* {@link AUTO.$injector#instantiate $injector.instantiate()}, then treated as `object`.
362360
*
363361
* @returns {Object} registered provider instance
364362

src/ng/directive/input.js

+16-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010

1111
var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
12-
var EMAIL_REGEXP = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}$/;
12+
var EMAIL_REGEXP = /^[a-z0-9!#$%&'*+/=?^_`{|}~.-]+@[a-z0-9-]+(\.[a-z0-9-]+)*$/i;
1313
var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/;
1414

1515
var inputType = {
@@ -309,28 +309,35 @@ var inputType = {
309309
* @param {string=} name Property name of the form under which the control is published.
310310
* @param {string=} ngChange Angular expression to be executed when input changes due to user
311311
* interaction with the input element.
312+
* @param {string} ngValue Angular expression which sets the value to which the expression should
313+
* be set when selected.
312314
*
313315
* @example
314316
<doc:example>
315317
<doc:source>
316318
<script>
317319
function Ctrl($scope) {
318320
$scope.color = 'blue';
321+
$scope.specialValue = {
322+
"id": "12345",
323+
"value": "green"
324+
};
319325
}
320326
</script>
321327
<form name="myForm" ng-controller="Ctrl">
322328
<input type="radio" ng-model="color" value="red"> Red <br/>
323-
<input type="radio" ng-model="color" value="green"> Green <br/>
329+
<input type="radio" ng-model="color" ng-value="specialValue"> Green <br/>
324330
<input type="radio" ng-model="color" value="blue"> Blue <br/>
325-
<tt>color = {{color}}</tt><br/>
331+
<tt>color = {{color | json}}</tt><br/>
326332
</form>
333+
Note that `ng-value="specialValue"` sets radio item's value to be the value of `$scope.specialValue`.
327334
</doc:source>
328335
<doc:scenario>
329336
it('should change state', function() {
330-
expect(binding('color')).toEqual('blue');
337+
expect(binding('color')).toEqual('"blue"');
331338
332339
input('color').select('red');
333-
expect(binding('color')).toEqual('red');
340+
expect(binding('color')).toEqual('"red"');
334341
});
335342
</doc:scenario>
336343
</doc:example>
@@ -1188,7 +1195,10 @@ var ngModelDirective = function() {
11881195
* @name ng.directive:ngChange
11891196
*
11901197
* @description
1191-
* Evaluate given expression when user changes the input.
1198+
* Evaluate the given expression when the user changes the input.
1199+
* The expression is evaluated immediately, unlike the JavaScript onchange event
1200+
* which only triggers at the end of a change (usually, when the user leaves the
1201+
* form element or presses the return key).
11921202
* The expression is not evaluated when the value change is coming from the model.
11931203
*
11941204
* Note, this directive requires `ngModel` to be present.

0 commit comments

Comments
 (0)