Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d257c4564d | |||
| 1b1684c2b2 | |||
| 726f49dcf6 | |||
| 8a187f16c3 | |||
| d97e6f1695 | |||
| 26e893a2fa | |||
| 5edd25364f | |||
| 019dded64b | |||
| 0007be1ca2 | |||
| 863528f299 | |||
| 97aff90a2c | |||
| dd26545870 | |||
| a4c7bdccd7 | |||
| edb3e22c01 | |||
| 7446836e56 | |||
| 3f79662d61 | |||
| e4830b9fd2 | |||
| 5ad4f5562c | |||
| 43bb414e23 | |||
| 64c7c53190 | |||
| 5075c870fd | |||
| b9edb415b2 | |||
| 7ca6543244 | |||
| e58b4ceed8 | |||
| c97237bcb8 |
@@ -1,3 +1,7 @@
|
||||
# AngularJS is in LTS mode
|
||||
We are no longer accepting changes that are not critical bug fixes into this project.
|
||||
See https://blog.angular.io/stable-angularjs-and-long-term-support-7e077635ee9c for more detail.
|
||||
|
||||
<!--
|
||||
IF YOU DON'T FILL OUT THE FOLLOWING INFORMATION WE MIGHT CLOSE YOUR ISSUE WITHOUT INVESTIGATION
|
||||
-->
|
||||
@@ -9,8 +13,9 @@ IF YOU DON'T FILL OUT THE FOLLOWING INFORMATION WE MIGHT CLOSE YOUR ISSUE WITHOU
|
||||
|
||||
**I'm submitting a ...**
|
||||
<!-- (check one with "x") -->
|
||||
- [ ] bug report
|
||||
- [ ] feature request
|
||||
- [ ] regression from 1.7.0
|
||||
- [ ] security issue
|
||||
- [ ] issue caused by a new browser version
|
||||
- [ ] other <!--(Please do not submit support requests here - see above)-->
|
||||
|
||||
**Current behavior:**
|
||||
@@ -26,7 +31,7 @@ please provide the *STEPS TO REPRODUCE* and if possible a *MINIMAL DEMO* of the
|
||||
https://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:yBpEi4).
|
||||
-->
|
||||
|
||||
**AngularJS version:** 1.x.y
|
||||
**AngularJS version:** 1.7.x
|
||||
<!-- Check whether this is still an issue in the most recent stable or in the snapshot AngularJS
|
||||
version (https://code.angularjs.org/snapshot/) -->
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<!-- General PR submission guidelines https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#submit-pr -->
|
||||
**What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)**
|
||||
# AngularJS is in LTS mode
|
||||
We are no longer accepting changes that are not critical bug fixes into this project.
|
||||
See https://blog.angular.io/stable-angularjs-and-long-term-support-7e077635ee9c for more detail.
|
||||
|
||||
<!-- General PR submission guidelines https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#submit-pr -->
|
||||
**Does this PR fix a regression since 1.7.0, a security flaw, or a problem caused by a new browser version?**
|
||||
|
||||
<!-- If the answer is no, then we will not merge this PR -->
|
||||
|
||||
|
||||
**What is the current behavior? (You can also link to an open issue here)**
|
||||
|
||||
@@ -1,3 +1,36 @@
|
||||
<a name="1.7.9"></a>
|
||||
# 1.7.9 pollution-eradication (2019-11-19)
|
||||
|
||||
## Bug Fixes
|
||||
- **angular.merge:** do not merge __proto__ property
|
||||
([726f49](https://github.com/angular/angular.js/commit/726f49dcf6c23106ddaf5cfd5e2e592841db743a))
|
||||
- **ngStyle:** correctly remove old style when new style value is invalid
|
||||
([5edd25](https://github.com/angular/angular.js/commit/5edd25364f617083363dc2bd61f9230b38267578),
|
||||
[#16860](https://github.com/angular/angular.js/issues/16860),
|
||||
[#16868](https://github.com/angular/angular.js/issues/16868))
|
||||
|
||||
|
||||
<a name="1.7.8"></a>
|
||||
# 1.7.8 enthusiastic-oblation (2019-03-11)
|
||||
|
||||
|
||||
## Bug Fixes
|
||||
- **required:** correctly validate required on non-input element surrounded by ngIf
|
||||
([a4c7bd](https://github.com/angular/angular.js/commit/a4c7bdccd76c39c30e33f6215da9a00cc8acde2c),
|
||||
[#16830](https://github.com/angular/angular.js/issues/16830),
|
||||
[#16836](https://github.com/angular/angular.js/issues/16836))
|
||||
|
||||
|
||||
<a name="1.7.7"></a>
|
||||
# 1.7.7 kingly-exiting (2019-02-04)
|
||||
|
||||
## Bug Fixes
|
||||
- **ngRequired:** set error correctly when inside ngRepeat and false by default
|
||||
([5ad4f5](https://github.com/angular/angular.js/commit/5ad4f5562c37b1cb575e3e5fddd96e9dd10408e2),
|
||||
[#16814](https://github.com/angular/angular.js/issues/16814),
|
||||
[#16820](https://github.com/angular/angular.js/issues/16820))
|
||||
|
||||
|
||||
<a name="1.7.6"></a>
|
||||
# 1.7.6 gravity-manipulation (2019-01-17)
|
||||
|
||||
|
||||
@@ -257,7 +257,6 @@ If the commit reverts a previous commit, it should begin with `revert: `, follow
|
||||
of the reverted commit.
|
||||
In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit
|
||||
being reverted.
|
||||
A commit with this format is automatically created by the [`git revert`][git-revert] command.
|
||||
|
||||
### Type
|
||||
Must be one of the following:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2010-2018 Google, Inc. http://angularjs.org
|
||||
Copyright (c) 2010-2019 Google, Inc. http://angularjs.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
# AngularJS Release instructions
|
||||
|
||||
|
||||
## Compare the list of commits between stable and unstable
|
||||
|
||||
There is a script - compare-master-to-stable.js - that helps with this.
|
||||
We just want to make sure that good commits (low risk fixes + docs fixes) got cherry-picked into stable branch and nothing interesting got merged only into stable branch.
|
||||
|
||||
|
||||
## Pick a release name (for this version)
|
||||
|
||||
A super-heroic power (adverb-verb phrase).
|
||||
|
||||
|
||||
## Generate release notes
|
||||
|
||||
Example Commit: https://github.com/angular/angular.js/commit/7ab5098c14ee4f195dbfe2681e402fe2dfeacd78
|
||||
|
||||
1) Run
|
||||
|
||||
```bash
|
||||
node_modules/.bin/changez -o changes.md -v <new version> <base branch>
|
||||
```
|
||||
|
||||
2) Review the generated file and manually fix typos, group and reorder stuff if needed.
|
||||
3) Move the content into CHANGELOG.md add release code-names to headers.
|
||||
4) Push the changes to your private github repo and review.
|
||||
5) cherry-pick the release notes commit to the appropriate branches.
|
||||
|
||||
|
||||
## Pick a commit to release (for this version)
|
||||
|
||||
Usually this will be the commit containing the release notes, but it may also be in the past.
|
||||
|
||||
|
||||
## Run "release" script
|
||||
|
||||
```bash
|
||||
scripts/jenkins/release.sh --git-push-dryrun=false --commit-sha=8822a4f --version-number=1.7.6 --version-name=gravity-manipulation
|
||||
```
|
||||
|
||||
1) The SHA is of the commit to release (could be in the past).
|
||||
|
||||
2) The version number and code-name that should be released, not the next version number (e.g. to release 1.2.12 you enter 1.2.12 as release version and the code-name that was picked for 1.2.12, cauliflower-eradication).
|
||||
|
||||
3) You will need to have write access to all the AngularJS github dist repositories and publish rights for the AngularJS packages on npm.
|
||||
|
||||
|
||||
## Update GitHub milestones
|
||||
|
||||
1) Create the next milestone if it doesn't exist yet-giving ita due date.
|
||||
2) Move all open issues and PRs for the current milestone to the next milestone<br>
|
||||
You can do this by filtering the current milestone, selecting via checklist, and moving to the next milestone within the GH issues page.
|
||||
|
||||
3) Close the current milestone click the milestones tab and close from there.
|
||||
4) Create a new holding milestone for the release after next-but don't give it a due date otherwise that will mess up the dashboard.
|
||||
|
||||
|
||||
## Push build artifacts to CDN
|
||||
|
||||
Google CDNs are fed with data from google3 every day at 11:15am PT it takes only few minutes for the import to propagate).
|
||||
If we want to make our files available, we need submit our CLs before this time on the day of the release.
|
||||
|
||||
|
||||
## Don't update the package.json (branchVersion) until the CDN has updated
|
||||
|
||||
This is the version used to compute what version to link to in the CDN. If you update this too early then the CDN lookup fails and you end up with 'null, for the version, which breaks the docs.
|
||||
|
||||
|
||||
## Verify angularjs.org download modal has latest version (updates via Travis job)
|
||||
|
||||
The versions in the modal are updated (based on the versions available on CDN) as part of the Travis deploy stage: https://github.com/angular/angularjs.org/blob/a4d25c5abcd39e8ce19d31cb1c78073d13c4c974/.travis.yml#L26
|
||||
(You may need to explicitly trigger the Travis job. e.g. re-running the last job.)
|
||||
|
||||
|
||||
## Announce the release (via official Google accounts)
|
||||
|
||||
Double check that angularjs.org is up to date with the new release version before sharing.
|
||||
|
||||
1) Collect a list of contributors
|
||||
|
||||
use: `git log --format='%aN' v1.2.12..v1.2.13 | sort -u`
|
||||
|
||||
2) Write a blog post (for minor releases, not patch releases) and publish it with the "release" tag
|
||||
3) Post on twitter as yourself (tweet from your heart; there is no template for this), retweet as @AngularJS
|
||||
|
||||
|
||||
## Party!
|
||||
|
||||
|
||||
## Major Release Tasks
|
||||
|
||||
1) Update angularjs.org to use the latest branch.
|
||||
2) Write up a migration document.
|
||||
3) Create a new git branch for the version that has been released (e.g. 1.8.x).
|
||||
4) Check that the build and release scripts still work.
|
||||
5) Update the dist-tag of the old branch, see https://github.com/angular/angular.js/pull/12722.
|
||||
6) Write a blog post.
|
||||
@@ -279,15 +279,20 @@ construction and lookup of dependencies.
|
||||
|
||||
Here is an example of using the injector service:
|
||||
|
||||
First create an AngularJS module that will hold the service definition. (The empty array passed as
|
||||
the second parameter means that this module does not depend on any other modules.)
|
||||
|
||||
```js
|
||||
// Provide the wiring information in a module
|
||||
// Create a module to hold the service definition
|
||||
var myModule = angular.module('myModule', []);
|
||||
```
|
||||
|
||||
Teach the injector how to build a `greeter` service. Notice that `greeter` is dependent on the
|
||||
`$window` service. The `greeter` service is an object that contains a `greet` method.
|
||||
Teach the injector how to build a `greeter` service, which is just an object that contains a `greet`
|
||||
method. Notice that `greeter` is dependent on the `$window` service, which will be provided
|
||||
(injected into `greeter`) by the injector.
|
||||
|
||||
```js
|
||||
// Define the `greeter` service
|
||||
myModule.factory('greeter', function($window) {
|
||||
return {
|
||||
greet: function(text) {
|
||||
|
||||
@@ -577,7 +577,7 @@ orderByFilter(['a', undefined, 'o', null, 'z']);
|
||||
|
||||
|
||||
<a name="migrate1.6to1.7-ng-misc"></a>
|
||||
### Core: _Misceallenous_
|
||||
### Core: _Miscellaneous_
|
||||
|
||||
|
||||
#### **jqLite**
|
||||
|
||||
@@ -11,7 +11,7 @@ set -e
|
||||
# Curl and run this script as part of your .travis.yml before_script section:
|
||||
# before_script:
|
||||
# - curl https://gist.github.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash
|
||||
SC_VERSION="4.5.2"
|
||||
SC_VERSION="4.5.4"
|
||||
CONNECT_URL="https://saucelabs.com/downloads/sc-$SC_VERSION-linux.tar.gz"
|
||||
CONNECT_DIR="/tmp/sauce-connect-$RANDOM"
|
||||
CONNECT_DOWNLOAD="sc-$SC_VERSION-linux.tar.gz"
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@
|
||||
"jasmine-core": "^2.8.0",
|
||||
"jasmine-node": "^2.0.0",
|
||||
"jasmine-reporters": "^2.2.0",
|
||||
"jquery": "3.2.1",
|
||||
"jquery": "3.4.0",
|
||||
"jquery-2.1": "npm:jquery@2.1.4",
|
||||
"jquery-2.2": "npm:jquery@2.2.4",
|
||||
"karma": "^3.1.4",
|
||||
|
||||
@@ -27,7 +27,7 @@ function prepare {
|
||||
for repo in "${REPOS[@]}"
|
||||
do
|
||||
echo "-- Cloning bower-$repo"
|
||||
git clone git@github.com:angular/bower-$repo.git $TMP_DIR/bower-$repo --depth=1
|
||||
git clone https://github.com/angular/bower-$repo.git $TMP_DIR/bower-$repo --depth=1
|
||||
done
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ function init {
|
||||
function prepare {
|
||||
|
||||
echo "-- Cloning code.angularjs.org"
|
||||
git clone git@github.com:angular/code.angularjs.org.git $REPO_DIR --depth=1
|
||||
git clone https://github.com/angular/code.angularjs.org $REPO_DIR --depth=1
|
||||
|
||||
echo "-- Updating code.angularjs.org"
|
||||
|
||||
|
||||
@@ -11,11 +11,12 @@ export SAUCE_ACCESS_KEY
|
||||
BROWSER_STACK_ACCESS_KEY=$(echo "$BROWSER_STACK_ACCESS_KEY" | rev)
|
||||
SAUCE_ACCESS_KEY=$(echo "$SAUCE_ACCESS_KEY" | rev)
|
||||
|
||||
# The currently latest version of Safari on Saucelabs (v12) is unstable and disconnects frequently.
|
||||
# TODO: Add `SL_Safari` back, once/if it becomes more stable again.
|
||||
# The currently latest-1 version of desktop Safari on Saucelabs (v12.0) is unstable and disconnects
|
||||
# consistently. The latest version (v12.1) works fine.
|
||||
# TODO: Add `SL_Safari-1` back, once it no longer corresponds to v12.0.
|
||||
BROWSERS="SL_Chrome,SL_Chrome-1,\
|
||||
SL_Firefox,SL_Firefox-1,\
|
||||
SL_Safari-1,\
|
||||
SL_Safari,\
|
||||
SL_iOS,SL_iOS-1,\
|
||||
SL_IE_9,SL_IE_10,SL_IE_11,\
|
||||
SL_EDGE,SL_EDGE-1"
|
||||
|
||||
+30
-5
@@ -342,8 +342,10 @@ function baseExtend(dst, objs, deep) {
|
||||
} else if (isElement(src)) {
|
||||
dst[key] = src.clone();
|
||||
} else {
|
||||
if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};
|
||||
baseExtend(dst[key], [src], true);
|
||||
if (key !== '__proto__') {
|
||||
if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};
|
||||
baseExtend(dst[key], [src], true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dst[key] = src;
|
||||
@@ -396,8 +398,8 @@ function extend(dst) {
|
||||
* sinceVersion="1.6.5"
|
||||
* This function is deprecated, but will not be removed in the 1.x lifecycle.
|
||||
* There are edge cases (see {@link angular.merge#known-issues known issues}) that are not
|
||||
* supported by this function. We suggest
|
||||
* using [lodash's merge()](https://lodash.com/docs/4.17.4#merge) instead.
|
||||
* supported by this function. We suggest using another, similar library for all-purpose merging,
|
||||
* such as [lodash's merge()](https://lodash.com/docs/4.17.4#merge).
|
||||
*
|
||||
* @knownIssue
|
||||
* This is a list of (known) object types that are not handled correctly by this function:
|
||||
@@ -406,6 +408,8 @@ function extend(dst) {
|
||||
* - [`CanvasGradient`](https://developer.mozilla.org/docs/Web/API/CanvasGradient)
|
||||
* - AngularJS {@link $rootScope.Scope scopes};
|
||||
*
|
||||
* `angular.merge` also does not support merging objects with circular references.
|
||||
*
|
||||
* @param {Object} dst Destination object.
|
||||
* @param {...Object} src Source object(s).
|
||||
* @returns {Object} Reference to `dst`.
|
||||
@@ -783,7 +787,9 @@ function arrayRemove(array, value) {
|
||||
* @kind function
|
||||
*
|
||||
* @description
|
||||
* Creates a deep copy of `source`, which should be an object or an array.
|
||||
* Creates a deep copy of `source`, which should be an object or an array. This functions is used
|
||||
* internally, mostly in the change-detection code. It is not intended as an all-purpose copy
|
||||
* function, and has several limitations (see below).
|
||||
*
|
||||
* * If no destination is supplied, a copy of the object or array is created.
|
||||
* * If a destination is provided, all of its elements (for arrays) or properties (for objects)
|
||||
@@ -798,6 +804,25 @@ function arrayRemove(array, value) {
|
||||
* and on `destination`) will be ignored.
|
||||
* </div>
|
||||
*
|
||||
* <div class="alert alert-warning">
|
||||
* `angular.copy` does not check if destination and source are of the same type. It's the
|
||||
* developer's responsibility to make sure they are compatible.
|
||||
* </div>
|
||||
*
|
||||
* @knownIssue
|
||||
* This is a non-exhaustive list of object types / features that are not handled correctly by
|
||||
* `angular.copy`. Note that since this functions is used by the change detection code, this
|
||||
* means binding or watching objects of these types (or that include these types) might not work
|
||||
* correctly.
|
||||
* - [`File`](https://developer.mozilla.org/docs/Web/API/File)
|
||||
* - [`Map`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map)
|
||||
* - [`ImageData`](https://developer.mozilla.org/docs/Web/API/ImageData)
|
||||
* - [`MediaStream`](https://developer.mozilla.org/docs/Web/API/MediaStream)
|
||||
* - [`Set`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)
|
||||
* - [`WeakMap`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WeakMap)
|
||||
* - ['getter'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get)/
|
||||
* [`setter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set)`
|
||||
*
|
||||
* @param {*} source The source that will be used to make a copy. Can be any type, including
|
||||
* primitives, `null`, and `undefined`.
|
||||
* @param {(Object|Array)=} destination Destination into which the source is copied. If provided,
|
||||
|
||||
+33
-32
@@ -205,7 +205,7 @@
|
||||
*
|
||||
* This example show how you might use `$doCheck` to trigger changes in your component's inputs even if the
|
||||
* actual identity of the component doesn't change. (Be aware that cloning and deep equality checks on large
|
||||
* arrays or objects can have a negative impact on your application performance)
|
||||
* arrays or objects can have a negative impact on your application performance.)
|
||||
*
|
||||
* <example name="doCheckArrayExample" module="do-check-module">
|
||||
* <file name="index.html">
|
||||
@@ -528,7 +528,7 @@
|
||||
* would result in the whole app "stalling" until all templates are loaded asynchronously - even in the
|
||||
* case when only one deeply nested directive has `templateUrl`.
|
||||
*
|
||||
* Template loading is asynchronous even if the template has been preloaded into the {@link $templateCache}
|
||||
* Template loading is asynchronous even if the template has been preloaded into the {@link $templateCache}.
|
||||
*
|
||||
* You can specify `templateUrl` as a string representing the URL or as a function which takes two
|
||||
* arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns
|
||||
@@ -589,7 +589,7 @@
|
||||
* own templates or compile functions. Compiling these directives results in an infinite loop and
|
||||
* stack overflow errors.
|
||||
*
|
||||
* This can be avoided by manually using $compile in the postLink function to imperatively compile
|
||||
* This can be avoided by manually using `$compile` in the postLink function to imperatively compile
|
||||
* a directive's template instead of relying on automatic template compilation via `template` or
|
||||
* `templateUrl` declaration or manual compilation inside the compile function.
|
||||
* </div>
|
||||
@@ -693,17 +693,17 @@
|
||||
*
|
||||
* * `true` - transclude the content (i.e. the child nodes) of the directive's element.
|
||||
* * `'element'` - transclude the whole of the directive's element including any directives on this
|
||||
* element that defined at a lower priority than this directive. When used, the `template`
|
||||
* element that are defined at a lower priority than this directive. When used, the `template`
|
||||
* property is ignored.
|
||||
* * **`{...}` (an object hash):** - map elements of the content onto transclusion "slots" in the template.
|
||||
*
|
||||
* **Mult-slot transclusion** is declared by providing an object for the `transclude` property.
|
||||
* **Multi-slot transclusion** is declared by providing an object for the `transclude` property.
|
||||
*
|
||||
* This object is a map where the keys are the name of the slot to fill and the value is an element selector
|
||||
* used to match the HTML to the slot. The element selector should be in normalized form (e.g. `myElement`)
|
||||
* and will match the standard element variants (e.g. `my-element`, `my:element`, `data-my-element`, etc).
|
||||
*
|
||||
* For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}
|
||||
* For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}.
|
||||
*
|
||||
* If the element selector is prefixed with a `?` then that slot is optional.
|
||||
*
|
||||
@@ -728,7 +728,7 @@
|
||||
* </div>
|
||||
*
|
||||
* If you want to manually control the insertion and removal of the transcluded content in your directive
|
||||
* then you must use this transclude function. When you call a transclude function it returns a a jqLite/JQuery
|
||||
* then you must use this transclude function. When you call a transclude function it returns a jqLite/JQuery
|
||||
* object that contains the compiled DOM, which is linked to the correct transclusion scope.
|
||||
*
|
||||
* When you call a transclusion function you can pass in a **clone attach function**. This function accepts
|
||||
@@ -813,8 +813,8 @@
|
||||
* The {@link ng.$compile.directive.Attributes Attributes} object - passed as a parameter in the
|
||||
* `link()` or `compile()` functions. It has a variety of uses.
|
||||
*
|
||||
* * *Accessing normalized attribute names:* Directives like 'ngBind' can be expressed in many ways:
|
||||
* 'ng:bind', `data-ng-bind`, or 'x-ng-bind'. The attributes object allows for normalized access
|
||||
* * *Accessing normalized attribute names:* Directives like `ngBind` can be expressed in many ways:
|
||||
* `ng:bind`, `data-ng-bind`, or `x-ng-bind`. The attributes object allows for normalized access
|
||||
* to the attributes.
|
||||
*
|
||||
* * *Directive inter-communication:* All directives share the same instance of the attributes
|
||||
@@ -855,25 +855,24 @@
|
||||
<file name="index.html">
|
||||
<script>
|
||||
angular.module('compileExample', [], function($compileProvider) {
|
||||
// configure new 'compile' directive by passing a directive
|
||||
// factory function. The factory function injects the '$compile'
|
||||
// Configure new 'compile' directive by passing a directive
|
||||
// factory function. The factory function injects '$compile'.
|
||||
$compileProvider.directive('compile', function($compile) {
|
||||
// directive factory creates a link function
|
||||
// The directive factory creates a link function.
|
||||
return function(scope, element, attrs) {
|
||||
scope.$watch(
|
||||
function(scope) {
|
||||
// watch the 'compile' expression for changes
|
||||
// Watch the 'compile' expression for changes.
|
||||
return scope.$eval(attrs.compile);
|
||||
},
|
||||
function(value) {
|
||||
// when the 'compile' expression changes
|
||||
// assign it into the current DOM
|
||||
// When the 'compile' expression changes
|
||||
// assign it into the current DOM.
|
||||
element.html(value);
|
||||
|
||||
// compile the new DOM and link it to the current
|
||||
// scope.
|
||||
// NOTE: we only compile .childNodes so that
|
||||
// we don't get into infinite loop compiling ourselves
|
||||
// Compile the new DOM and link it to the current scope.
|
||||
// NOTE: we only compile '.childNodes' so that we
|
||||
// don't get into an infinite loop compiling ourselves.
|
||||
$compile(element.contents())(scope);
|
||||
}
|
||||
);
|
||||
@@ -946,13 +945,13 @@
|
||||
* }
|
||||
* ```
|
||||
* * `futureParentElement` - defines the parent to which the `cloneAttachFn` will add
|
||||
* the cloned elements; only needed for transcludes that are allowed to contain non html
|
||||
* elements (e.g. SVG elements). See also the directive.controller property.
|
||||
* the cloned elements; only needed for transcludes that are allowed to contain non HTML
|
||||
* elements (e.g. SVG elements). See also the `directive.controller` property.
|
||||
*
|
||||
* Calling the linking function returns the element of the template. It is either the original
|
||||
* element passed in, or the clone of the element if the `cloneAttachFn` is provided.
|
||||
*
|
||||
* After linking the view is not updated until after a call to $digest which typically is done by
|
||||
* After linking the view is not updated until after a call to `$digest`, which typically is done by
|
||||
* AngularJS automatically.
|
||||
*
|
||||
* If you need access to the bound view, there are two ways to do it:
|
||||
@@ -960,21 +959,23 @@
|
||||
* - If you are not asking the linking function to clone the template, create the DOM element(s)
|
||||
* before you send them to the compiler and keep this reference around.
|
||||
* ```js
|
||||
* var element = $compile('<p>{{total}}</p>')(scope);
|
||||
* var element = angular.element('<p>{{total}}</p>');
|
||||
* $compile(element)(scope);
|
||||
* ```
|
||||
*
|
||||
* - if on the other hand, you need the element to be cloned, the view reference from the original
|
||||
* example would not point to the clone, but rather to the original template that was cloned. In
|
||||
* this case, you can access the clone via the cloneAttachFn:
|
||||
* this case, you can access the clone either via the `cloneAttachFn` or the value returned by the
|
||||
* linking function:
|
||||
* ```js
|
||||
* var templateElement = angular.element('<p>{{total}}</p>'),
|
||||
* scope = ....;
|
||||
*
|
||||
* var templateElement = angular.element('<p>{{total}}</p>');
|
||||
* var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) {
|
||||
* //attach the clone to DOM document at the right place
|
||||
* // Attach the clone to DOM document at the right place.
|
||||
* });
|
||||
*
|
||||
* //now we have reference to the cloned DOM via `clonedElement`
|
||||
* // Now we have reference to the cloned DOM via `clonedElement`.
|
||||
* // NOTE: The `clonedElement` returned by the linking function is the same as the
|
||||
* // `clonedElement` passed to `cloneAttachFn`.
|
||||
* ```
|
||||
*
|
||||
*
|
||||
@@ -1500,9 +1501,9 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
||||
* @description
|
||||
* Register a new directive with the compiler.
|
||||
*
|
||||
* @param {string|Object} name Name of the directive in camel-case (i.e. <code>ngBind</code> which
|
||||
* will match as <code>ng-bind</code>), or an object map of directives where the keys are the
|
||||
* names and the values are the factories.
|
||||
* @param {string|Object} name Name of the directive in camel-case (i.e. `ngBind` which will match
|
||||
* as `ng-bind`), or an object map of directives where the keys are the names and the values
|
||||
* are the factories.
|
||||
* @param {Function|Array} directiveFactory An injectable directive factory function. See the
|
||||
* {@link guide/directive directive guide} and the {@link $compile compile API} for more info.
|
||||
* @returns {ng.$compileProvider} Self for chaining.
|
||||
|
||||
@@ -181,7 +181,6 @@
|
||||
</file>
|
||||
</example>
|
||||
*
|
||||
* @element INPUT
|
||||
* @param {expression} ngDisabled If the {@link guide/expression expression} is truthy,
|
||||
* then the `disabled` attribute will be set on the element
|
||||
*/
|
||||
|
||||
@@ -909,8 +909,10 @@ var inputType = {
|
||||
*
|
||||
* <div class="alert alert-warning">
|
||||
* **Note:** `input[email]` uses a regex to validate email addresses that is derived from the regex
|
||||
* used in Chromium. If you need stricter validation (e.g. requiring a top-level domain), you can
|
||||
* use `ng-pattern` or modify the built-in validators (see the {@link guide/forms Forms guide})
|
||||
* used in Chromium, which may not fulfill your app's requirements.
|
||||
* If you need stricter (e.g. requiring a top-level domain), or more relaxed validation
|
||||
* (e.g. allowing IPv6 address literals) you can use `ng-pattern` or
|
||||
* modify the built-in validators (see the {@link guide/forms Forms guide}).
|
||||
* </div>
|
||||
*
|
||||
* @param {string} ngModel Assignable AngularJS expression to data-bind to.
|
||||
|
||||
@@ -54,14 +54,7 @@
|
||||
var ngStyleDirective = ngDirective(function(scope, element, attr) {
|
||||
scope.$watchCollection(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {
|
||||
if (oldStyles && (newStyles !== oldStyles)) {
|
||||
if (!newStyles) {
|
||||
newStyles = {};
|
||||
}
|
||||
forEach(oldStyles, function(val, style) {
|
||||
if (newStyles[style] == null) {
|
||||
newStyles[style] = '';
|
||||
}
|
||||
});
|
||||
forEach(oldStyles, function(val, style) { element.css(style, ''); });
|
||||
}
|
||||
if (newStyles) element.css(newStyles);
|
||||
});
|
||||
|
||||
@@ -68,17 +68,23 @@ var requiredDirective = ['$parse', function($parse) {
|
||||
require: '?ngModel',
|
||||
link: function(scope, elm, attr, ctrl) {
|
||||
if (!ctrl) return;
|
||||
var oldVal = attr.required || $parse(attr.ngRequired)(scope);
|
||||
// For boolean attributes like required, presence means true
|
||||
var value = attr.hasOwnProperty('required') || $parse(attr.ngRequired)(scope);
|
||||
|
||||
attr.required = true; // force truthy in case we are on non input element
|
||||
if (!attr.ngRequired) {
|
||||
// force truthy in case we are on non input element
|
||||
// (input elements do this automatically for boolean attributes like required)
|
||||
attr.required = true;
|
||||
}
|
||||
|
||||
ctrl.$validators.required = function(modelValue, viewValue) {
|
||||
return !attr.required || !ctrl.$isEmpty(viewValue);
|
||||
return !value || !ctrl.$isEmpty(viewValue);
|
||||
};
|
||||
|
||||
attr.$observe('required', function(val) {
|
||||
if (oldVal !== val) {
|
||||
oldVal = val;
|
||||
attr.$observe('required', function(newVal) {
|
||||
|
||||
if (value !== newVal) {
|
||||
value = newVal;
|
||||
ctrl.$validate();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* @ngdoc module
|
||||
* @name ngParseExt
|
||||
* @packageName angular-parse-ext
|
||||
*
|
||||
* @description
|
||||
*
|
||||
* The `ngParseExt` module provides functionality to allow Unicode characters in
|
||||
@@ -15,6 +16,11 @@
|
||||
* to be used as an identifier in an AngularJS expression. ES6 delegates some of the identifier
|
||||
* rules definition to Unicode, this module uses ES6 and Unicode 8.0 identifiers convention.
|
||||
*
|
||||
* <div class="alert alert-warning">
|
||||
* You cannot use Unicode characters for variable names in the {@link ngRepeat} or {@link ngOptions}
|
||||
* expressions (e.g. `ng-repeat="f in поля"`), because even with `ngParseExt` included, these
|
||||
* special expressions are not parsed by the {@link $parse} service.
|
||||
* </div>
|
||||
*/
|
||||
|
||||
/* global angularParseExtModule: true,
|
||||
|
||||
@@ -814,6 +814,19 @@ describe('angular', function() {
|
||||
expect(isElement(dst.jqObject)).toBeTruthy();
|
||||
expect(dst.jqObject.nodeName).toBeUndefined(); // i.e it is a jqLite/jQuery object
|
||||
});
|
||||
|
||||
it('should not merge the __proto__ property', function() {
|
||||
var src = JSON.parse('{ "__proto__": { "xxx": "polluted" } }');
|
||||
var dst = {};
|
||||
|
||||
merge(dst, src);
|
||||
|
||||
if (typeof dst.__proto__ !== 'undefined') { // eslint-disable-line
|
||||
// Should not overwrite the __proto__ property or pollute the Object prototype
|
||||
expect(dst.__proto__).toBe(Object.prototype); // eslint-disable-line
|
||||
}
|
||||
expect(({}).xxx).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -143,6 +143,17 @@ describe('ngStyle', function() {
|
||||
expect(element.css(postCompStyle)).not.toBe('99px');
|
||||
});
|
||||
|
||||
it('should clear style when the value is false', function() {
|
||||
scope.styleObj = {'height': '99px', 'width': '88px'};
|
||||
scope.$apply();
|
||||
expect(element.css(preCompStyle)).toBe('88px');
|
||||
expect(element.css(postCompStyle)).toBe('99px');
|
||||
scope.styleObj = {'height': false, 'width': false};
|
||||
scope.$apply();
|
||||
expect(element.css(preCompStyle)).not.toBe('88px');
|
||||
expect(element.css(postCompStyle)).not.toBe('99px');
|
||||
});
|
||||
|
||||
it('should set style when the value is zero', function() {
|
||||
scope.styleObj = {'height': '99px', 'width': '88px'};
|
||||
scope.$apply();
|
||||
|
||||
@@ -696,6 +696,13 @@ describe('validators', function() {
|
||||
}));
|
||||
|
||||
|
||||
it('should override "required" when ng-required="false" is set', function() {
|
||||
var inputElm = helper.compileInput('<input type="text" ng-model="notDefined" required ng-required="false" />');
|
||||
|
||||
expect(inputElm).toBeValid();
|
||||
});
|
||||
|
||||
|
||||
it('should validate only once after compilation when inside ngRepeat', function() {
|
||||
helper.compileInput(
|
||||
'<div ng-repeat="input in [0]">' +
|
||||
@@ -730,5 +737,30 @@ describe('validators', function() {
|
||||
|
||||
expect(helper.validationCounter.required).toBe(1);
|
||||
});
|
||||
|
||||
|
||||
it('should validate once when inside ngRepeat, and set the "required" error when ngRequired is false by default', function() {
|
||||
$rootScope.isRequired = false;
|
||||
$rootScope.refs = {};
|
||||
|
||||
var elm = helper.compileInput(
|
||||
'<div ng-repeat="input in [0]">' +
|
||||
'<input type="text" ng-ref="refs.input" ng-ref-read="ngModel" ng-model="value" ng-required="isRequired" validation-spy="required" />' +
|
||||
'</div>');
|
||||
|
||||
expect(helper.validationCounter.required).toBe(1);
|
||||
expect($rootScope.refs.input.$error.required).toBeUndefined();
|
||||
});
|
||||
|
||||
|
||||
it('should validate only once when inside ngIf with required on non-input elements', inject(function($compile) {
|
||||
$rootScope.value = '12';
|
||||
$rootScope.refs = {};
|
||||
helper.compileInput('<div ng-if="true"><span ng-model="value" ng-ref="refs.ctrl" ng-ref-read="ngModel" required validation-spy="required"></span></div>');
|
||||
$rootScope.$digest();
|
||||
|
||||
expect(helper.validationCounter.required).toBe(1);
|
||||
expect($rootScope.refs.ctrl.$error.required).not.toBe(true);
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
integrity sha1-vShOV8hPEyXacCur/IKlMoGQwMU=
|
||||
|
||||
"@types/selenium-webdriver@^3.0.0":
|
||||
version "3.0.13"
|
||||
resolved "https://registry.yarnpkg.com/@types/selenium-webdriver/-/selenium-webdriver-3.0.13.tgz#deb799c641773c5e367abafc92d1e733d62cddd7"
|
||||
integrity sha512-rI0LGoMiZGUM+tjDakQpwZOvcmQoubiJ7hxqrYU12VRxBuGGvOThxrBOU/QmJKlKg1WG6FMzuvcEyLffvVSsmw==
|
||||
version "3.0.12"
|
||||
resolved "https://registry.yarnpkg.com/@types/selenium-webdriver/-/selenium-webdriver-3.0.12.tgz#6affe5aed1ba379175075a889adbe2bc3aa62159"
|
||||
integrity sha512-hYn+eoOehVUIdMwp5h34ZsGAO1ydja10GDup4BwyoFCdcH5MQ35nQq+AInSaBMEMopD5hEooFCyKo2Pajbe1ag==
|
||||
|
||||
Base64@~0.2.0:
|
||||
version "0.2.1"
|
||||
@@ -4347,10 +4347,10 @@ jasminewd2@^2.1.0:
|
||||
resolved "https://registry.yarnpkg.com/jquery/-/jquery-2.2.4.tgz#2c89d6889b5eac522a7eea32c14521559c6cbf02"
|
||||
integrity sha1-LInWiJterFIqfuoywUUhVZxsvwI=
|
||||
|
||||
jquery@3.2.1:
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.2.1.tgz#5c4d9de652af6cd0a770154a631bba12b015c787"
|
||||
integrity sha1-XE2d5lKvbNCncBVKYxu6ErAVx4c=
|
||||
jquery@3.4.0:
|
||||
version "3.4.0"
|
||||
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.4.0.tgz#8de513fa0fa4b2c7d2e48a530e26f0596936efdf"
|
||||
integrity sha512-ggRCXln9zEqv6OqAGXFEcshF5dSBvCkzj6Gm2gzuR5fWawaX8t7cxKVkkygKODrDAzKdoYw3l/e3pm3vlT4IbQ==
|
||||
|
||||
js-tokens@^3.0.0:
|
||||
version "3.0.1"
|
||||
@@ -5836,9 +5836,9 @@ pako@~0.2.0:
|
||||
integrity sha1-8/dSL073gjSNqBYbrZ7P1Rv4OnU=
|
||||
|
||||
pako@~1.0.2:
|
||||
version "1.0.7"
|
||||
resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.7.tgz#2473439021b57f1516c82f58be7275ad8ef1bb27"
|
||||
integrity sha512-3HNK5tW4x8o5mO8RuHZp3Ydw9icZXx0RANAOMzlMzx7LVXhMJ4mo3MOBpzyd7r/+RUu8BmndP47LXT+vzjtWcQ==
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.6.tgz#0101211baa70c4bca4a0f63f2206e97b7dfaf258"
|
||||
integrity sha512-lQe48YPsMJAig+yngZ87Lus+NF+3mtu7DVOBu6b/gHO1YpKwIj5AWjZ/TOS7i46HD/UixzWb1zeWDZfGZ3iYcg==
|
||||
|
||||
param-case@^2.1.0:
|
||||
version "2.1.0"
|
||||
|
||||
Reference in New Issue
Block a user