Compare commits
254 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a34c8e1b8 | |||
| fec2ea8c1b | |||
| 7566c7d26f | |||
| 02a19c0f39 | |||
| 6e6e4eec9d | |||
| 46f14fa4b8 | |||
| bad2249bcd | |||
| c2148ec15c | |||
| 474e40498e | |||
| e9a6792d7f | |||
| adc1501caa | |||
| 7a53707c8f | |||
| 57fe5b320d | |||
| 671bebde0a | |||
| b51ded6736 | |||
| 3ec1819b91 | |||
| 009ebec64c | |||
| 9256dbc420 | |||
| 7504656a26 | |||
| e74cdf4b59 | |||
| 9d6c3f3ec2 | |||
| ac0e260765 | |||
| 28c0213ee5 | |||
| 8b4d85c015 | |||
| 2aeda67909 | |||
| ad68ee192e | |||
| 970ba117eb | |||
| 30e097b389 | |||
| e8e02b8bce | |||
| e36a3e89f5 | |||
| 1102c41196 | |||
| e970c8fce9 | |||
| 04271d6b2c | |||
| 2e1163ef5c | |||
| 75befe723a | |||
| 5e2bc5bbf3 | |||
| 079c485b92 | |||
| 19a0c9324c | |||
| 9ef02e72ab | |||
| 2101126ce7 | |||
| a222d0b452 | |||
| 1b8eb231c9 | |||
| 06baf1869b | |||
| 82597fc12b | |||
| ff52b188a7 | |||
| dc41f465ba | |||
| 6e3b5a57cd | |||
| f003d93a3d | |||
| aac5623247 | |||
| aa03812fd0 | |||
| bcb6a494de | |||
| a1e3f8728e | |||
| 9e8e3e187d | |||
| c6554433cf | |||
| 43d2a75f4e | |||
| 37d2b50812 | |||
| 8f31f1ff43 | |||
| cf84fcf544 | |||
| f63bc3cfde | |||
| a77943110e | |||
| ec97686f2f | |||
| 4ff7b7aa48 | |||
| 57b837bd5c | |||
| 6daca023e4 | |||
| 91b4eb0f69 | |||
| e50ed4da9e | |||
| fe5dd1da8f | |||
| df4c03fa33 | |||
| 8d4e626326 | |||
| 92aef5d456 | |||
| eed13cf732 | |||
| e90200b4de | |||
| 7f36ba77a0 | |||
| 457c58827b | |||
| aae768611f | |||
| ce5ffbf667 | |||
| ab114af850 | |||
| 2759788737 | |||
| c643323c17 | |||
| 9b97a033b0 | |||
| a3226d01fa | |||
| 510d0f946f | |||
| 0b962d4881 | |||
| 71b4daa4e1 | |||
| e0b02a5040 | |||
| a0dd9b0fdd | |||
| 498bef199a | |||
| 17d34b7a98 | |||
| 72359fd097 | |||
| 72882190f2 | |||
| fd2d8a5755 | |||
| fbe84f95a1 | |||
| 3671a43be4 | |||
| f6a1ad528d | |||
| d9128e7b23 | |||
| 0b54c1d4a9 | |||
| 608d623b55 | |||
| 9f30bb5475 | |||
| 182fb18f00 | |||
| 3a9fdceeee | |||
| ee4ac72170 | |||
| eb9fc571a0 | |||
| b4d1e5e492 | |||
| 60394a9d91 | |||
| f5ddb10b56 | |||
| 6a448d3459 | |||
| 6a8c0f5f4a | |||
| 584308fc06 | |||
| 48ad2c44bf | |||
| 100998330a | |||
| b9e85c62be | |||
| 77fad099d2 | |||
| e1f8a6e82b | |||
| 132d767647 | |||
| 9cde98cbc7 | |||
| 1ddbb3ec3e | |||
| 34f40266b2 | |||
| b8c06e3f1b | |||
| a6cf648b3c | |||
| aebde27f1b | |||
| c9be327d53 | |||
| 3dc7d22d90 | |||
| c10c6cac74 | |||
| cee2c4c569 | |||
| a5160c82dc | |||
| 8853312197 | |||
| 049b24de21 | |||
| a9f987a0c9 | |||
| ad4a20d3d2 | |||
| b3972d1b65 | |||
| c3e0d58b3c | |||
| f08156ea9b | |||
| 4bacf5a5da | |||
| df88873bb7 | |||
| c4b1c5e8f1 | |||
| 9822711ad2 | |||
| 30cd764b6d | |||
| 38b75cdb2d | |||
| 6cb8b39af8 | |||
| ebaa336614 | |||
| ef5f567f91 | |||
| 64e5afc478 | |||
| 1e582e4fa4 | |||
| 7421235f24 | |||
| 09ba69078d | |||
| 3536e83d8a | |||
| 3bb1dd5d7f | |||
| 95f964b827 | |||
| c8f78a8ca9 | |||
| f34d48087b | |||
| 2c9ecd01b1 | |||
| a584fb6e15 | |||
| 1f13313f40 | |||
| 5b60303781 | |||
| 10e2552a7d | |||
| ef48b0aa55 | |||
| f57872bca0 | |||
| 2deaf2877e | |||
| 7a146c9cd5 | |||
| 2796ec172b | |||
| 6997c1bf0c | |||
| 4a030f3834 | |||
| f78d8b8ff3 | |||
| f27d19ed60 | |||
| 4a5eaf7bec | |||
| 8513674911 | |||
| 97b74ad6fb | |||
| a47ea79023 | |||
| 5ca0de6487 | |||
| 50a449f053 | |||
| d7422da7d7 | |||
| c7cbc978c6 | |||
| 27146e8a7f | |||
| 5e418b1145 | |||
| f4bb973eb7 | |||
| 848857aa5b | |||
| ee8a05d3f1 | |||
| 275ebbf0ec | |||
| 0f23df4c06 | |||
| 11f700f7bd | |||
| 5785f2a991 | |||
| 2546c29f81 | |||
| 19ea708c9d | |||
| 5cf05d67f2 | |||
| 0377c6f0e8 | |||
| 9c13866824 | |||
| 419a4813e3 | |||
| 131af8272d | |||
| c219a46f59 | |||
| 25f008f541 | |||
| 4a593db79b | |||
| ad4fef0431 | |||
| 8a15fcc1f5 | |||
| f01212ab52 | |||
| 28693a1a67 | |||
| 29fd499552 | |||
| 2f97d9d647 | |||
| 4146b38459 | |||
| 05aab660ce | |||
| 5ecb64849e | |||
| 59dfe1b5a0 | |||
| 50ebfb735c | |||
| 0bdbfe5069 | |||
| 3fc4d6028c | |||
| 2eb12a052b | |||
| bd63b2235c | |||
| f418ffd083 | |||
| 6ab5f8ce4b | |||
| becfeb5aa3 | |||
| eb968c4a68 | |||
| 7f2af3f923 | |||
| cce98ff53a | |||
| b607618342 | |||
| fa50fbaf57 | |||
| f135e2dc05 | |||
| 780351db5e | |||
| a50bb0bfec | |||
| 4d86df6f48 | |||
| bb464d16b4 | |||
| 85b2eb1472 | |||
| 7608f92c6a | |||
| c0bf8db63c | |||
| c95a6737fb | |||
| cd43d24402 | |||
| 086c5d0354 | |||
| 2a2ac5f53a | |||
| 21deaf637a | |||
| 72e15a3a83 | |||
| 174cb4a8c8 | |||
| 33f769b0a1 | |||
| c8abf20558 | |||
| 6dbb183e75 | |||
| bc4844d3b2 | |||
| 708f8b47de | |||
| 5518126d42 | |||
| 5fe73fdc3a | |||
| 394c496bf2 | |||
| 8e1aeba715 | |||
| 0e6e7eb477 | |||
| 183f636816 | |||
| 5f8ed63f2a | |||
| e4f3c94e31 | |||
| 1e5cbcbd93 | |||
| dcf3ec160f | |||
| a7beb5b6d3 | |||
| 1d3b65adc2 | |||
| d528644fe3 | |||
| 6f1bcfc14e | |||
| 996914c6b0 | |||
| fff048d099 | |||
| dcb0da8225 | |||
| b664e20d12 | |||
| 3d68b95028 | |||
| 163aca336d |
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"projects": {
|
||||
"default": "docs-angularjs-org-9p2"
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -9,7 +9,7 @@ performance/temp*.html
|
||||
*~
|
||||
*.swp
|
||||
angular.js.tmproj
|
||||
/node_modules/
|
||||
node_modules/
|
||||
bower_components/
|
||||
angular.xcodeproj
|
||||
.idea
|
||||
|
||||
+58
-16
@@ -4,14 +4,13 @@ node_js:
|
||||
- '6'
|
||||
|
||||
cache:
|
||||
yarn: true
|
||||
directories:
|
||||
- node_modules
|
||||
- bower_components
|
||||
- docs/bower_components
|
||||
|
||||
branches:
|
||||
except:
|
||||
- /^g3_.*$/
|
||||
- "/^g3_.*$/"
|
||||
|
||||
env:
|
||||
matrix:
|
||||
@@ -21,14 +20,15 @@ env:
|
||||
- JOB=e2e TEST_TARGET=jqlite BROWSER_PROVIDER=saucelabs
|
||||
- JOB=e2e TEST_TARGET=jquery BROWSER_PROVIDER=saucelabs
|
||||
global:
|
||||
- CXX=g++-4.8 # node 4 likes the G++ v4.8 compiler
|
||||
# node 4 likes the G++ v4.8 compiler
|
||||
# see https://docs.travis-ci.com/user/languages/javascript-with-nodejs#Node.js-v4-(or-io.js-v3)-compiler-requirements
|
||||
- CXX=g++-4.8
|
||||
- SAUCE_USERNAME=angular-ci
|
||||
- SAUCE_ACCESS_KEY=9b988f434ff8-fbca-8aa4-4ae3-35442987
|
||||
- LOGS_DIR=/tmp/angular-build/logs
|
||||
- BROWSER_PROVIDER_READY_FILE=/tmp/browsersprovider-tunnel-ready
|
||||
- secure: oTBjhnOKhs0qDSKTf7fE4f6DYiNDPycvB7qfSF5QRIbJK/LK/J4UtFwetXuXj79HhUZG9qnoT+5e7lPaiaMlpsIKn9ann7ffqFWN1E8TMtpJF+AGigx3djYElwfgf5nEnFUFhwjFzvbfpZNnxVGgX5YbIZpe/WUbHkP4ffU0Wks=
|
||||
|
||||
# node 4 likes the G++ v4.8 compiler
|
||||
# see https://docs.travis-ci.com/user/languages/javascript-with-nodejs#Node.js-v4-(or-io.js-v3)-compiler-requirements
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
@@ -37,25 +37,67 @@ addons:
|
||||
- g++-4.8
|
||||
|
||||
before_install:
|
||||
- curl -o- -L https://raw.githubusercontent.com/yarnpkg/yarn/2a0afc73210c7a82082585283e518eeb88ca19ae/scripts/install-latest.sh | bash -s -- --version 0.17.9
|
||||
- export PATH=$HOME/.yarn/bin:$PATH
|
||||
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 0.27.5
|
||||
- export PATH="$HOME/.yarn/bin:$PATH"
|
||||
|
||||
before_script:
|
||||
- du -sh ./node_modules ./bower_components/ ./docs/bower_components/ || true
|
||||
- ./scripts/travis/before_build.sh
|
||||
- du -sh ./node_modules ./bower_components/ || true
|
||||
- "./scripts/travis/before_build.sh"
|
||||
|
||||
script:
|
||||
- ./scripts/travis/build.sh
|
||||
- "./scripts/travis/build.sh"
|
||||
|
||||
after_script:
|
||||
- ./scripts/travis/tear_down_browser_provider.sh
|
||||
- ./scripts/travis/print_logs.sh
|
||||
- "./scripts/travis/tear_down_browser_provider.sh"
|
||||
- "./scripts/travis/print_logs.sh"
|
||||
|
||||
notifications:
|
||||
webhooks:
|
||||
urls:
|
||||
- https://webhooks.gitter.im/e/d2120f3f2bb39a4531b2
|
||||
- http://104.197.9.155:8484/hubot/travis/activity #hubot-server
|
||||
on_success: always # options: [always|never|change] default: always
|
||||
on_failure: always # options: [always|never|change] default: always
|
||||
on_start: always # default: false
|
||||
on_success: always # options: [always|never|change] default: always
|
||||
on_failure: always # options: [always|never|change] default: always
|
||||
on_start: always # default: false
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: deploy
|
||||
env:
|
||||
- JOB=deploy
|
||||
before_script: skip
|
||||
script:
|
||||
- "./scripts/travis/build.sh"
|
||||
# Work around the 10min Travis timeout so the code.angularjs firebase+gcs code deploy can complete
|
||||
before_deploy: |
|
||||
function keep_alive() {
|
||||
while true; do
|
||||
echo -en "\a"
|
||||
sleep 5
|
||||
done
|
||||
}
|
||||
keep_alive &
|
||||
deploy:
|
||||
- provider: firebase
|
||||
skip_cleanup: true
|
||||
token:
|
||||
secure: $FIREBASE_TOKEN
|
||||
on:
|
||||
repo: angular/angular.js
|
||||
all_branches: true
|
||||
# deploy a new docs version when the commit is tagged on the "latest" npm version
|
||||
condition: $TRAVIS_TAG != '' && $( jq ".distTag" "package.json" | tr -d "\"[:space:]" ) = latest
|
||||
- provider: gcs
|
||||
skip_cleanup: true
|
||||
access_key_id: GOOGLDB7W2J3LFHICF3R
|
||||
secret_access_key:
|
||||
secure: tHIFdSq55qkyZf9zT/3+VkhUrTvOTMuswxXU3KyWaBrSieZqG0UnUDyNm+n3lSfX95zEl/+rJAWbfvhVSxZi13ndOtvRF+MdI1cvow2JynP0aDSiPffEvVrZOmihD6mt2SlMfhskr5FTduQ69kZG6DfLcve1PPDaIwnbOv3phb8=
|
||||
bucket: code-angularjs-org-338b8.appspot.com
|
||||
local-dir: upload
|
||||
detect_encoding: true # detects gzip compression
|
||||
on:
|
||||
repo: angular/angular.js
|
||||
all_branches: true
|
||||
# upload the build when the commit is tagged or the branch is "master"
|
||||
condition: $TRAVIS_TAG != '' || ($TRAVIS_PULL_REQUEST = false && $TRAVIS_BRANCH = master)
|
||||
|
||||
|
||||
+674
-42
@@ -1,3 +1,450 @@
|
||||
<a name="1.6.6"></a>
|
||||
# 1.6.6 interdimensional-cable (2017-08-18)
|
||||
|
||||
|
||||
## Bug Fixes
|
||||
- **$httpParamSerializer:** ignore functions
|
||||
([b51ded](https://github.com/angular/angular.js/commit/b51ded67366865f36c5781dd5d9b801488ec95ea),
|
||||
[#16133](https://github.com/angular/angular.js/issues/16133))
|
||||
- **$resource:** do not throw when calling old `$cancelRequest()`
|
||||
([009ebe](https://github.com/angular/angular.js/commit/009ebec64c81d11b280c635167050e8906e191c6),
|
||||
[#16037](https://github.com/angular/angular.js/issues/16037))
|
||||
- **$parse:**
|
||||
- do not shallow-watch computed property keys
|
||||
([750465](https://github.com/angular/angular.js/commit/7504656a26202de591e4ac9674333254304edf8a))
|
||||
- support constants in computed keys
|
||||
([9d6c3f](https://github.com/angular/angular.js/commit/9d6c3f3ec233279885e37a250d25860d5c15f716))
|
||||
- **$http:** do not throw error if `Content-Type` is not `application/json` but response is JSON-like
|
||||
([2e1163](https://github.com/angular/angular.js/commit/2e1163ef5cb56d1933e8ecd7b74020b9df9c6693),
|
||||
[#16027](https://github.com/angular/angular.js/issues/16027),
|
||||
[#16075](https://github.com/angular/angular.js/issues/16075))
|
||||
|
||||
|
||||
## New Features
|
||||
- **$compile:** add `strictComponentBindingsEnabled()` method
|
||||
([3ec181](https://github.com/angular/angular.js/commit/3ec1819b913c8edf0649e06217dbd5920f29f126),
|
||||
[#16129](https://github.com/angular/angular.js/issues/16129))
|
||||
- **$resource:** add resource to response for error interceptors
|
||||
([9256db](https://github.com/angular/angular.js/commit/9256dbc4201343ce5cd63a9eadf98da4793f45af),
|
||||
[#16109](https://github.com/angular/angular.js/issues/16109))
|
||||
- **$http:** allow differentiation between XHR completion, error, abort, timeout
|
||||
([5e2bc5](https://github.com/angular/angular.js/commit/5e2bc5bbf347a9dfadc08b1514b8be06fd550913),
|
||||
[#15924](https://github.com/angular/angular.js/issues/15924),
|
||||
[#15847](https://github.com/angular/angular.js/issues/15847))
|
||||
|
||||
|
||||
<a name="1.6.5"></a>
|
||||
# 1.6.5 toffee-salinization (2017-07-03)
|
||||
|
||||
|
||||
## Bug Fixes
|
||||
- **core:**
|
||||
- correctly detect Error instances from different contexts
|
||||
([6daca0](https://github.com/angular/angular.js/commit/6daca023e42098f7098b9bf153c8e53a17af84f1),
|
||||
[#15868](https://github.com/angular/angular.js/issues/15868),
|
||||
[#15872](https://github.com/angular/angular.js/issues/15872))
|
||||
- deprecate `angular.merge`
|
||||
([dc41f4](https://github.com/angular/angular.js/commit/dc41f465baae9bc91418a61f446596157c530b6e),
|
||||
[#12653](https://github.com/angular/angular.js/issues/12653),
|
||||
[#14941](https://github.com/angular/angular.js/issues/14941),
|
||||
[#15180](https://github.com/angular/angular.js/issues/15180),
|
||||
[#15992](https://github.com/angular/angular.js/issues/15992),
|
||||
[#16036](https://github.com/angular/angular.js/issues/16036))
|
||||
- **ngOptions:**
|
||||
- re-render after empty option has been removed
|
||||
([510d0f](https://github.com/angular/angular.js/commit/510d0f946fa1a443ad43fa31bc9337676ef31332))
|
||||
- allow empty option to be removed and re-added
|
||||
([71b4da](https://github.com/angular/angular.js/commit/71b4daa4e10b6912891927ee2a7930c604b538f8))
|
||||
- select unknown option if unmatched model does not match empty option
|
||||
([17d34b](https://github.com/angular/angular.js/commit/17d34b7a983a0ef63f6cf404490385c696fb0da1))
|
||||
- **orderBy:** guarantee stable sort
|
||||
([e50ed4](https://github.com/angular/angular.js/commit/e50ed4da9e8177168f67da68bdf02f07da4e7bcf),
|
||||
[#14881](https://github.com/angular/angular.js/issues/14881),
|
||||
[#15914](https://github.com/angular/angular.js/issues/15914))
|
||||
- **$parse:**
|
||||
- do not shallow-watch inputs to one-time intercepted expressions
|
||||
([6e3b5a](https://github.com/angular/angular.js/commit/6e3b5a57cd921823f3eca7200a79ac5c2ef0567a))
|
||||
- standardize one-time literal vs non-literal and interceptors
|
||||
([f003d9](https://github.com/angular/angular.js/commit/f003d93a3dd052dccddef41125d9c51034ac3605))
|
||||
- do not shallow-watch inputs when wrapped in an interceptor fn
|
||||
([aac562](https://github.com/angular/angular.js/commit/aac5623247a86681cbe0e1c8179617b816394c1d),
|
||||
[#15905](https://github.com/angular/angular.js/issues/15905))
|
||||
- always re-evaluate filters within literals when an input is an object
|
||||
([ec9768](https://github.com/angular/angular.js/commit/ec97686f2f4a5481cc806462313a664fc7a1c893),
|
||||
[#15964](https://github.com/angular/angular.js/issues/15964),
|
||||
[#15990](https://github.com/angular/angular.js/issues/15990))
|
||||
- **$sanitize:** use appropriate inert document strategy for Firefox and Safari
|
||||
([8f31f1](https://github.com/angular/angular.js/commit/8f31f1ff43b673a24f84422d5c13d6312b2c4d94))
|
||||
- **$timeout/$interval:** do not trigger a digest on cancel
|
||||
([a222d0](https://github.com/angular/angular.js/commit/a222d0b452622624dc498ef0b9d3c43647fd4fbc),
|
||||
[#16057](https://github.com/angular/angular.js/issues/16057),
|
||||
[#16064](https://github.com/angular/angular.js/issues/16064))<br>
|
||||
This change might affect the use of `$timeout.flush()` in unit tests. See the commit message for
|
||||
more info.
|
||||
- **ngMock/$interval:** add support for zero-delay intervals in tests
|
||||
([a1e3f8](https://github.com/angular/angular.js/commit/a1e3f8728e0a80396f980e48f8dc68dde6721b2b),
|
||||
[#15952](https://github.com/angular/angular.js/issues/15952),
|
||||
[#15953](https://github.com/angular/angular.js/issues/15953))
|
||||
- **angular-loader:** do not depend on "closure" globals that may not be available
|
||||
([a3226d](https://github.com/angular/angular.js/commit/a3226d01fadaf145713518dc5b8022b581c34e81),
|
||||
[#15880](https://github.com/angular/angular.js/issues/15880),
|
||||
[#15881](https://github.com/angular/angular.js/issues/15881))
|
||||
|
||||
|
||||
## New Features
|
||||
- **select:** expose info about selection state in controller
|
||||
([0b962d](https://github.com/angular/angular.js/commit/0b962d4881e98327a91c37f7317da557aa991663),
|
||||
[#13172](https://github.com/angular/angular.js/issues/13172),
|
||||
[#10127](https://github.com/angular/angular.js/issues/10127))
|
||||
- **$animate:** add support for `customFilter`
|
||||
([ab114a](https://github.com/angular/angular.js/commit/ab114af8508bdbdb1fa5fd1e070d08818d882e28),
|
||||
[#14891](https://github.com/angular/angular.js/issues/14891))
|
||||
- **$compile:** overload `.component()` to accept object map of components
|
||||
([210112](https://github.com/angular/angular.js/commit/2101126ce72308d8fc468ca2411bb9972e614f79),
|
||||
[#14579](https://github.com/angular/angular.js/issues/14579),
|
||||
[#16062](https://github.com/angular/angular.js/issues/16062))
|
||||
- **$log:** log all parameters in IE 9, not just the first two.
|
||||
([3671a4](https://github.com/angular/angular.js/commit/3671a43be43d05b00c90dfb3a3f746c013139581))
|
||||
- **ngMock:** describe unflushed http requests
|
||||
([d9128e](https://github.com/angular/angular.js/commit/d9128e7b2371ab2bb5169ba854b21c78baa784d2),
|
||||
[#10596](https://github.com/angular/angular.js/issues/10596),
|
||||
[#15928](https://github.com/angular/angular.js/issues/15928))
|
||||
|
||||
|
||||
## Performance Improvements
|
||||
- **ngOptions:** prevent initial options repainting
|
||||
([ff52b1](https://github.com/angular/angular.js/commit/ff52b188a759f2cc7ee6ee78a8c646c2354a47eb),
|
||||
[#15801](https://github.com/angular/angular.js/issues/15801),
|
||||
[#15812](https://github.com/angular/angular.js/issues/15812),
|
||||
[#16071](https://github.com/angular/angular.js/issues/16071))
|
||||
- **$animate:**
|
||||
- avoid unnecessary computations if animations are globally disabled
|
||||
([ce5ffb](https://github.com/angular/angular.js/commit/ce5ffbf667464bd58eae4c4af0917eb2685f1f6a),
|
||||
[#14914](https://github.com/angular/angular.js/issues/14914))
|
||||
- do not retrieve `className` unless `classNameFilter` is used
|
||||
([275978](https://github.com/angular/angular.js/commit/27597887379a1904cd86832602e286894b449a75))
|
||||
|
||||
|
||||
|
||||
<a name="1.6.4"></a>
|
||||
# 1.6.4 phenomenal-footnote (2017-03-31)
|
||||
|
||||
|
||||
## Bug Fixes
|
||||
- **$parse:**
|
||||
- standardize one-time literal vs non-literal and interceptors
|
||||
([60394a](https://github.com/angular/angular.js/commit/60394a9d91dad8932fa900af7c8529837f1d4557),
|
||||
[#15858](https://github.com/angular/angular.js/issues/15858))
|
||||
- fix infinite digest errors when watching objects with .valueOf in literals
|
||||
([f5ddb1](https://github.com/angular/angular.js/commit/f5ddb10b56676c2ad912ce453acb87f0a7a94e01),
|
||||
[#15867](https://github.com/angular/angular.js/issues/15867))
|
||||
- **ngModel:** prevent internal scope reference from being copied
|
||||
([e1f8a6](https://github.com/angular/angular.js/commit/e1f8a6e82bb8a70079ef3db9a891b1c08b5bae31),
|
||||
[#15833](https://github.com/angular/angular.js/issues/15833))
|
||||
- **jqLite:** make jqLite invoke jqLite.cleanData as a method
|
||||
([9cde98](https://github.com/angular/angular.js/commit/9cde98cbc770f8d33fc074ba563b7ab6e2baaf8b),
|
||||
[#15846](https://github.com/angular/angular.js/issues/15846))
|
||||
- **$http:** throw more informative error on invalid JSON response
|
||||
([df8887](https://github.com/angular/angular.js/commit/df88873bb79213057057adb47151b626a7ec0e5d),
|
||||
[#15695](https://github.com/angular/angular.js/issues/15695),
|
||||
[#15724](https://github.com/angular/angular.js/issues/15724))
|
||||
- **dateFilter:** correctly handle newlines in `format` string
|
||||
([982271](https://github.com/angular/angular.js/commit/9822711ad2a401c2449239edc13d18b301714757),
|
||||
[#15794](https://github.com/angular/angular.js/issues/15794),
|
||||
[#15792](https://github.com/angular/angular.js/issues/15792))
|
||||
|
||||
|
||||
## New Features
|
||||
- **$resource:** add `hasBody` action configuration option
|
||||
([a9f987](https://github.com/angular/angular.js/commit/a9f987a0c9653246ea471a89197907d94c0cea2a),
|
||||
[#10128](https://github.com/angular/angular.js/issues/10128),
|
||||
[#12181](https://github.com/angular/angular.js/issues/12181))
|
||||
|
||||
|
||||
<a name="1.6.3"></a>
|
||||
# 1.6.3 scriptalicious-bootstrapping (2017-03-08)
|
||||
|
||||
|
||||
## Bug Fixes
|
||||
- **AngularJS:**
|
||||
- do not auto-bootstrap if the `src` exists but is empty
|
||||
([3536e8](https://github.com/angular/angular.js/commit/3536e83d8a085b02bd6dcec8324800b7e6c734e4))
|
||||
- do not auto bootstrap if the currentScript has been clobbered
|
||||
([95f964](https://github.com/angular/angular.js/commit/95f964b827b6f5b5aab10af54f7831316c7a9935))
|
||||
- do not auto-bootstrap if the script source is bad and inside SVG
|
||||
([c8f78a](https://github.com/angular/angular.js/commit/c8f78a8ca9debc33a6deaf951f344b8d372bf210))
|
||||
- **$log:** don't parse error stacks manually outside of IE/Edge
|
||||
([64e5af](https://github.com/angular/angular.js/commit/64e5afc4786fdfd850c6bdb488a5aa2b8b077f74),
|
||||
[#15590](https://github.com/angular/angular.js/issues/15590),
|
||||
[#15767](https://github.com/angular/angular.js/issues/15767))
|
||||
- **$sanitize:** prevent clobbered elements from freezing the browser
|
||||
([3bb1dd](https://github.com/angular/angular.js/commit/3bb1dd5d7f7dcde6fea5a3148f8f10e92f451e9d),
|
||||
[#15699](https://github.com/angular/angular.js/issues/15699))
|
||||
- **$animate:**
|
||||
- reset `classNameFilter` to `null` when a disallowed RegExp is used
|
||||
([a584fb](https://github.com/angular/angular.js/commit/a584fb6e1569fc1dd85e23b251a7c126edc2dd5b),
|
||||
[#14913](https://github.com/angular/angular.js/issues/14913))
|
||||
- improve detection on `ng-animate` in `classNameFilter` RegExp
|
||||
([1f1331](https://github.com/angular/angular.js/commit/1f13313f403381581e1c31c57ebfe7a96546c6e4),
|
||||
[#14806](https://github.com/angular/angular.js/issues/14806))
|
||||
- **filterFilter:** don't throw if `key.charAt` is not a function
|
||||
([f27d19](https://github.com/angular/angular.js/commit/f27d19ed606bf05ba41698159ebbc5fbc195033e),
|
||||
[#15644](https://github.com/angular/angular.js/issues/15644),
|
||||
[#15660](https://github.com/angular/angular.js/issues/15660))
|
||||
- **select:**
|
||||
- add attribute "selected" for `select[multiple]`
|
||||
([851367](https://github.com/angular/angular.js/commit/8513674911300b27d518383a905fde9b3f25f7ae))
|
||||
- keep original selection when using shift to add options in IE/Edge
|
||||
([97b74a](https://github.com/angular/angular.js/commit/97b74ad6fbcbc4b63e37e9eb44962d6f8de83e8b),
|
||||
[#15675](https://github.com/angular/angular.js/issues/15675),
|
||||
[#15676](https://github.com/angular/angular.js/issues/15676))
|
||||
- **$jsonpCallbacks:** allow `$window` to be mocked in unit tests
|
||||
([5ca0de](https://github.com/angular/angular.js/commit/5ca0de64873c32ab2f540a3226e73c4175a15c50),
|
||||
[#15685](https://github.com/angular/angular.js/issues/15685),
|
||||
[#15686](https://github.com/angular/angular.js/issues/15686))
|
||||
|
||||
|
||||
## New Features
|
||||
- **info:** add `angularVersion` info to each module
|
||||
([1e582e](https://github.com/angular/angular.js/commit/1e582e4fa486f340150bba95927f1b26d9142de2))
|
||||
- **$injector:** add new `modules` property
|
||||
([742123](https://github.com/angular/angular.js/commit/7421235f247e5b7113345401bc5727cfbf81ddc2))
|
||||
- **Module:** add `info()` method
|
||||
([09ba69](https://github.com/angular/angular.js/commit/09ba69078de6ba52c70571b82b6205929f6facc5),
|
||||
[#15225](https://github.com/angular/angular.js/issues/15225))
|
||||
- **errorHandlingConfig:** make the depth for object stringification in errors configurable
|
||||
([4a5eaf](https://github.com/angular/angular.js/commit/4a5eaf7bec85ceca8b934ebaff4d1834a1a09f57),
|
||||
[#15402](https://github.com/angular/angular.js/issues/15402),
|
||||
[#15433](https://github.com/angular/angular.js/issues/15433))
|
||||
|
||||
|
||||
<a name="1.6.2"></a>
|
||||
# 1.6.2 llamacorn-lovehug (2017-02-07)
|
||||
|
||||
|
||||
## Bug Fixes
|
||||
- **$compile:**
|
||||
- do not swallow thrown errors in testsg
|
||||
([0377c6](https://github.com/angular/angular.js/commit/0377c6f0e890cb4ed3eb020b96720b4b34f75df3),
|
||||
[#15629](https://github.com/angular/angular.js/issues/15629),
|
||||
[#15631](https://github.com/angular/angular.js/issues/15631))
|
||||
- allow the usage of "$" in isolate scope property alias
|
||||
([7f2af3](https://github.com/angular/angular.js/commit/7f2af3f923e7a3f85c8862d0ed57d21c72eae904),
|
||||
[#15594](https://github.com/angular/angular.js/issues/15594))
|
||||
- **$location:** correctly handle external URL change during `$digest`
|
||||
([b60761](https://github.com/angular/angular.js/commit/b607618342d6c4fab364966fe05f152be6bd4d5f),
|
||||
[#11075](https://github.com/angular/angular.js/issues/11075),
|
||||
[#12571](https://github.com/angular/angular.js/issues/12571),
|
||||
[#15556](https://github.com/angular/angular.js/issues/15556),
|
||||
[#15561](https://github.com/angular/angular.js/issues/15561))
|
||||
- **$browser:** detect external changes in `history.state`
|
||||
([fa50fb](https://github.com/angular/angular.js/commit/fa50fbaf57b3437be7a410ecaba7008dbe0ef239))
|
||||
- **$resource:**
|
||||
- do not swallow errors in `success` callback
|
||||
([27146e](https://github.com/angular/angular.js/commit/27146e8a7fad54c1342179b6d291b1b5c2ebe816),
|
||||
[#15624](https://github.com/angular/angular.js/issues/15624),
|
||||
[#15628](https://github.com/angular/angular.js/issues/15628))
|
||||
- correctly unescape `/\.` even if `\.` comes from a param value
|
||||
([419a48](https://github.com/angular/angular.js/commit/419a4813e354496bdf0df44e3f8afaa198df1ab1),
|
||||
[#15627](https://github.com/angular/angular.js/issues/15627))
|
||||
- delete `$cancelRequest()` in `toJSON()`
|
||||
([086c5d](https://github.com/angular/angular.js/commit/086c5d0354db8cb3d106b9ff966fb48d6fb46ef8),
|
||||
[#15244](https://github.com/angular/angular.js/issues/15244))
|
||||
- **$animate:** correctly animate transcluded clones with `templateUrl`
|
||||
([f01212](https://github.com/angular/angular.js/commit/f01212ab5287ac7a154da7d75037ed444e81eb34),
|
||||
[#15510](https://github.com/angular/angular.js/issues/15510),
|
||||
[#15514](https://github.com/angular/angular.js/issues/15514))
|
||||
- **$route:** make asynchronous tasks count as pending requests
|
||||
([eb968c](https://github.com/angular/angular.js/commit/eb968c4a6884838db05369a04459066424c5bba8),
|
||||
[#14159](https://github.com/angular/angular.js/issues/14159))
|
||||
- **$parse:** make sure ES6 object computed properties are watched
|
||||
([5e418b](https://github.com/angular/angular.js/commit/5e418b1145a1045da598c7863e785d647ea83850),
|
||||
[#15678](https://github.com/angular/angular.js/issues/15678))
|
||||
- **$sniffer:** allow `history` for NW.js apps
|
||||
([4a593d](https://github.com/angular/angular.js/commit/4a593db79ba1e21a6aa600a82cf6d757cad94d01),
|
||||
[#15474](https://github.com/angular/angular.js/issues/15474),
|
||||
[#15633](https://github.com/angular/angular.js/issues/15633))
|
||||
- **input:** fix `step` validation for `input[type=number/range]`
|
||||
([c95a67](https://github.com/angular/angular.js/commit/c95a6737fbd277e40c064bd9f68f383bf119505c),
|
||||
[#15504](https://github.com/angular/angular.js/issues/15504),
|
||||
[#15506](https://github.com/angular/angular.js/issues/15506))
|
||||
- **select:** keep `ngModel` when selected option is recreated by `ngRepeat`
|
||||
([131af8](https://github.com/angular/angular.js/commit/131af8272d269a541d04cb522c264a91e0ec8b6a),
|
||||
[#15630](https://github.com/angular/angular.js/issues/15630),
|
||||
[#15632](https://github.com/angular/angular.js/issues/15632))
|
||||
- **ngValue:** correctly update the `value` property when `value` is undefined
|
||||
([05aab6](https://github.com/angular/angular.js/commit/05aab660ce74f526f2110d3b5faf9a5b4f4e664b)
|
||||
[#15603](https://github.com/angular/angular.js/issues/15603),
|
||||
[#15605](https://github.com/angular/angular.js/issues/15605))
|
||||
- **angularInit:** allow auto-bootstrapping from inline script
|
||||
([bb464d](https://github.com/angular/angular.js/commit/bb464d16b434b9e2de2fecf80c192d4741cba879),
|
||||
[#15567](https://github.com/angular/angular.js/issues/15567),
|
||||
[#15571](https://github.com/angular/angular.js/issues/15571))
|
||||
- **ngMockE2E:** ensure that mocked `$httpBackend` uses correct `$browser`
|
||||
([bd63b2](https://github.com/angular/angular.js/commit/bd63b2235cd410251cb83eebd9a47d3102830b6b),
|
||||
[#15593](https://github.com/angular/angular.js/issues/15593))
|
||||
|
||||
|
||||
## New Features
|
||||
- **ngModel:** add `$overrideModelOptions` support
|
||||
([2546c2](https://github.com/angular/angular.js/commit/2546c29f811b68eea4d68be7fa1c8f7bb562dc11),
|
||||
[#15415](https://github.com/angular/angular.js/issues/15415))
|
||||
- **$parse:** allow watching array/object literals with non-primitive values
|
||||
([25f008](https://github.com/angular/angular.js/commit/25f008f541d68b09efd7b428b648c6d4899e6972),
|
||||
[#15301](https://github.com/angular/angular.js/issues/15301))
|
||||
|
||||
|
||||
|
||||
<a name="1.5.11"></a>
|
||||
# 1.5.11 princely-quest (2017-01-13)
|
||||
|
||||
|
||||
## Bug Fixes
|
||||
- **$compile:** allow the usage of "$" in isolate scope property alias
|
||||
([e75fbc](https://github.com/angular/angular.js/commit/e75fbc494e6a0da6a9231b40bb0382431b62be07),
|
||||
[#15586](https://github.com/angular/angular.js/issues/15586),
|
||||
[#15594](https://github.com/angular/angular.js/issues/15594))
|
||||
- **angularInit:** allow auto-bootstraping from inline script
|
||||
([41aa91](https://github.com/angular/angular.js/commit/41aa9125b9aaf771addb250642f524a4e6f9d8d3),
|
||||
[#15567](https://github.com/angular/angular.js/issues/15567),
|
||||
[#15571](https://github.com/angular/angular.js/issues/15571))
|
||||
- **$resource:** delete `$cancelRequest()` in `toJSON()`
|
||||
([4f3858](https://github.com/angular/angular.js/commit/4f3858e7c371f87534397f45b9d002add33b00cc),
|
||||
[#15244](https://github.com/angular/angular.js/issues/15244))
|
||||
- **$$cookieReader:** correctly handle forbidden access to `document.cookie`
|
||||
([6933cf](https://github.com/angular/angular.js/commit/6933cf64fe51f54b10d1639f2b95bab3c1178df9),
|
||||
[#15523](https://github.com/angular/angular.js/issues/15523),
|
||||
[#15532](https://github.com/angular/angular.js/issues/15532))
|
||||
|
||||
|
||||
|
||||
<a name="1.6.1"></a>
|
||||
# 1.6.1 promise-rectification (2016-12-23)
|
||||
|
||||
|
||||
## Bug Fixes
|
||||
- **$q:** Add traceback to unhandled promise rejections
|
||||
([174cb4](https://github.com/angular/angular.js/commit/174cb4a8c81e25581da5b452c2bb43b0fa377a9b),
|
||||
[#14631](https://github.com/angular/angular.js/issues/14631))
|
||||
- **$$cookieReader:** correctly handle forbidden access to `document.cookie`
|
||||
([33f769](https://github.com/angular/angular.js/commit/33f769b0a1214055c16fb59adad4897bf53d62bf),
|
||||
[#15523](https://github.com/angular/angular.js/issues/15523))
|
||||
- **ngOptions:** do not unset the `selected` property unless necessary
|
||||
([bc4844](https://github.com/angular/angular.js/commit/bc4844d3b297d80aecef89aa1b32615024decedc),
|
||||
[#15477](https://github.com/angular/angular.js/issues/15477))
|
||||
- **ngModelOptions:** work correctly when on the template of `replace` directives
|
||||
([5f8ed6](https://github.com/angular/angular.js/commit/5f8ed63f2ab02ffb9c21bf9c29d27c851d162e26),
|
||||
[#15492](https://github.com/angular/angular.js/issues/15492))
|
||||
- **ngClassOdd/Even:** add/remove the correct classes when expression/`$index` change simultaneously
|
||||
([d52864](https://github.com/angular/angular.js/commit/d528644fe3e9ffd43999e7fc67806059f9e1083e))
|
||||
- **jqLite:** silently ignore `after()` if element has no parent
|
||||
([3d68b9](https://github.com/angular/angular.js/commit/3d68b9502848ff6714ef89bfb95b8e70ae34eff6),
|
||||
[#15331](https://github.com/angular/angular.js/issues/15331),
|
||||
[#15475](https://github.com/angular/angular.js/issues/15475))
|
||||
- **$rootScope:** when adding/removing watchers during $digest
|
||||
([163aca](https://github.com/angular/angular.js/commit/163aca336d7586a45255787af41b14b2a12361dd),
|
||||
[#15422](https://github.com/angular/angular.js/issues/15422))
|
||||
|
||||
|
||||
## Performance Improvements
|
||||
- **ngClass:** avoid unnecessary `.data()` accesses, deep-watching and copies
|
||||
([1d3b65](https://github.com/angular/angular.js/commit/1d3b65adc2c22ff662159ef910089cf10d1edb7b),
|
||||
[#14404](https://github.com/angular/angular.js/issues/14404))
|
||||
|
||||
|
||||
|
||||
<a name="1.5.10"></a>
|
||||
# 1.5.10 asynchronous-synchronization (2016-12-15)
|
||||
|
||||
|
||||
## Bug Fixes
|
||||
- **$compile:**
|
||||
- don't throw tplrt error when there is whitespace around a top-level comment
|
||||
([12752f](https://github.com/angular/angular.js/commit/12752f66ac425ab38a5ee574a4bfbf3516adc42c),
|
||||
[#15108](https://github.com/angular/angular.js/issues/15108))
|
||||
- clean up `@`-binding observers when re-assigning bindings
|
||||
([f3cb6e](https://github.com/angular/angular.js/commit/f3cb6e309aa1f676e5951ac745fa886d3581c2f4),
|
||||
[#15268](https://github.com/angular/angular.js/issues/15268))
|
||||
- set attribute value even if `ngAttr*` contains no interpolation
|
||||
([229799](https://github.com/angular/angular.js/commit/22979904fb754c59e9f6ee5d8763e3b8de0e18c2),
|
||||
[#15133](https://github.com/angular/angular.js/issues/15133))
|
||||
- `bindToController` should work without `controllerAs`
|
||||
([944989](https://github.com/angular/angular.js/commit/9449893763a4fd95ee8ff78b53c6966a874ec9ae),
|
||||
[#15088](https://github.com/angular/angular.js/issues/15088))
|
||||
- do not overwrite values set in `$onInit()` for `<`-bound literals
|
||||
([07e1ba](https://github.com/angular/angular.js/commit/07e1ba365fb5e8a049be732bd7b62f71e0aa1672),
|
||||
[#15118](https://github.com/angular/angular.js/issues/15118))
|
||||
- avoid calling `$onChanges()` twice for `NaN` initial values
|
||||
([0cf5be](https://github.com/angular/angular.js/commit/0cf5be52642f7e9d81a708b3005042eac6492572))
|
||||
- **$location:** prevent infinite digest with IDN urls in Edge
|
||||
([4bf892](https://github.com/angular/angular.js/commit/4bf89218130d434771089fdfe643490b8d2ee259),
|
||||
[#15217](https://github.com/angular/angular.js/issues/15217))
|
||||
- **$rootScope:** correctly handle adding/removing watchers during `$digest`
|
||||
([a9708d](https://github.com/angular/angular.js/commit/a9708de84b50f06eacda33834d5bbdfc97c97f37),
|
||||
[#15422](https://github.com/angular/angular.js/issues/15422))
|
||||
- **$sce:** fix `adjustMatcher` to replace multiple `*` and `**`
|
||||
([78eecb](https://github.com/angular/angular.js/commit/78eecb43dbb0500358d333aea8955bd0646a7790))
|
||||
- **jqLite:** silently ignore `after()` if element has no parent
|
||||
([77ed85](https://github.com/angular/angular.js/commit/77ed85bcd3be057a5a79231565ac7accc6d644c6),
|
||||
[#15331](https://github.com/angular/angular.js/issues/15331))
|
||||
- **input[radio]:** use non-strict comparison for checkedness
|
||||
([593a50](https://github.com/angular/angular.js/commit/593a5034841b3b7661d3bcbdd06b7a9d0876fd34))
|
||||
- **select, ngOptions:**
|
||||
- let `ngValue` take precedence over option text with multiple interpolations
|
||||
([5b7ec8](https://github.com/angular/angular.js/commit/5b7ec8c84e88ee08aacaf9404853eda0016093f5),
|
||||
[#15413](https://github.com/angular/angular.js/issues/15413))
|
||||
- don't add comment nodes as empty options
|
||||
([1d29c9](https://github.com/angular/angular.js/commit/1d29c91c3429de96e4103533752700d1266741be),
|
||||
[#15454](https://github.com/angular/angular.js/issues/15454))
|
||||
- **ngClassOdd/Even:** add/remove the correct classes when expression/`$index` change simultaneously
|
||||
([e3d020](https://github.com/angular/angular.js/commit/e3d02070ab8a02c818dcc5114db6fba9d3f385d6))
|
||||
- **$sanitize:** reduce stack height in IE <= 11
|
||||
([862dc2](https://github.com/angular/angular.js/commit/862dc2532f8126a4a71fd3d957884ba6f11f591c),
|
||||
[#14928](https://github.com/angular/angular.js/issues/14928))
|
||||
- **ngMock/$controller:** respect `$compileProvider.preAssignBindingsEnabled()`
|
||||
([75c83f](https://github.com/angular/angular.js/commit/75c83ff3195931859a099f7a95bf81d32abf2eb3))
|
||||
|
||||
|
||||
## New Features
|
||||
- **bootstrap:** do not bootstrap from unknown schemes with a different origin
|
||||
([bdeb33](https://github.com/angular/angular.js/commit/bdeb3392a8719131ab2b993f2a881c43a2860f92),
|
||||
[#15428](https://github.com/angular/angular.js/issues/15428))
|
||||
- **$anchorScroll:** convert numeric hash targets to string
|
||||
([a52640](https://github.com/angular/angular.js/commit/a5264090b66ad0cf9a93de84bb7b307868c0edef),
|
||||
[#14680](https://github.com/angular/angular.js/issues/14680))
|
||||
- **$compile:**
|
||||
- add `preAssignBindingsEnabled` option
|
||||
([f86576](https://github.com/angular/angular.js/commit/f86576def44005f180a66e3aa12d6cc73c1ac72c))
|
||||
- throw error when directive name or factory function is invalid
|
||||
([5c9399](https://github.com/angular/angular.js/commit/5c9399d18ae5cd79e6cf6fc4377d66df00f6fcc7),
|
||||
[#15056](https://github.com/angular/angular.js/issues/15056))
|
||||
- **$controller:** throw when requested controller is not registered
|
||||
([9ae793](https://github.com/angular/angular.js/commit/9ae793d8a69afe84370b601e07fc375fc18a576a),
|
||||
[#14980](https://github.com/angular/angular.js/issues/14980))
|
||||
- **$location:** add support for selectively rewriting links based on attribute
|
||||
([a4a222](https://github.com/angular/angular.js/commit/a4a22266f127d3b9a6818e6f4754f048e253f693))
|
||||
- **$resource:** pass `status`/`statusText` to success callbacks
|
||||
([a8da25](https://github.com/angular/angular.js/commit/a8da25c74d2c1f6265f0fafd95bf72c981d9d678),
|
||||
[#8341](https://github.com/angular/angular.js/issues/8841),
|
||||
[#8841](https://github.com/angular/angular.js/issues/8841))
|
||||
- **ngSwitch:** allow multiple case matches via optional attribute `ngSwitchWhenSeparator`
|
||||
([0e1651](https://github.com/angular/angular.js/commit/0e1651bfd28ba73ebd0e4943d85af48c4506e02c),
|
||||
[#3410](https://github.com/angular/angular.js/issues/3410),
|
||||
[#3516](https://github.com/angular/angular.js/issues/3516))
|
||||
|
||||
|
||||
## Performance Improvements
|
||||
- **all:** don't trigger digests after enter/leave of structural directives
|
||||
([c57779](https://github.com/angular/angular.js/commit/c57779d8725493c5853dceda0105dafd5c0e3a7c),
|
||||
[#15322](https://github.com/angular/angular.js/issues/15322))
|
||||
- **$compile:** validate `directive.restrict` property on directive init
|
||||
([31d464](https://github.com/angular/angular.js/commit/31d464feef38b1cc950da6c8dccd0f194ebfc68b))
|
||||
- **ngOptions:** avoid calls to `element.value`
|
||||
([e269ad](https://github.com/angular/angular.js/commit/e269ad1244bc50fee9218f7c18fab3e9ab063aab))
|
||||
- **jqLite:** move bind/unbind definitions out of the loop
|
||||
([7717b9](https://github.com/angular/angular.js/commit/7717b96e950a5916a5f12fd611c73d3b06a8d717))
|
||||
|
||||
|
||||
<a name="1.6.0"></a>
|
||||
# 1.6.0 rainbow-tsunami (2016-12-08)
|
||||
|
||||
@@ -8,14 +455,23 @@ consolidating all the changes shown in the previous 1.6.0 release candidates.**
|
||||
- **ngModelOptions:** allow options to be inherited from ancestor `ngModelOptions`
|
||||
([296cfc](https://github.com/angular/angular.js/commit/296cfce40c25e9438bfa46a0eb27240707a10ffa),
|
||||
[#10922](https://github.com/angular/angular.js/issues/10922))
|
||||
- **$compile:** set `preAssignBindingsEnabled` to false by default
|
||||
([bcd0d4](https://github.com/angular/angular.js/commit/bcd0d4d896d0dfdd988ff4f849c1d40366125858),
|
||||
[#15352](https://github.com/angular/angular.js/issues/15352))
|
||||
- **$compile:**
|
||||
- add `preAssignBindingsEnabled` option
|
||||
([dfb8cf](https://github.com/angular/angular.js/commit/dfb8cf6402678206132e5bc603764d21e0f986ef))
|
||||
- set `preAssignBindingsEnabled` to false by default
|
||||
([bcd0d4](https://github.com/angular/angular.js/commit/bcd0d4d896d0dfdd988ff4f849c1d40366125858),
|
||||
[#15352](https://github.com/angular/angular.js/issues/15352))
|
||||
- throw error when directive name or factory function is invalid
|
||||
([53a3bf](https://github.com/angular/angular.js/commit/53a3bf6634600c3aeff092eacc35edf399b27aec)
|
||||
[#15056](https://github.com/angular/angular.js/issues/15056))
|
||||
- **jqLite:**
|
||||
- implement `jqLite(f)` as an alias to `jqLite(document).ready(f)`
|
||||
([369fb7](https://github.com/angular/angular.js/commit/369fb7f4f73664bcdab0350701552d8bef6f605e))
|
||||
- don't throw for elements with missing `getAttribute`
|
||||
([4e6c14](https://github.com/angular/angular.js/commit/4e6c14dcae4a9a30b3610a288ef8d20db47c4417))
|
||||
- don't get/set properties when getting/setting boolean attributes
|
||||
([7ceb5f](https://github.com/angular/angular.js/commit/7ceb5f6fcc43d35d1b66c3151ce6a71c60309304),
|
||||
[#14126](https://github.com/angular/angular.js/issues/14126))
|
||||
- don't remove a boolean attribute for `.attr(attrName, '')`
|
||||
([3faf45](https://github.com/angular/angular.js/commit/3faf4505732758165083c9d21de71fa9b6983f4a))
|
||||
- remove the attribute for `.attr(attribute, null)`
|
||||
@@ -38,6 +494,9 @@ consolidating all the changes shown in the previous 1.6.0 release candidates.**
|
||||
- JSONP requests now require a trusted resource URL
|
||||
([6476af](https://github.com/angular/angular.js/commit/6476af83cd0418c84e034a955b12a842794385c4),
|
||||
[#11352](https://github.com/angular/angular.js/issues/11352))
|
||||
- **$anchorScroll:** convert numeric hash targets to string
|
||||
([9062ba](https://github.com/angular/angular.js/commit/9062bae05c002934fe7bfd76043dcc3de9acfde6)
|
||||
[#14680](https://github.com/angular/angular.js/issues/14680))
|
||||
- **select:** support values of any type added with `ngValue`
|
||||
([f02b70](https://github.com/angular/angular.js/commit/f02b707b5e4a5ffd1e1a20d910754cfabfc19622),
|
||||
[#9842](https://github.com/angular/angular.js/issues/9842))
|
||||
@@ -51,6 +510,10 @@ consolidating all the changes shown in the previous 1.6.0 release candidates.**
|
||||
[#10597](https://github.com/angular/angular.js/issues/10597))
|
||||
- allow `ngTrim` to work for `input[type=radio]`
|
||||
([47724b](https://github.com/angular/angular.js/commit/47724baffe050269385b3481e9a9cf4ab3944b4b))
|
||||
- **ngSwitch:** allow multiple case matches via optional attribute `ngSwitchWhenSeparator`
|
||||
([0b221](https://github.com/angular/angular.js/commit/0b22173000596bf4b78f6a90083b994d46164d79)
|
||||
[#3410](https://github.com/angular/angular.js/issues/3410)
|
||||
[#3516](https://github.com/angular/angular.js/issues/3516))
|
||||
- **$interpolate:** use custom `toString()` function if present
|
||||
([a5fd2e](https://github.com/angular/angular.js/commit/a5fd2e4c0376676fa317e09a8d8be4966b82cbfe),
|
||||
[#7317](https://github.com/angular/angular.js/issues/7317),
|
||||
@@ -66,18 +529,30 @@ consolidating all the changes shown in the previous 1.6.0 release candidates.**
|
||||
([c9dffd](https://github.com/angular/angular.js/commit/c9dffde1cb167660120753181cb6d01dc1d1b3d0),
|
||||
[#13653](https://github.com/angular/angular.js/issues/13653),
|
||||
[#7992](https://github.com/angular/angular.js/issues/7992))
|
||||
- **$location:** default hashPrefix to `'!'`
|
||||
([aa077e](https://github.com/angular/angular.js/commit/aa077e81129c740041438688dff2e8d20c3d7b52),
|
||||
[#13812](https://github.com/angular/angular.js/issues/13812))
|
||||
- **$resource:** pass `status`/`statusText` to success callbacks
|
||||
([e3a378](https://github.com/angular/angular.js/commit/e3a378e7a329f60f6b48517f83a4f4c9efecb056)
|
||||
[#8341](https://github.com/angular/angular.js/issues/8841)
|
||||
[#8841](https://github.com/angular/angular.js/issues/8841))
|
||||
- **$location:**
|
||||
- default hashPrefix to `'!'`
|
||||
([aa077e](https://github.com/angular/angular.js/commit/aa077e81129c740041438688dff2e8d20c3d7b52)
|
||||
[#13812](https://github.com/angular/angular.js/issues/13812))
|
||||
- add support for selectively rewriting links based on attribute
|
||||
([3d686a](https://github.com/angular/angular.js/commit/3d686a988dc4373da094cff6905e5b0d8da6afa4))
|
||||
- **$controller:** throw when requested controller is not registered
|
||||
([eacfe4](https://github.com/angular/angular.js/commit/eacfe4148eb97e550117ed7fd3c37b58537a9f64)
|
||||
[#14980](https://github.com/angular/angular.js/issues/14980))
|
||||
|
||||
|
||||
|
||||
## Security Related
|
||||
- Please read the [Sandbox Removal Blog Post](http://angularjs.blogspot.com/2016/09/angular-16-expression-sandbox-removal.html).
|
||||
- **bootstrap:** explicitly whitelist URL schemes for bootstrap. (#15427)
|
||||
([7f1b8b](https://github.com/angular/angular.js/commit/7f1b8bdfe1043871c5ead2ec602efc41e0de5e53))
|
||||
- **bootstrap:**
|
||||
- explicitly whitelist URL schemes for bootstrap.
|
||||
([7f1b8b](https://github.com/angular/angular.js/commit/7f1b8bdfe1043871c5ead2ec602efc41e0de5e53))
|
||||
- do not bootstrap from unknown schemes with a different origin
|
||||
([465d17](https://github.com/angular/angular.js/commit/465d1734559ca4a7f4aa24387060f88fcc53ecb1))
|
||||
([465d17](https://github.com/angular/angular.js/commit/465d1734559ca4a7f4aa24387060f88fcc53ecb1)
|
||||
[#15428](https://github.com/angular/angular.js/issues/15428))
|
||||
- **$compile:**
|
||||
- secure `link[href]` as a `RESOURCE_URL`s in `$sce`
|
||||
([04cad4](https://github.com/angular/angular.js/commit/04cad41d26ebaf44b5ee0c29a152d61f235f3efa),
|
||||
@@ -87,14 +562,18 @@ consolidating all the changes shown in the previous 1.6.0 release candidates.**
|
||||
|
||||
|
||||
## Bug Fixes
|
||||
- **$sce:** fix `adjustMatcher` to replace multiple '*' and '**' (#7897)
|
||||
- **$sce:** fix `adjustMatcher` to replace multiple `*` and `**`
|
||||
([991a2b](https://github.com/angular/angular.js/commit/991a2b30e00aed1d312e29555e356a795f9e3d62))
|
||||
- **ngModelOptions:** handle debounce of `updateOn` triggers that are not in debounce list
|
||||
([789790](https://github.com/angular/angular.js/commit/789790feee4d6c5b1f5d5b18ecb0ccf6edd36fb3))
|
||||
- **ngMock/$controller:** respect `$compileProvider.preAssignBindingsEnabled()`
|
||||
([7d9a79](https://github.com/angular/angular.js/commit/7d9a791c6a8c80d29d6c84afa287c81f2a307439))
|
||||
- **$location:** throw if the path starts with double (back)slashes
|
||||
([4aa953](https://github.com/angular/angular.js/commit/4aa9534b0fea732d6492a2863c3ee7e077c8d004))
|
||||
- **$location:**
|
||||
- prevent infinite digest with IDN URLs in Edge
|
||||
([705afc](https://github.com/angular/angular.js/commit/705afcd160c8428133b36f2cd63db305dc52f2d7)
|
||||
[#15217](https://github.com/angular/angular.js/issues/15217))
|
||||
- throw if the path starts with double (back)slashes
|
||||
([4aa953](https://github.com/angular/angular.js/commit/4aa9534b0fea732d6492a2863c3ee7e077c8d004))
|
||||
- **core:** do not auto-bootstrap when loaded from an extension.
|
||||
([0ff10e](https://github.com/angular/angular.js/commit/0ff10e1b56c6b7c4ac465e35c96a5886e294bac5))
|
||||
- **input[radio]:** use strict comparison when evaluating checked-ness
|
||||
@@ -124,6 +603,20 @@ consolidating all the changes shown in the previous 1.6.0 release candidates.**
|
||||
- don't throw tplrt error when there is a whitespace around a top-level comment
|
||||
([76d3da](https://github.com/angular/angular.js/commit/76d3dafdeaf2f343d094b5a34ffb74adf64bb284),
|
||||
[#15108](https://github.com/angular/angular.js/issues/15108))
|
||||
- clean up `@`-binding observers when re-assigning bindings
|
||||
([586e2a](https://github.com/angular/angular.js/commit/586e2acb269016a0fee66ac33f4a385f631afad0)
|
||||
[#15268](https://github.com/angular/angular.js/issues/15268))
|
||||
- set attribute value even if `ngAttr*` contains no interpolation
|
||||
([3fe3da](https://github.com/angular/angular.js/commit/3fe3da8794571a1479d884be26a621f06cdb7842)
|
||||
[#15133](https://github.com/angular/angular.js/issues/15133))
|
||||
- `bindToController` should work without `controllerAs`
|
||||
([16dcce](https://github.com/angular/angular.js/commit/16dccea8873b06285d4ec6eb3bb8e96ccbd3b64e)
|
||||
[#15088](https://github.com/angular/angular.js/issues/15088))
|
||||
- do not overwrite values set in `$onInit()` for `<`-bound literals
|
||||
([a1bdff](https://github.com/angular/angular.js/commit/a1bdffa12f82e838dee5492956b380df7e54cdf9)
|
||||
[#15118](https://github.com/angular/angular.js/issues/15118))
|
||||
- avoid calling `$onChanges()` twice for `NaN` initial values
|
||||
([7d7efb](https://github.com/angular/angular.js/commit/7d7efbf545c8c07713eb45301660dcfca4121445))
|
||||
- disallow linking the same element more than once
|
||||
([1e1fbc](https://github.com/angular/angular.js/commit/1e1fbc75f5e20e8541f517a5cf6f30f8f2eed53f))
|
||||
- correctly merge consecutive text nodes on IE11
|
||||
@@ -136,14 +629,14 @@ consolidating all the changes shown in the previous 1.6.0 release candidates.**
|
||||
[#5513](https://github.com/angular/angular.js/issues/5513),
|
||||
[#5597](https://github.com/angular/angular.js/issues/5597))
|
||||
- move check for interpolation of on-event attributes to compile time
|
||||
([b89c21](https://github.com/angular/angular.js/commit/b89c2181a9a165e06c027390164e08635ec449f4),
|
||||
[#13267](https://github.com/angular/angular.js/issues/13267))
|
||||
([b89c21](https://github.com/angular/angular.js/commit/b89c2181a9a165e06c027390164e08635ec449f4),
|
||||
[#13267](https://github.com/angular/angular.js/issues/13267))
|
||||
- **select, ngOptions, ngValue:**
|
||||
- don't add comment nodes as empty options
|
||||
([245b27](https://github.com/angular/angular.js/commit/245b27101aad129061585252b73652054319ca82),
|
||||
[#15454](https://github.com/angular/angular.js/issues/15454))
|
||||
- do not throw when removing the element (e.g. via `ngIf`)
|
||||
([7a667c](https://github.com/angular/angular.js/commit/7a667c77e36f2b1738425a9cfb52d48bb9d8220f))
|
||||
([7a667c](https://github.com/angular/angular.js/commit/7a667c77e36f2b1738425a9cfb52d48bb9d8220f))
|
||||
- add/remove selected attribute for selected/unselected options
|
||||
([c75698](https://github.com/angular/angular.js/commit/c75698df55f5a026bcd7fcecbb9d4ff0bc3ebc3e))
|
||||
- don't register options when select has no ngModel
|
||||
@@ -158,7 +651,7 @@ consolidating all the changes shown in the previous 1.6.0 release candidates.**
|
||||
([e6afca](https://github.com/angular/angular.js/commit/e6afca00c9061a3e13b570796ca3ab428c1723a1),
|
||||
[#14031](https://github.com/angular/angular.js/issues/14031))
|
||||
- **$resource:**
|
||||
- **$resource:** allow params in `hostname` (except for IPv6 addresses)
|
||||
- allow params in `hostname` (except for IPv6 addresses)
|
||||
([752b1e](https://github.com/angular/angular.js/commit/752b1e69b7a8e9c0b908f1980e9c738888f3647c),
|
||||
[#14542](https://github.com/angular/angular.js/issues/14542))
|
||||
- fulfill promise with the correct value on error
|
||||
@@ -202,6 +695,9 @@ consolidating all the changes shown in the previous 1.6.0 release candidates.**
|
||||
- **loader:** `module.decorator` order of operations is now irrelevant
|
||||
([6a2ebd](https://github.com/angular/angular.js/commit/6a2ebdba5df27e789e3cb10f11eedf90f7b9b97e),
|
||||
[#12382](https://github.com/angular/angular.js/issues/12382))
|
||||
- **$sanitize:** reduce stack height in IE <= 11
|
||||
([45129c](https://github.com/angular/angular.js/commit/45129cfd06104bd89f469dded9ccbaf20894bd76)
|
||||
[#14928](https://github.com/angular/angular.js/issues/14928))
|
||||
- **ngAnimate:** make svg elements work with `classNameFilter`
|
||||
([81bf7e](https://github.com/angular/angular.js/commit/81bf7ed73ee67f9eb997da869c52839449ca02b3))
|
||||
|
||||
@@ -221,8 +717,11 @@ consolidating all the changes shown in the previous 1.6.0 release candidates.**
|
||||
([d71dc2](https://github.com/angular/angular.js/commit/d71dc2f5afec230711351e9f160873a41eb60597))
|
||||
- **injector:** cache the results of the native class detection check
|
||||
([5ceb5d](https://github.com/angular/angular.js/commit/5ceb5dbfa6d9b6d15232a1f5c767b2f431325948))
|
||||
- **$compile:** use strict comparison for `controller === '@'`
|
||||
([bbd3db](https://github.com/angular/angular.js/commit/bbd3db14f857aab996ad129f2f15ca6348e9fd9f))
|
||||
- **$compile:**
|
||||
- use strict comparison for `controller === '@'`
|
||||
([bbd3db](https://github.com/angular/angular.js/commit/bbd3db14f857aab996ad129f2f15ca6348e9fd9f))
|
||||
- validate `directive.restrict` property on directive init
|
||||
([11f273](https://github.com/angular/angular.js/commit/11f2731f72e932615e8ce15e6a73f4ac808cc7e7))
|
||||
- **$parse:**
|
||||
- Inline constants
|
||||
([bd7d5f](https://github.com/angular/angular.js/commit/bd7d5f6345439aa2d1da708ffee20b4c565131d4))
|
||||
@@ -236,10 +735,10 @@ consolidating all the changes shown in the previous 1.6.0 release candidates.**
|
||||
- **feat($compile): set preAssignBindingsEnabled to false by default
|
||||
([bcd0d4](https://github.com/angular/angular.js/commit/bcd0d4d896d0dfdd988ff4f849c1d40366125858))**:
|
||||
|
||||
Previously, `$compileProvider.preAssignBindingsEnabled` was
|
||||
set to true by default. This means bindings were pre-assigned in component
|
||||
constructors. In Angular 1.5+ the place to put the initialization logic
|
||||
relying on bindings being present is the controller `$onInit` method.
|
||||
Previously, `$compileProvider.preAssignBindingsEnabled` was set to true by default. This means
|
||||
bindings were pre-assigned on component/directive controller instances (which made them available
|
||||
inside the constructors). In AngularJS 1.5+ the place to put the initialization logic relying on
|
||||
bindings being present is the controller's `$onInit` method.
|
||||
|
||||
To migrate follow the example below:
|
||||
|
||||
@@ -452,6 +951,48 @@ var bgColor = elem.css('background-color');
|
||||
var bgColor = elem.css('backgroundColor');
|
||||
```
|
||||
|
||||
- **[7ceb5f](https://github.com/angular/angular.js/commit/7ceb5f6fcc43d35d1b66c3151ce6a71c60309304)**: don't get/set properties when getting/setting boolean attributes
|
||||
|
||||
Previously, all boolean attributes were reflected into the corresponding property when calling a
|
||||
setter and from the corresponding property when calling a getter, even on elements that don't treat
|
||||
those attributes in a special way. Now Angular doesn't do it by itself, but relies on browsers to
|
||||
know when to reflect the property. Note that this browser-level conversion differs between browsers;
|
||||
if you need to dynamically change the state of an element, you should modify the property, not the
|
||||
attribute. See https://jquery.com/upgrade-guide/1.9/#attr-versus-prop- for a more detailed
|
||||
description about a related change in jQuery 1.9.
|
||||
|
||||
This change aligns jqLite with jQuery 3. To migrate the code follow the example below:
|
||||
|
||||
Before:
|
||||
|
||||
CSS:
|
||||
|
||||
```css
|
||||
input[checked="checked"] { ... }
|
||||
```
|
||||
|
||||
JS:
|
||||
|
||||
```js
|
||||
elem1.attr('checked', 'checked');
|
||||
elem2.attr('checked', false);
|
||||
```
|
||||
|
||||
After:
|
||||
|
||||
CSS:
|
||||
|
||||
```css
|
||||
input:checked { ... }
|
||||
```
|
||||
|
||||
JS:
|
||||
|
||||
```js
|
||||
elem1.prop('checked', true);
|
||||
elem2.prop('checked', false);
|
||||
```
|
||||
|
||||
- **[3faf45](https://github.com/angular/angular.js/commit/3faf4505732758165083c9d21de71fa9b6983f4a)**:
|
||||
don't remove a boolean attribute for `.attr(attrName, '')`
|
||||
|
||||
@@ -778,7 +1319,7 @@ You configure this list in a module configuration block:
|
||||
|
||||
```js
|
||||
appModule.config(['$sceDelegateProvider', function($sceDelegateProvider) {
|
||||
$sceDelegateProvider.resourceUrlWhiteList([
|
||||
$sceDelegateProvider.resourceUrlWhitelist([
|
||||
// Allow same origin resource loads.
|
||||
'self',
|
||||
// Allow JSONP calls that match this pattern
|
||||
@@ -875,7 +1416,7 @@ previous behaviour simply add a comment:
|
||||
**Note:** Everything described below affects **IE11 only**.
|
||||
|
||||
Previously, consecutive text nodes would not get merged if they had no parent. They will now, which
|
||||
might have unexpectd side effects in the following cases:
|
||||
might have unexpected side effects in the following cases:
|
||||
|
||||
1. Passing an array or jqLite/jQuery collection of parent-less text nodes to `$compile` directly:
|
||||
|
||||
@@ -1029,7 +1570,7 @@ In cases where `ngView` was loaded asynchronously, `$route` (and its dependencie
|
||||
might also have been instantiated asynchronously. After this change, `$route` (and its dependencies)
|
||||
will - by default - be instantiated early on.
|
||||
|
||||
Although this is not expected to have unwanted side-effects in normal application bebavior, it may
|
||||
Although this is not expected to have unwanted side-effects in normal application behavior, it may
|
||||
affect your unit tests: When testing a module that (directly or indirectly) depends on `ngRoute`, a
|
||||
request will be made for the default route's template. If not properly "trained", `$httpBackend`
|
||||
will complain about this unexpected request.
|
||||
@@ -1396,7 +1937,7 @@ validation), you can overwrite the built-in `step` validator with a custom direc
|
||||
# 1.5.9 timeturning-lockdown (2016-11-24)
|
||||
|
||||
This is an interim release primarily to publish some security fixes, in particular a modification to
|
||||
ensure that Angular 1 can pass the linter checks for Mozilla add-ons.
|
||||
ensure that AngularJS can pass the linter checks for Mozilla add-ons.
|
||||
|
||||
## Security Fixes
|
||||
- **bootstrap:**
|
||||
@@ -1484,7 +2025,7 @@ ensure that Angular 1 can pass the linter checks for Mozilla add-ons.
|
||||
|
||||
Previously, `$compileProvider.preAssignBindingsEnabled` was
|
||||
set to true by default. This means bindings were pre-assigned in component
|
||||
constructors. In Angular 1.5+ the place to put the initialization logic
|
||||
constructors. In AngularJS 1.5+ the place to put the initialization logic
|
||||
relying on bindings being present is the controller `$onInit` method.
|
||||
|
||||
To migrate follow the example below:
|
||||
@@ -1595,6 +2136,7 @@ Please read the [Sandbox Removal Blog Post](http://angularjs.blogspot.com/2016/0
|
||||
- **ngModel:** treat synchronous validators as boolean always ([7bc71a](https://github.com/angular/angular.js/commit/7bc71adc63bb6bb609b44dd2d3ea8fb0cd3f300b) [#14734](https://github.com/angular/angular.js/issues/14734))
|
||||
- **$q:** treat thrown errors as regular rejections ([e13eea](https://github.com/angular/angular.js/commit/e13eeabd7e34a78becec06cfbe72c23f2dcb85f9) [#3174](https://github.com/angular/angular.js/issues/3174) [#15213](https://github.com/angular/angular.js/issues/15213))
|
||||
- **ngTransclude:** use fallback content if only whitespace is provided ([32aa7e](https://github.com/angular/angular.js/commit/32aa7e7395527624119e3917c54ee43b4d219301) [#15077](https://github.com/angular/angular.js/issues/15077))
|
||||
- **$location:** prevent infinite digest with IDN URLs in Edge ([705afc](https://github.com/angular/angular.js/commit/705afcd160c8428133b36f2cd63db305dc52f2d7) [#15217](https://github.com/angular/angular.js/issues/15217))
|
||||
- **$compile:**
|
||||
- don't throw tplrt error when there is a whitespace around a top-level comment ([76d3da](https://github.com/angular/angular.js/commit/76d3dafdeaf2f343d094b5a34ffb74adf64bb284) [#15108](https://github.com/angular/angular.js/issues/15108))
|
||||
- disallow linking the same element more than once ([1e1fbc](https://github.com/angular/angular.js/commit/1e1fbc75f5e20e8541f517a5cf6f30f8f2eed53f))
|
||||
@@ -1604,6 +2146,20 @@ Please read the [Sandbox Removal Blog Post](http://angularjs.blogspot.com/2016/0
|
||||
- don't add leading white-space in attributes for a specific merge case ([305ba1](https://github.com/angular/angular.js/commit/305ba1a3fb3529cb3fdf04c12ac03fbb4f634456))
|
||||
- don't trim white-space in attributes ([97bbf8](https://github.com/angular/angular.js/commit/97bbf86a1979d099802f0d631c17c54b87563b40) [#5513](https://github.com/angular/angular.js/issues/5513) [#5597](https://github.com/angular/angular.js/issues/5597))
|
||||
- move check for interpolation of on-event attributes to compile time ([b89c21](https://github.com/angular/angular.js/commit/b89c2181a9a165e06c027390164e08635ec449f4) [#13267](https://github.com/angular/angular.js/issues/13267))
|
||||
- clean up `@`-binding observers when re-assigning bindings
|
||||
([586e2a](https://github.com/angular/angular.js/commit/586e2acb269016a0fee66ac33f4a385f631afad0)
|
||||
[#15268](https://github.com/angular/angular.js/issues/15268))
|
||||
- set attribute value even if `ngAttr*` contains no interpolation
|
||||
([3fe3da](https://github.com/angular/angular.js/commit/3fe3da8794571a1479d884be26a621f06cdb7842)
|
||||
[#15133](https://github.com/angular/angular.js/issues/15133))
|
||||
- `bindToController` should work without `controllerAs`
|
||||
([16dcce](https://github.com/angular/angular.js/commit/16dccea8873b06285d4ec6eb3bb8e96ccbd3b64e)
|
||||
[#15088](https://github.com/angular/angular.js/issues/15088))
|
||||
- do not overwrite values set in `$onInit()` for `<`-bound literals
|
||||
([a1bdff](https://github.com/angular/angular.js/commit/a1bdffa12f82e838dee5492956b380df7e54cdf9)
|
||||
[#15118](https://github.com/angular/angular.js/issues/15118))
|
||||
- avoid calling `$onChanges()` twice for `NaN` initial values
|
||||
([7d7efb](https://github.com/angular/angular.js/commit/7d7efbf545c8c07713eb45301660dcfca4121445))
|
||||
- **select:**
|
||||
- add/remove selected attribute for selected/unselected options ([c75698](https://github.com/angular/angular.js/commit/c75698df55f5a026bcd7fcecbb9d4ff0bc3ebc3e))
|
||||
- don't register options when select has no ngModel ([e8c2e1](https://github.com/angular/angular.js/commit/e8c2e119758e58e18fe43932d09a8ff9f506aa9d))
|
||||
@@ -1627,6 +2183,9 @@ Please read the [Sandbox Removal Blog Post](http://angularjs.blogspot.com/2016/0
|
||||
- **ngMock/$httpBackend:** fail if a url is provided but is `undefined` ([7551b8](https://github.com/angular/angular.js/commit/7551b8975a91ee286cc2cf4af5e78f924533575e) [#8442](https://github.com/angular/angular.js/issues/8442) [#10934](https://github.com/angular/angular.js/issues/10934))
|
||||
- **$route:** don't process route change controllers and templates for `redirectTo` routes ([7f4b35](https://github.com/angular/angular.js/commit/7f4b356c2bebb87f0c26b57a20415b004b20bcd1) [#3332](https://github.com/angular/angular.js/issues/3332))
|
||||
- **loader:** `module.decorator` order of operations is now irrelevant ([6a2ebd](https://github.com/angular/angular.js/commit/6a2ebdba5df27e789e3cb10f11eedf90f7b9b97e) [#12382](https://github.com/angular/angular.js/issues/12382))
|
||||
- **$sanitize:** reduce stack height in IE <= 11
|
||||
([45129c](https://github.com/angular/angular.js/commit/45129cfd06104bd89f469dded9ccbaf20894bd76)
|
||||
[#14928](https://github.com/angular/angular.js/issues/14928))
|
||||
- **ngAnimate:** make svg elements work with `classNameFilter` ([81bf7e](https://github.com/angular/angular.js/commit/81bf7ed73ee67f9eb997da869c52839449ca02b3))
|
||||
|
||||
|
||||
@@ -1634,24 +2193,50 @@ Please read the [Sandbox Removal Blog Post](http://angularjs.blogspot.com/2016/0
|
||||
- **jqLite:**
|
||||
- implement `jqLite(f)` as an alias to `jqLite(document).ready(f)` ([369fb7](https://github.com/angular/angular.js/commit/369fb7f4f73664bcdab0350701552d8bef6f605e))
|
||||
- don't throw for elements with missing `getAttribute` ([4e6c14](https://github.com/angular/angular.js/commit/4e6c14dcae4a9a30b3610a288ef8d20db47c4417))
|
||||
- don't get/set properties when getting/setting boolean attributes ([7ceb5f](https://github.com/angular/angular.js/commit/7ceb5f6fcc43d35d1b66c3151ce6a71c60309304), [#14126](https://github.com/angular/angular.js/issues/14126))
|
||||
- don't remove a boolean attribute for `.attr(attrName, '')` ([3faf45](https://github.com/angular/angular.js/commit/3faf4505732758165083c9d21de71fa9b6983f4a))
|
||||
- remove the attribute for `.attr(attribute, null)` ([4e3624](https://github.com/angular/angular.js/commit/4e3624552284d0e725bf6262b2e468cd2c7682fa))
|
||||
- return `[]` for `.val()` on `<select multiple>` with no selection ([d882fd](https://github.com/angular/angular.js/commit/d882fde2e532216e7cf424495db1ccb5be1789f8))
|
||||
- **$compile:**
|
||||
- add `preAssignBindingsEnabled` option
|
||||
([dfb8cf](https://github.com/angular/angular.js/commit/dfb8cf6402678206132e5bc603764d21e0f986ef))
|
||||
- throw error when directive name or factory function is invalid
|
||||
([53a3bf](https://github.com/angular/angular.js/commit/53a3bf6634600c3aeff092eacc35edf399b27aec)
|
||||
[#15056](https://github.com/angular/angular.js/issues/15056))
|
||||
- **$http:**
|
||||
- remove deprecated callback methods: `success()/error()` ([b54a39](https://github.com/angular/angular.js/commit/b54a39e2029005e0572fbd2ac0e8f6a4e5d69014))
|
||||
- JSONP callback must be specified by `jsonpCallbackParam` config ([fb6634](https://github.com/angular/angular.js/commit/fb663418710736161a6b5da49c345e92edf58dcb) [#15161](https://github.com/angular/angular.js/issues/15161) [#11352](https://github.com/angular/angular.js/issues/11352))
|
||||
- JSONP requests now require a trusted resource URL ([6476af](https://github.com/angular/angular.js/commit/6476af83cd0418c84e034a955b12a842794385c4) [#11352](https://github.com/angular/angular.js/issues/11352))
|
||||
- **$anchorScroll:** convert numeric hash targets to string
|
||||
([9062ba](https://github.com/angular/angular.js/commit/9062bae05c002934fe7bfd76043dcc3de9acfde6)
|
||||
[#14680](https://github.com/angular/angular.js/issues/14680))
|
||||
- **ngModelOptions:** allow options to be inherited from ancestor `ngModelOptions` ([87a2ff](https://github.com/angular/angular.js/commit/87a2ff76af5d0a9268d8eb84db5755077d27c84c) [#10922](https://github.com/angular/angular.js/issues/10922))
|
||||
- **input:**
|
||||
- add support for binding to `input[type=range]` ([913016](https://github.com/angular/angular.js/commit/9130166767c4792c5d32d08a918fc7becf32c9a6) [#5892](https://github.com/angular/angular.js/issues/5892) [#14870](https://github.com/angular/angular.js/issues/14870))
|
||||
- add support for `step` to `input[type=number]` ([e1da4be](https://github.com/angular/angular.js/commit/e1da4bed8e291003d485a8ad346ab80bed8ae2e3) [#10597](https://github.com/angular/angular.js/issues/10597))
|
||||
- allow `ngTrim` to work for `input[type=radio]` ([47724b](https://github.com/angular/angular.js/commit/47724baffe050269385b3481e9a9cf4ab3944b4b))
|
||||
- **ngSwitch:** allow multiple case matches via optional attribute `ngSwitchWhenSeparator`
|
||||
([0b221](https://github.com/angular/angular.js/commit/0b22173000596bf4b78f6a90083b994d46164d79)
|
||||
[#3410](https://github.com/angular/angular.js/issues/3410)
|
||||
[#3516](https://github.com/angular/angular.js/issues/3516))
|
||||
- **ngRoute:** allow `ngView` to be included in an asynchronously loaded template ([c13c66](https://github.com/angular/angular.js/commit/c13c666728c1a1485ef18e92d7cb35118ce39609) [#1213](https://github.com/angular/angular.js/issues/1213))
|
||||
- **select:** support values of any type added with `ngValue` ([f02b70](https://github.com/angular/angular.js/commit/f02b707b5e4a5ffd1e1a20d910754cfabfc19622) [#9842](https://github.com/angular/angular.js/issues/9842))
|
||||
- **$interpolate:** use custom `toString()` function if present ([a5fd2e](https://github.com/angular/angular.js/commit/a5fd2e4c0376676fa317e09a8d8be4966b82cbfe) [#7317](https://github.com/angular/angular.js/issues/7317) [#11406](https://github.com/angular/angular.js/issues/11406))
|
||||
- **$route:** implement `resolveRedirectTo` ([e98656](https://github.com/angular/angular.js/commit/e9865654b39c71be71034c38581a8c7bd16bc716) [#5150](https://github.com/angular/angular.js/issues/5150))
|
||||
- **$q:** report promises with non rejection callback ([c9dffd](https://github.com/angular/angular.js/commit/c9dffde1cb167660120753181cb6d01dc1d1b3d0) [#13653](https://github.com/angular/angular.js/issues/13653) [#7992](https://github.com/angular/angular.js/issues/7992))
|
||||
- **$location:** default hashPrefix to `'!'` ([aa077e](https://github.com/angular/angular.js/commit/aa077e81129c740041438688dff2e8d20c3d7b52) [#13812](https://github.com/angular/angular.js/issues/13812))
|
||||
- **$resource:** pass `status`/`statusText` to success callbacks
|
||||
([e3a378](https://github.com/angular/angular.js/commit/e3a378e7a329f60f6b48517f83a4f4c9efecb056)
|
||||
[#8341](https://github.com/angular/angular.js/issues/8841)
|
||||
[#8841](https://github.com/angular/angular.js/issues/8841))
|
||||
- **$location:**
|
||||
- default hashPrefix to `'!'`
|
||||
([aa077e](https://github.com/angular/angular.js/commit/aa077e81129c740041438688dff2e8d20c3d7b52)
|
||||
[#13812](https://github.com/angular/angular.js/issues/13812))
|
||||
- add support for selectively rewriting links based on attribute
|
||||
([3d686a](https://github.com/angular/angular.js/commit/3d686a988dc4373da094cff6905e5b0d8da6afa4))
|
||||
- **$controller:** throw when requested controller is not registered
|
||||
([eacfe4](https://github.com/angular/angular.js/commit/eacfe4148eb97e550117ed7fd3c37b58537a9f64)
|
||||
[#14980](https://github.com/angular/angular.js/issues/14980))
|
||||
|
||||
|
||||
## Performance Improvements
|
||||
@@ -1660,7 +2245,11 @@ Please read the [Sandbox Removal Blog Post](http://angularjs.blogspot.com/2016/0
|
||||
- **$animate:** listen for document visibility changes ([d71dc2](https://github.com/angular/angular.js/commit/d71dc2f5afec230711351e9f160873a41eb60597))
|
||||
- **injector:** cache the results of the native class detection check ([5ceb5d](https://github.com/angular/angular.js/commit/5ceb5dbfa6d9b6d15232a1f5c767b2f431325948))
|
||||
- **$parse:** Inline constants ([bd7d5f](https://github.com/angular/angular.js/commit/bd7d5f6345439aa2d1da708ffee20b4c565131d4))
|
||||
- **$compile:** use strict comparison for `controller === '@'` ([bbd3db](https://github.com/angular/angular.js/commit/bbd3db14f857aab996ad129f2f15ca6348e9fd9f))
|
||||
- **$compile:**
|
||||
- use strict comparison for `controller === '@'`
|
||||
([bbd3db](https://github.com/angular/angular.js/commit/bbd3db14f857aab996ad129f2f15ca6348e9fd9f))
|
||||
- validate `directive.restrict` property on directive init
|
||||
([11f273](https://github.com/angular/angular.js/commit/11f2731f72e932615e8ce15e6a73f4ac808cc7e7))
|
||||
- **$parse:** remove Angular expression sandbox ([1547c7](https://github.com/angular/angular.js/commit/1547c751aa48efe7dbefef701c3df5983b04aa2e) [#15094](https://github.com/angular/angular.js/issues/15094))
|
||||
|
||||
|
||||
@@ -1782,6 +2371,48 @@ var bgColor = elem.css('background-color');
|
||||
var bgColor = elem.css('backgroundColor');
|
||||
```
|
||||
|
||||
- **[7ceb5f](https://github.com/angular/angular.js/commit/7ceb5f6fcc43d35d1b66c3151ce6a71c60309304)**: don't get/set properties when getting/setting boolean attributes
|
||||
|
||||
Previously, all boolean attributes were reflected into the corresponding property when calling a
|
||||
setter and from the corresponding property when calling a getter, even on elements that don't treat
|
||||
those attributes in a special way. Now Angular doesn't do it by itself, but relies on browsers to
|
||||
know when to reflect the property. Note that this browser-level conversion differs between browsers;
|
||||
if you need to dynamically change the state of an element, you should modify the property, not the
|
||||
attribute. See https://jquery.com/upgrade-guide/1.9/#attr-versus-prop- for a more detailed
|
||||
description about a related change in jQuery 1.9.
|
||||
|
||||
This change aligns jqLite with jQuery 3. To migrate the code follow the example below:
|
||||
|
||||
Before:
|
||||
|
||||
CSS:
|
||||
|
||||
```css
|
||||
input[checked="checked"] { ... }
|
||||
```
|
||||
|
||||
JS:
|
||||
|
||||
```js
|
||||
elem1.attr('checked', 'checked');
|
||||
elem2.attr('checked', false);
|
||||
```
|
||||
|
||||
After:
|
||||
|
||||
CSS:
|
||||
|
||||
```css
|
||||
input:checked { ... }
|
||||
```
|
||||
|
||||
JS:
|
||||
|
||||
```js
|
||||
elem1.prop('checked', true);
|
||||
elem2.prop('checked', false);
|
||||
```
|
||||
|
||||
- **[3faf45](https://github.com/angular/angular.js/commit/3faf4505732758165083c9d21de71fa9b6983f4a)**: don't remove a boolean attribute for `.attr(attrName, '')`
|
||||
|
||||
Before, using the `attr` method with an empty string as a value
|
||||
@@ -2099,7 +2730,7 @@ You configure this list in a module configuration block:
|
||||
|
||||
```js
|
||||
appModule.config(['$sceDelegateProvider', function($sceDelegateProvider) {
|
||||
$sceDelegateProvider.resourceUrlWhiteList([
|
||||
$sceDelegateProvider.resourceUrlWhitelist([
|
||||
// Allow same origin resource loads.
|
||||
'self',
|
||||
// Allow JSONP calls that match this pattern
|
||||
@@ -2215,7 +2846,7 @@ affects custom directives that might have been reading options for their own pur
|
||||
**Note:** Everything described below affects **IE11 only**.
|
||||
|
||||
Previously, consecutive text nodes would not get merged if they had no parent. They will now, which
|
||||
might have unexpectd side effects in the following cases:
|
||||
might have unexpected side effects in the following cases:
|
||||
|
||||
1. Passing an array or jqLite/jQuery collection of parent-less text nodes to `$compile` directly:
|
||||
|
||||
@@ -2365,7 +2996,7 @@ In cases where `ngView` was loaded asynchronously, `$route` (and its dependencie
|
||||
might also have been instantiated asynchronously. After this change, `$route` (and its dependencies)
|
||||
will - by default - be instantiated early on.
|
||||
|
||||
Although this is not expected to have unwanted side-effects in normal application bebavior, it may
|
||||
Although this is not expected to have unwanted side-effects in normal application behavior, it may
|
||||
affect your unit tests: When testing a module that (directly or indirectly) depends on `ngRoute`, a
|
||||
request will be made for the default route's template. If not properly "trained", `$httpBackend`
|
||||
will complain about this unexpected request.
|
||||
@@ -4273,6 +4904,7 @@ support asynchronous loading of resources.)
|
||||
|
||||
- **$compile:** Lazily compile the `transclude` function
|
||||
([652b83eb](https://github.com/angular/angular.js/commit/652b83eb226131d131a44453520a569202aa4aac))
|
||||
See https://github.com/angular/angular.js/issues/14343#issuecomment-229037252 for more information.
|
||||
|
||||
|
||||
## Breaking Changes
|
||||
@@ -4507,12 +5139,12 @@ before the $parsers are applied. Previously, the modelValue
|
||||
|
||||
This fixes issues where `input[date]` and `input[number]` cannot
|
||||
be validated because the viewValue string is parsed into
|
||||
`Date` and `Number` respectively (starting with Angular 1.3).
|
||||
`Date` and `Number` respectively (starting with AngularJS 1.3).
|
||||
It also brings the directives in line with HTML5 constraint
|
||||
validation, which validates against the input value.
|
||||
|
||||
This change is unlikely to cause applications to fail, because even
|
||||
in Angular 1.2, the value that was validated by pattern could have
|
||||
in AngularJS 1.2, the value that was validated by pattern could have
|
||||
been manipulated by the $parsers, as all validation was done
|
||||
inside this pipeline.
|
||||
|
||||
@@ -4623,12 +5255,12 @@ before the $parsers are applied. Previously, the modelValue
|
||||
|
||||
This fixes issues where `input[date]` and `input[number]` cannot
|
||||
be validated because the viewValue string is parsed into
|
||||
`Date` and `Number` respectively (starting with Angular 1.3).
|
||||
`Date` and `Number` respectively (starting with AngularJS 1.3).
|
||||
It also brings the directives in line with HTML5 constraint
|
||||
validation, which validates against the input value.
|
||||
|
||||
This change is unlikely to cause applications to fail, because even
|
||||
in Angular 1.2, the value that was validated by pattern could have
|
||||
in AngularJS 1.2, the value that was validated by pattern could have
|
||||
been manipulated by the $parsers, as all validation was done
|
||||
inside this pipeline.
|
||||
|
||||
@@ -4842,7 +5474,7 @@ describe('$q.when', function() {
|
||||
it('should not need a call to $timeout.flush() to resolve already resolved promises',
|
||||
inject(function($q, $timeout) {
|
||||
$q.when('foo');
|
||||
// In Angular 1.4.3 a call to `$timeout.flush();` was needed
|
||||
// In AngularJS 1.4.3 a call to `$timeout.flush();` was needed
|
||||
$timeout.verifyNoPendingTasks();
|
||||
}));
|
||||
|
||||
@@ -6318,7 +6950,7 @@ it is now implemented in the ngOptions directive itself.
|
||||
the `select` directive will now use strict comparison of the `ngModel` scope value against `option`
|
||||
values to determine which option is selected. This means `Number` scope values will not be matched
|
||||
against numeric option strings.
|
||||
In Angular 1.3.x, setting `scope.x = 200` would select the `option` with the value 200 in the following `select`:
|
||||
In AngularJS 1.3.x, setting `scope.x = 200` would select the `option` with the value 200 in the following `select`:
|
||||
|
||||
```
|
||||
<select ng-model="x">
|
||||
@@ -6327,7 +6959,7 @@ In Angular 1.3.x, setting `scope.x = 200` would select the `option` with the val
|
||||
</select>
|
||||
```
|
||||
|
||||
In Angular 1.4.x, the 'unknown option' will be selected.
|
||||
In AngularJS 1.4.x, the 'unknown option' will be selected.
|
||||
To remedy this, you can simply initialize the model as a string: `scope.x = '200'`, or if you want to
|
||||
keep the model as a `Number`, you can do the conversion via `$formatters` and `$parsers` on `ngModel`:
|
||||
|
||||
@@ -12079,7 +12711,7 @@ Contains only these fixes cherry-picked from [v1.2.0rc1](#1.2.0rc1).
|
||||
- due to [39841f2e](https://github.com/angular/angular.js/commit/39841f2ec9b17b3b2920fd1eb548d444251f4f56),
|
||||
Interpolations inside DOM event handlers are disallowed.
|
||||
|
||||
DOM event handlers execute arbitrary Javascript code. Using an interpolation for such handlers means that the interpolated value is a JS string that is evaluated. Storing or generating such strings is error prone and leads to XSS vulnerabilities. On the other hand, `ngClick` and other Angular specific event handlers evaluate Angular expressions in non-window (Scope) context which makes them much safer.
|
||||
DOM event handlers execute arbitrary JavaScript code. Using an interpolation for such handlers means that the interpolated value is a JS string that is evaluated. Storing or generating such strings is error prone and leads to XSS vulnerabilities. On the other hand, `ngClick` and other Angular specific event handlers evaluate Angular expressions in non-window (Scope) context which makes them much safer.
|
||||
|
||||
To migrate the code follow the example below:
|
||||
|
||||
@@ -14710,7 +15342,7 @@ with the `$route` service
|
||||
|
||||
### Docs
|
||||
- rewrite of several major portions of angular.service.*, angular.Array.*, angular.Object.* docs
|
||||
- added support for [sitemap]((http://docs.angularjs.org/sitemap.xml) to make the docs indexable by
|
||||
- added support for [sitemap](http://docs.angularjs.org/sitemap.xml) to make the docs indexable by
|
||||
search crawlers
|
||||
- transition of Developer Guide docs from the wiki into docs.angularjs.org
|
||||
- lots of improvements related to formatting of the content of docs.anguarjs.org
|
||||
@@ -14901,7 +15533,7 @@ with the `$route` service
|
||||
|
||||
### Breaking changes
|
||||
- we now support ISO 8601 extended format datetime strings (YYYY-MM-DDTHH:mm:ss.SSSZ) as defined
|
||||
in EcmaScript 5 throughout angular. This means that the following apis switched from
|
||||
in EcmaScript 5 throughout AngularJS. This means that the following apis switched from
|
||||
YYYY-MM-DDTHH:mm:ssZ to YYYY-MM-DDTHH:mm:ss.SSSZ (note the added millis) when representing dates:
|
||||
- angular.Date.toString
|
||||
- angular.String.fromDate
|
||||
|
||||
+71
-12
@@ -49,7 +49,6 @@ if (!process.env.TRAVIS && !process.env.JENKINS_HOME) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module.exports = function(grunt) {
|
||||
|
||||
// this loads all the node_modules that start with `grunt-` as plugins
|
||||
@@ -64,6 +63,8 @@ module.exports = function(grunt) {
|
||||
NG_VERSION.cdn = versionInfo.cdnVersion;
|
||||
var dist = 'angular-' + NG_VERSION.full;
|
||||
|
||||
var deployVersion = NG_VERSION.isSnapshot ? 'snapshot' : NG_VERSION.full;
|
||||
|
||||
if (versionInfo.cdnVersion == null) {
|
||||
throw new Error('Unable to read CDN version, are you offline or has the CDN not been properly pushed?\n' +
|
||||
'Perhaps you want to set the NG1_BUILD_NO_REMOTE_VERSION_REQUESTS environment variable?');
|
||||
@@ -325,6 +326,15 @@ module.exports = function(grunt) {
|
||||
expand: true,
|
||||
dot: true,
|
||||
dest: dist + '/'
|
||||
},
|
||||
firebaseCodeDeploy: {
|
||||
options: {
|
||||
mode: 'gzip'
|
||||
},
|
||||
src: ['**'],
|
||||
cwd: 'build',
|
||||
expand: true,
|
||||
dest: 'upload/' + deployVersion + '/'
|
||||
}
|
||||
},
|
||||
|
||||
@@ -359,24 +369,73 @@ module.exports = function(grunt) {
|
||||
});
|
||||
|
||||
//alias tasks
|
||||
grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', ['eslint', 'package', 'test:unit', 'test:promises-aplus', 'tests:docs', 'test:protractor']);
|
||||
grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', [
|
||||
'eslint',
|
||||
'package',
|
||||
'test:unit',
|
||||
'test:promises-aplus',
|
||||
'tests:docs',
|
||||
'test:protractor'
|
||||
]);
|
||||
grunt.registerTask('test:jqlite', 'Run the unit tests with Karma' , ['tests:jqlite']);
|
||||
grunt.registerTask('test:jquery', 'Run the jQuery (latest) unit tests with Karma', ['tests:jquery']);
|
||||
grunt.registerTask('test:jquery-2.2', 'Run the jQuery 2.2 unit tests with Karma', ['tests:jquery-2.2']);
|
||||
grunt.registerTask('test:jquery-2.1', 'Run the jQuery 2.1 unit tests with Karma', ['tests:jquery-2.1']);
|
||||
grunt.registerTask('test:modules', 'Run the Karma module tests with Karma', ['build', 'tests:modules']);
|
||||
grunt.registerTask('test:modules', 'Run the Karma module tests with Karma', [
|
||||
'build',
|
||||
'tests:modules'
|
||||
]);
|
||||
grunt.registerTask('test:docs', 'Run the doc-page tests with Karma', ['package', 'tests:docs']);
|
||||
grunt.registerTask('test:unit', 'Run unit, jQuery and Karma module tests with Karma', ['test:jqlite', 'test:jquery', 'test:jquery-2.2', 'test:jquery-2.1', 'test:modules']);
|
||||
grunt.registerTask('test:protractor', 'Run the end to end tests with Protractor and keep a test server running in the background', ['webdriver', 'connect:testserver', 'protractor:normal']);
|
||||
grunt.registerTask('test:travis-protractor', 'Run the end to end tests with Protractor for Travis CI builds', ['connect:testserver', 'protractor:travis']);
|
||||
grunt.registerTask('test:ci-protractor', 'Run the end to end tests with Protractor for Jenkins CI builds', ['webdriver', 'connect:testserver', 'protractor:jenkins']);
|
||||
grunt.registerTask('test:unit', 'Run unit, jQuery and Karma module tests with Karma', [
|
||||
'test:jqlite',
|
||||
'test:jquery',
|
||||
'test:jquery-2.2',
|
||||
'test:jquery-2.1',
|
||||
'test:modules'
|
||||
]);
|
||||
grunt.registerTask('test:protractor', 'Run the end to end tests with Protractor and keep a test server running in the background', [
|
||||
'webdriver',
|
||||
'connect:testserver',
|
||||
'protractor:normal'
|
||||
]);
|
||||
grunt.registerTask('test:travis-protractor', 'Run the end to end tests with Protractor for Travis CI builds', [
|
||||
'connect:testserver',
|
||||
'protractor:travis'
|
||||
]);
|
||||
grunt.registerTask('test:ci-protractor', 'Run the end to end tests with Protractor for Jenkins CI builds', [
|
||||
'webdriver',
|
||||
'connect:testserver',
|
||||
'protractor:jenkins'
|
||||
]);
|
||||
grunt.registerTask('test:e2e', 'Alias for test:protractor', ['test:protractor']);
|
||||
grunt.registerTask('test:promises-aplus',['build:promises-aplus-adapter', 'shell:promises-aplus-tests']);
|
||||
|
||||
grunt.registerTask('minify', ['bower', 'clean', 'build', 'minall']);
|
||||
grunt.registerTask('test:promises-aplus',[
|
||||
'build:promises-aplus-adapter',
|
||||
'shell:promises-aplus-tests'
|
||||
]);
|
||||
grunt.registerTask('minify', [
|
||||
'bower',
|
||||
'clean',
|
||||
'build',
|
||||
'minall'
|
||||
]);
|
||||
grunt.registerTask('webserver', ['connect:devserver']);
|
||||
grunt.registerTask('package', ['bower', 'validate-angular-files', 'clean', 'buildall', 'minall', 'collect-errors', 'write', 'docs', 'copy', 'compress']);
|
||||
grunt.registerTask('ci-checks', ['ddescribe-iit', 'merge-conflict', 'eslint']);
|
||||
grunt.registerTask('package', [
|
||||
'bower',
|
||||
'validate-angular-files',
|
||||
'clean',
|
||||
'buildall',
|
||||
'minall',
|
||||
'collect-errors',
|
||||
'write',
|
||||
'docs',
|
||||
'copy',
|
||||
'compress:build'
|
||||
]);
|
||||
grunt.registerTask('ci-checks', [
|
||||
'ddescribe-iit',
|
||||
'merge-conflict',
|
||||
'eslint'
|
||||
]);
|
||||
grunt.registerTask('default', ['package']);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2010-2016 Google, Inc. http://angularjs.org
|
||||
Copyright (c) 2010-2017 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
|
||||
|
||||
@@ -8,8 +8,8 @@ synchronizes data from your UI (view) with your JavaScript objects (model) throu
|
||||
binding. To help you structure your application better and make it easy to test, AngularJS teaches
|
||||
the browser how to do dependency injection and inversion of control.
|
||||
|
||||
It also helps with server-side communication, taming async callbacks with promises and deferreds,
|
||||
and it makes client-side navigation and deeplinking with hashbang urls or HTML5 pushState a
|
||||
It also helps with server-side communication, taming async callbacks with promises and deferred objects,
|
||||
and it makes client-side navigation and deep linking with hashbang urls or HTML5 pushState a
|
||||
piece of cake. Best of all? It makes development fun!
|
||||
|
||||
* Web site: https://angularjs.org
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('animationBenchmark', ['ngAnimate'], config)
|
||||
.controller('BenchmarkController', BenchmarkController);
|
||||
|
||||
// Functions - Definitions
|
||||
function config($compileProvider) {
|
||||
$compileProvider
|
||||
.commentDirectivesEnabled(false)
|
||||
.cssClassDirectivesEnabled(false)
|
||||
.debugInfoEnabled(false);
|
||||
}
|
||||
|
||||
function BenchmarkController($scope) {
|
||||
var self = this;
|
||||
var itemCount = 1000;
|
||||
var items = (new Array(itemCount + 1)).join('.').split('');
|
||||
|
||||
benchmarkSteps.push({
|
||||
name: 'create',
|
||||
fn: function() {
|
||||
$scope.$apply(function() {
|
||||
self.items = items;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
benchmarkSteps.push({
|
||||
name: '$digest',
|
||||
fn: function() {
|
||||
$scope.$root.$digest();
|
||||
}
|
||||
});
|
||||
|
||||
benchmarkSteps.push({
|
||||
name: 'destroy',
|
||||
fn: function() {
|
||||
$scope.$apply(function() {
|
||||
self.items = [];
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/* eslint-env node */
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
scripts: [
|
||||
{
|
||||
id: 'jquery',
|
||||
src: 'jquery-noop.js'
|
||||
}, {
|
||||
id: 'angular',
|
||||
src: '/build/angular.js'
|
||||
}, {
|
||||
id: 'angular-animate',
|
||||
src: '/build/angular-animate.js'
|
||||
}, {
|
||||
src: 'app.js'
|
||||
}
|
||||
]
|
||||
});
|
||||
};
|
||||
+1
@@ -0,0 +1 @@
|
||||
// Override me with ?jquery=/bower_components/jquery/dist/jquery.js
|
||||
@@ -0,0 +1,28 @@
|
||||
<style>
|
||||
[ng-cloak] { display: none !important; }
|
||||
.animation-container .ng-enter,
|
||||
.animation-container .ng-leave {
|
||||
transition: all 0.1s;
|
||||
}
|
||||
|
||||
.animation-container .ng-enter,
|
||||
.animation-container .ng-leave.ng-leave-active {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.animation-container .ng-enter.ng-enter-active,
|
||||
.animation-container .ng-leave {
|
||||
opacity: 1;
|
||||
}
|
||||
</style>
|
||||
<div ng-app="animationBenchmark" ng-cloak ng-controller="BenchmarkController as bm">
|
||||
<div class="container-fluid">
|
||||
<h2>Large collection of elements animated in and out with ngAnimate</h2>
|
||||
|
||||
<div class="animation-container">
|
||||
<div ng-repeat="i in bm.items track by $index">
|
||||
Just a plain ol' element
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,108 @@
|
||||
'use strict';
|
||||
|
||||
var app = angular.module('ngClassBenchmark', []);
|
||||
|
||||
app.controller('DataController', function DataController($scope) {
|
||||
|
||||
this.init = function() {
|
||||
this.numberOfTodos = 1000;
|
||||
this.implementation = 'tableOptimized';
|
||||
this.completedPeriodicity = 3;
|
||||
this.importantPeriodicity = 13;
|
||||
this.urgentPeriodicity = 29;
|
||||
|
||||
this.createTodos(100);
|
||||
this.setTodosValuesWithSeed(0);
|
||||
};
|
||||
|
||||
this.clearTodos = function() {
|
||||
this.todos = null;
|
||||
};
|
||||
|
||||
this.createTodos = function(count) {
|
||||
var i;
|
||||
this.todos = [];
|
||||
for (i = 0; i < count; i++) {
|
||||
this.todos.push({
|
||||
id: i + 1,
|
||||
completed: false,
|
||||
important: false,
|
||||
urgent: false
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
this.setTodosValuesWithSeed = function(offset) {
|
||||
var i, todo;
|
||||
for (i = 0; i < this.todos.length; i++) {
|
||||
todo = this.todos[i];
|
||||
todo.completed = 0 === (i + offset) % this.completedPeriodicity;
|
||||
todo.important = 0 === (i + offset) % this.importantPeriodicity;
|
||||
todo.urgent = 0 === (i + offset) % this.urgentPeriodicity;
|
||||
}
|
||||
};
|
||||
|
||||
this.init();
|
||||
|
||||
|
||||
benchmarkSteps.push({
|
||||
name: 'setup',
|
||||
fn: function() {
|
||||
$scope.$apply();
|
||||
this.clearTodos();
|
||||
this.createTodos(this.numberOfTodos);
|
||||
}.bind(this)
|
||||
});
|
||||
|
||||
benchmarkSteps.push({
|
||||
name: 'create',
|
||||
fn: function() {
|
||||
// initialize data for first time that will construct the DOM
|
||||
this.setTodosValuesWithSeed(0);
|
||||
$scope.$apply();
|
||||
}.bind(this)
|
||||
});
|
||||
|
||||
benchmarkSteps.push({
|
||||
name: '$apply',
|
||||
fn: function() {
|
||||
$scope.$apply();
|
||||
}
|
||||
});
|
||||
|
||||
benchmarkSteps.push({
|
||||
name: 'update',
|
||||
fn: function() {
|
||||
// move everything but completed
|
||||
this.setTodosValuesWithSeed(3);
|
||||
$scope.$apply();
|
||||
}.bind(this)
|
||||
});
|
||||
|
||||
benchmarkSteps.push({
|
||||
name: 'unclass',
|
||||
fn: function() {
|
||||
// remove all classes
|
||||
this.setTodosValuesWithSeed(NaN);
|
||||
$scope.$apply();
|
||||
}.bind(this)
|
||||
});
|
||||
|
||||
benchmarkSteps.push({
|
||||
name: 'class',
|
||||
fn: function() {
|
||||
// add all classes as the initial state
|
||||
this.setTodosValuesWithSeed(0);
|
||||
$scope.$apply();
|
||||
}.bind(this)
|
||||
});
|
||||
|
||||
benchmarkSteps.push({
|
||||
name: 'destroy',
|
||||
fn: function() {
|
||||
this.clearTodos();
|
||||
$scope.$apply();
|
||||
}.bind(this)
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
/* eslint-env node */
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
scripts: [{
|
||||
id: 'angular',
|
||||
src: '/build/angular.js'
|
||||
},
|
||||
{
|
||||
src: 'app.js'
|
||||
}]
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,177 @@
|
||||
<style>
|
||||
.gold {
|
||||
background: gold;
|
||||
}
|
||||
.silver {
|
||||
background: silver;
|
||||
}
|
||||
.table tbody tr > td.success {
|
||||
background-color: #dff0d8;
|
||||
}
|
||||
|
||||
.table tbody tr > td.error {
|
||||
background-color: #f2dede;
|
||||
}
|
||||
|
||||
.table tbody tr > td.warning {
|
||||
background-color: #fcf8e3;
|
||||
}
|
||||
|
||||
.table tbody tr > td.info {
|
||||
background-color: #d9edf7;
|
||||
}
|
||||
.completed {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
.important {
|
||||
font-weight: bold;
|
||||
}
|
||||
.urgent {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
<div ng-app="ngClassBenchmark" ng-cloak class="container-fluid">
|
||||
<div ng-controller="DataController as benchmark" class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="well">
|
||||
<h3>Parameters</h3>
|
||||
|
||||
<br>
|
||||
<p>
|
||||
<label>Number of todos</label><br>
|
||||
<input type="number" ng-model="benchmark.numberOfTodos">
|
||||
</p>
|
||||
|
||||
<br>
|
||||
<p>
|
||||
<label>Implementation</label><br>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input ng-model="benchmark.implementation" value="tableOptimized"
|
||||
type="radio" name="implementation">
|
||||
Table optimized <br>
|
||||
<code>ng-class="todo.completed && 'success'"</code>
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input ng-model="benchmark.implementation" value="table"
|
||||
type="radio" name="implementation">
|
||||
Table <br>
|
||||
<code>ng-class="{success: todo.completed}"</code>
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input ng-model="benchmark.implementation" value="list"
|
||||
type="radio" name="implementation">
|
||||
List <br>
|
||||
<code>ng-class="{completed: todo.completed, urgent: todo.urgent, important: todo.important"}</code>
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input ng-model="benchmark.implementation" value="singleOptimized"
|
||||
type="radio" name="implementation">
|
||||
Single ngClass optimized <br>
|
||||
<code>
|
||||
ng-class="{'panel-success': !!benchmark.todos, 'panel-danger': !benchmark.todos}"
|
||||
</code>
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input ng-model="benchmark.implementation" value="single"
|
||||
type="radio" name="implementation">
|
||||
Single ngClass <br>
|
||||
<code>
|
||||
ng-class="{'panel-success': benchmark.todos, 'panel-danger': !benchmark.todos}"
|
||||
</code>
|
||||
</label>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<h3>Example</h3>
|
||||
<div ng-switch="benchmark.implementation">
|
||||
|
||||
<table ng-switch-when="tableOptimized" class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>todo #id</th>
|
||||
<th>completed?</th>
|
||||
<th>urgent?</th>
|
||||
<th>important?</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="todo in benchmark.todos track by todo.id"
|
||||
ng-class="todo.completed && 'active'"
|
||||
ng-class-even="todo.completed && todo.important && 'gold'"
|
||||
ng-class-odd="todo.completed && todo.important && 'silver'"
|
||||
>
|
||||
<td>#{{todo.id}}</td>
|
||||
<td>{{todo.completed}}</td>
|
||||
<td ng-class="todo.urgent && 'danger'">{{todo.urgent}}</td>
|
||||
<td ng-class="todo.important && 'success'">{{todo.important}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table ng-switch-when="table" class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>todo #id</th>
|
||||
<th>completed?</th>
|
||||
<th>urgent?</th>
|
||||
<th>important?</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="todo in benchmark.todos track by todo.id"
|
||||
ng-class="{active: todo.completed}"
|
||||
ng-class-even="{gold: todo.completed && todo.important}"
|
||||
ng-class-odd="{silver: todo.completed && todo.important}"
|
||||
>
|
||||
<td>#{{todo.id}}</td>
|
||||
<td>{{todo.completed}}</td>
|
||||
<td ng-class="{danger: todo.urgent}">{{todo.urgent}}</td>
|
||||
<td ng-class="{success: todo.important}">{{todo.important}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<ul ng-switch-when="list">
|
||||
<li ng-repeat="todo in benchmark.todos track by todo.id"
|
||||
ng-class="{
|
||||
completed: todo.completed,
|
||||
urgent: todo.urgent,
|
||||
important: todo.important
|
||||
}">#{{todo.id}}</li>
|
||||
</ul>
|
||||
|
||||
<div ng-switch-when="singleOptimized"
|
||||
class="panel"
|
||||
ng-class="{'panel-success': !!benchmark.todos, 'panel-danger': !benchmark.todos}">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Information</h3>
|
||||
</div>
|
||||
<div class="panel-body"> The title is green because there are todos... </div>
|
||||
</div>
|
||||
|
||||
<div ng-switch-when="single"
|
||||
class="panel"
|
||||
ng-class="{'panel-success': benchmark.todos, 'panel-danger': !benchmark.todos}">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Information</h3>
|
||||
</div>
|
||||
<div class="panel-body"> The title is green because there are todos... </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br><br><br>
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"name": "angularjs",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"jquery": "3.1.0",
|
||||
"jquery": "3.2.1",
|
||||
"jquery-2.2": "jquery#2.2.4",
|
||||
"jquery-2.1": "jquery#2.1.4",
|
||||
"closure-compiler": "https://dl.google.com/closure-compiler/compiler-20140814.zip",
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
.visible-phone{display:none}.visible-desktop{display:block}.navbar{display:block}.navbar .container{padding:0 16px;width:auto}.navbar .brand{float:left;margin:8px 80px 0 8px;padding:0}.navbar .brand a{display:block;height:30px;margin:6px 0 5px 0;overflow:hidden;padding:0;width:117px}.navbar .nav{float:right}.navbar .nav .dropdown-toggle{color:rgba(255,255,255,0.87);font-size:16px;font-weight:300;line-height:56px;padding:0 24px;text-transform:uppercase;transition:all .3s}.navbar .nav .dropdown-toggle:hover,.navbar .nav .dropdown-toggle:active,.navbar .nav .dropdown-toggle:focus{background:#37474F;color:#fff}.navbar .nav .dropdown-menu{background:#37474F;border:none;border-radius:0;box-shadow:0 0 16px rgba(0,0,0,0.12),0 16px 16px rgba(0,0,0,0.24);color:#fff;left:auto;margin:0;padding:0;right:0}.navbar .nav .dropdown-menu:after,.navbar .nav .dropdown-menu:before{display:none}.navbar .nav .dropdown-menu li{border-bottom:1px solid rgba(38,50,56,0.56);box-sizing:border-box;line-height:48px}.navbar .nav .dropdown-menu li:last-child{border:none}.navbar .nav .dropdown-menu a{background:#37474F;color:#fff;font-weight:300;line-height:48px;padding:0 16px;transition:all .2s}.navbar .nav .dropdown-menu a:hover,.navbar .nav .dropdown-menu a:focus{background:#455A64}.navbar .navbar-search{left:200px;margin:0;position:absolute;right:440px;top:8px;width:auto}.navbar .navbar-search i{color:#546E7A;font-size:16px;left:12px;position:absolute;top:11px}.navbar .navbar-search .search-query{background:#37474F;border:none;border-radius:2px;box-shadow:none;box-sizing:border-box;color:#546E7A;font-size:14px;height:40px;width:100%;padding:0 16px 0 32px;text-shadow:none;transition:all .3s}.navbar .navbar-search .search-query:-webkit-autofill,.navbar .navbar-search .search-query:-webkit-autofill:hover,.navbar .navbar-search .search-query:-webkit-autofill:focus{background-color:#fff;transition:background-color 5000s ease-in-out 0s;-webkit-text-fill-color:#455A64}.navbar .navbar-search .search-query:hover,.navbar .navbar-search .search-query:active,.navbar .navbar-search .search-query:focus{background:#fff;box-shadow:inset 0 2px 4px rgba(0,0,0,0.24);color:#2196F3}.navbar .navbar-search .search-query::-webkit-input-placeholder{color:#546E7A}.navbar .navbar-search .search-query::-moz-placeholder{color:#546E7A}.navbar .navbar-search .search-query:-ms-input-placeholder{color:#546E7A}.navbar .navbar-search .search-query:-moz-placeholder{color:#546E7A}#navbar-main .navbar-inner{background:#263238;height:56px}#navbar-notice{z-index:1029;top:56px}#navbar-notice .navbar-inner{background:#ECEFF1;box-shadow:0 0 3px rgba(0,0,0,0.12),0 3px 3px rgba(0,0,0,0.24);height:auto}.site-notice{padding:4px 0;text-align:center;font-size:13px;margin:0}@media handheld and (max-width: 800px), screen and (max-device-width: 800px), screen and (max-width: 800px){.visible-phone{display:block}.visible-desktop{display:none}}@media handheld and (max-width: 800px), screen and (max-device-width: 800px), screen and (max-width: 800px){.homepage .container{padding:16px;width:auto}.homepage .span1{width:auto}.homepage .span2{width:auto}.homepage .span3{width:auto}.homepage .span4{width:auto}.homepage .span5{width:auto}.homepage .span6{width:auto}.homepage .span7{width:auto}.homepage .span8{width:auto}.homepage .span9{width:auto}.homepage .span10{width:auto}.homepage .navbar .container{padding:0 8px}.homepage #navbar-main .navbar-inner{height:40px}.homepage #navbar-main .brand{margin:6px 0 0 0}.homepage #navbar-main .brand a{margin:0}.homepage #navbar-main .nav{margin:0}.homepage #navbar-main .nav .dropdown-toggle{font-size:12px;line-height:40px;padding:0 8px}.homepage #navbar-main .dropdown-menu a{padding:0 8px}.homepage #navbar-main .navbar-search{background:#263238;border-bottom:1px solid #263238;left:0;right:0;top:100%}.homepage #navbar-main .navbar-search i{left:12px;top:7px}.homepage #navbar-main .navbar-search .search-query{border-radius:0;height:32px}.homepage #navbar-notice{top:40px}.homepage #navbar-notice .site-notice{font-size:11px}.homepage .hero{padding:80px 32px 32px 32px}.homepage .hero h2{background-size:230px 60px;height:60px;width:230px}}
|
||||
@@ -1,3 +1,37 @@
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
src: url("../components/open-sans-fontface-1.4.0/fonts/Regular/OpenSans-Regular.eot?v=1.1.0");
|
||||
src: url("../components/open-sans-fontface-1.4.0/fonts/Regular/OpenSans-Regular.eot?#iefix&v=1.1.0") format("embedded-opentype"),
|
||||
url("../components/open-sans-fontface-1.4.0/fonts/Regular/OpenSans-Regular.woff?v=1.1.0") format("woff"),
|
||||
url("../components/open-sans-fontface-1.4.0/fonts/Regular/OpenSans-Regular.ttf?v=1.1.0") format("truetype"),
|
||||
url("../components/open-sans-fontface-1.4.0/fonts/Regular/OpenSans-Regular.svg?v=1.1.0#OpenSansBold") format("svg");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
src: url("../components/open-sans-fontface-1.4.0/fonts/Semibold/OpenSans-Semibold.eot?v=1.1.0");
|
||||
src: url("../components/open-sans-fontface-1.4.0/fonts/Semibold/OpenSans-Semibold.eot?#iefix&v=1.1.0") format("embedded-opentype"),
|
||||
url("../components/open-sans-fontface-1.4.0/fonts/Semibold/OpenSans-Semibold.woff?v=1.1.0") format("woff"),
|
||||
url("../components/open-sans-fontface-1.4.0/fonts/Semibold/OpenSans-Semibold.ttf?v=1.1.0") format("truetype"),
|
||||
url("../components/open-sans-fontface-1.4.0/fonts/Semibold/OpenSans-Semibold.svg?v=1.1.0#OpenSansBold") format("svg");
|
||||
font-weight: 600;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
src: url("../components/open-sans-fontface-1.4.0/fonts/Bold/OpenSans-Bold.eot?v=1.1.0");
|
||||
src: url("../components/open-sans-fontface-1.4.0/fonts/Bold/OpenSans-Bold.eot?#iefix&v=1.1.0") format("embedded-opentype"),
|
||||
url("../components/open-sans-fontface-1.4.0/fonts/Bold/OpenSans-Bold.woff?v=1.1.0") format("woff"),
|
||||
url("../components/open-sans-fontface-1.4.0/fonts/Bold/OpenSans-Bold.ttf?v=1.1.0") format("truetype"),
|
||||
url("../components/open-sans-fontface-1.4.0/fonts/Bold/OpenSans-Bold.svg?v=1.1.0#OpenSansBold") format("svg");
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
html, body {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
@@ -53,13 +87,13 @@ h1,h2,h3,h4,h5,h6 {
|
||||
}
|
||||
|
||||
.header .brand {
|
||||
padding-top: 6px;
|
||||
padding-bottom: 0px;
|
||||
}
|
||||
|
||||
.header .brand img {
|
||||
margin-top: 5px;
|
||||
height: 30px;
|
||||
margin-top: 0;
|
||||
height: auto;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.docs-search {
|
||||
@@ -82,6 +116,11 @@ h1,h2,h3,h4,h5,h6 {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.navbar .navbar-search i {
|
||||
top: 13px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.docs-search > .search-query:focus {
|
||||
outline: 0;
|
||||
}
|
||||
@@ -297,6 +336,7 @@ iframe.example {
|
||||
}
|
||||
|
||||
.search-results-container {
|
||||
position: relative;
|
||||
padding-bottom: 1em;
|
||||
border-top: 1px solid #111;
|
||||
background: #181818;
|
||||
@@ -435,15 +475,17 @@ iframe.example {
|
||||
background: #f1f1f1;
|
||||
}
|
||||
|
||||
.sup-header {
|
||||
#navbar-sub {
|
||||
padding-top: 10px;
|
||||
padding-bottom: 5px;
|
||||
background: rgba(245,245,245,0.88);
|
||||
box-shadow: 0 0 2px #999;
|
||||
z-index: 1028;
|
||||
top: 83px;
|
||||
}
|
||||
|
||||
.main-body-grid {
|
||||
margin-top: 120px;
|
||||
margin-top: 144px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@@ -454,7 +496,7 @@ iframe.example {
|
||||
|
||||
.main-body-grid > .grid-left {
|
||||
position: fixed;
|
||||
top: 120px;
|
||||
top: 144px;
|
||||
bottom: 0;
|
||||
overflow: auto;
|
||||
}
|
||||
@@ -827,3 +869,86 @@ ul.events > li {
|
||||
iframe[name="example-anchoringExample"] {
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
/*
|
||||
angular-topnav.css and bootstrap overrides
|
||||
*/
|
||||
|
||||
.navbar .navbar-inner .container {
|
||||
padding: 0 16px;
|
||||
width: auto;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.navbar .nav > li {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.navbar-nav .open .dropdown-menu {
|
||||
position: absolute;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.navbar-nav .open .dropdown-menu > li > a {
|
||||
line-height: 48px;
|
||||
}
|
||||
|
||||
#navbar-main .navbar-inner, #navbar-notice .navbar-inner {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
#navbar-sub .container {
|
||||
max-width: 970px;
|
||||
}
|
||||
|
||||
.nav .open > a, .nav .open > a:hover, .nav .open > a:focus {
|
||||
background-color: inherit;
|
||||
}
|
||||
|
||||
@media handheld and (max-width:800px), screen and (max-device-width:800px), screen and (max-width:800px) {
|
||||
.navbar {
|
||||
min-height: auto;
|
||||
}
|
||||
|
||||
.search-results-container {
|
||||
top: 32px;
|
||||
overflow: auto;
|
||||
max-height: 85vh;
|
||||
padding-bottom: 0;
|
||||
position: static;
|
||||
}
|
||||
|
||||
.search-close {
|
||||
right: 1px;
|
||||
margin-left: 0;
|
||||
top: 41px;
|
||||
padding: 5px 10px;
|
||||
border-top-right-radius: 0;
|
||||
border-top-left-radius: 0;
|
||||
box-shadow: none;
|
||||
width: auto;
|
||||
bottom: auto;
|
||||
left: auto;
|
||||
}
|
||||
|
||||
.navbar-nav .open .dropdown-menu > li > a, .navbar-nav .open .dropdown-menu .dropdown-header {
|
||||
padding: 0 8px;
|
||||
}
|
||||
|
||||
.homepage #navbar-notice {
|
||||
top: 72px;
|
||||
}
|
||||
|
||||
#navbar-notice .navbar-inner {
|
||||
box-shadow: 0 0 3px rgba(0, 0, 0, .12), 0 3px 3px rgba(0, 0, 0, .24)
|
||||
}
|
||||
|
||||
#navbar-sub {
|
||||
position: relative;
|
||||
top: 17px;
|
||||
margin-top: 80px;
|
||||
padding-bottom: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
/* global importScripts, lunr */
|
||||
|
||||
// Load up the lunr library
|
||||
importScripts('../components/lunr.js-0.5.12/lunr.min.js');
|
||||
importScripts('../components/lunr-0.7.2/lunr.min.js');
|
||||
|
||||
// Create the lunr index - the docs should be an array of object, each object containing
|
||||
// the path and search terms for a page
|
||||
|
||||
@@ -18,8 +18,8 @@ describe('doc.angularjs.org', function() {
|
||||
var ngBindLink = element(by.css('.definition-table td a[href="api/ng/directive/ngClick"]'));
|
||||
ngBindLink.click();
|
||||
|
||||
var pageBody = element(by.css('h1'));
|
||||
expect(pageBody.getText()).toEqual('ngClick');
|
||||
var mainHeader = element(by.css('.main-body h1 '));
|
||||
expect(mainHeader.getText()).toEqual('ngClick');
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -44,30 +44,31 @@ describe('docs.angularjs.org', function() {
|
||||
var ngBindLink = element(by.css('.definition-table td a[href="api/ng/directive/ngClick"]'));
|
||||
ngBindLink.click();
|
||||
|
||||
var pageBody = element(by.css('h1'));
|
||||
expect(pageBody.getText()).toEqual('ngClick');
|
||||
var mainHeader = element(by.css('.main-body h1 '));
|
||||
expect(mainHeader.getText()).toEqual('ngClick');
|
||||
});
|
||||
|
||||
|
||||
|
||||
it('should be resilient to trailing slashes', function() {
|
||||
browser.get('build/docs/index-production.html#!/api/ng/function/angular.noop/');
|
||||
var pageBody = element(by.css('h1'));
|
||||
expect(pageBody.getText()).toEqual('angular.noop');
|
||||
|
||||
var mainHeader = element(by.css('.main-body h1 '));
|
||||
expect(mainHeader.getText()).toEqual('angular.noop');
|
||||
});
|
||||
|
||||
|
||||
it('should be resilient to trailing "index"', function() {
|
||||
browser.get('build/docs/index-production.html#!/api/ng/function/angular.noop/index');
|
||||
var pageBody = element(by.css('h1'));
|
||||
expect(pageBody.getText()).toEqual('angular.noop');
|
||||
var mainHeader = element(by.css('.main-body h1 '));
|
||||
expect(mainHeader.getText()).toEqual('angular.noop');
|
||||
});
|
||||
|
||||
|
||||
it('should be resilient to trailing "index/"', function() {
|
||||
browser.get('build/docs/index-production.html#!/api/ng/function/angular.noop/index/');
|
||||
var pageBody = element(by.css('h1'));
|
||||
expect(pageBody.getText()).toEqual('angular.noop');
|
||||
var mainHeader = element(by.css('.main-body h1 '));
|
||||
expect(mainHeader.getText()).toEqual('angular.noop');
|
||||
});
|
||||
|
||||
|
||||
@@ -78,7 +79,8 @@ describe('docs.angularjs.org', function() {
|
||||
|
||||
it('should display an error if the page does not exist', function() {
|
||||
browser.get('build/docs/index-production.html#!/api/does/not/exist');
|
||||
expect(element(by.css('h1')).getText()).toBe('Oops!');
|
||||
var mainHeader = element(by.css('.main-body h1 '));
|
||||
expect(mainHeader.getText()).toEqual('Oops!');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -14,6 +14,7 @@ angular.module('docsApp', [
|
||||
'search',
|
||||
'tutorials',
|
||||
'versions',
|
||||
'deployment',
|
||||
'ui.bootstrap.dropdown'
|
||||
])
|
||||
|
||||
|
||||
@@ -18,7 +18,13 @@ angular.module('examples', [])
|
||||
return {
|
||||
restrict: 'C',
|
||||
scope : true,
|
||||
controller : ['$scope', function($scope) {
|
||||
controller : ['$scope', 'DEPLOYMENT', function($scope, DEPLOYMENT) {
|
||||
var exampleIndexFile = (DEPLOYMENT === 'default' ? 'index' : 'index-' + DEPLOYMENT) + '.html';
|
||||
|
||||
$scope.getExampleIndex = function(basePath) {
|
||||
return basePath + '/' + exampleIndexFile;
|
||||
};
|
||||
|
||||
$scope.setTab = function(index) {
|
||||
var tab = $scope.tabs[index];
|
||||
$scope.activeTabIndex = index;
|
||||
@@ -159,10 +165,11 @@ angular.module('examples', [])
|
||||
|
||||
};
|
||||
|
||||
// Initialize the example data, so it's ready when clicking the open button.
|
||||
// Otherwise pop-up blockers will prevent a new window from opening
|
||||
ctrl.prepareExampleData(ctrl.example.path);
|
||||
|
||||
ctrl.$onInit = function() {
|
||||
// Initialize the example data, so it's ready when clicking the open button.
|
||||
// Otherwise pop-up blockers will prevent a new window from opening
|
||||
ctrl.prepareExampleData(ctrl.example.path);
|
||||
};
|
||||
}]
|
||||
};
|
||||
}])
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"name": "AngularJS-docs-app",
|
||||
"dependencies": {
|
||||
"jquery": "2.2.3",
|
||||
"lunr.js": "0.5.12",
|
||||
"open-sans-fontface": "1.0.4",
|
||||
"google-code-prettify": "1.0.1",
|
||||
"bootstrap": "3.1.1"
|
||||
}
|
||||
}
|
||||
+11
-1
@@ -112,6 +112,10 @@ module.exports = new Package('angularjs', [
|
||||
docTypes: ['indexPage'],
|
||||
pathTemplate: '.',
|
||||
outputPathTemplate: '${id}.html'
|
||||
}, {
|
||||
docTypes: ['deploymentData'],
|
||||
pathTemplate: '.',
|
||||
outputPathTemplate: 'js/${id}.js'
|
||||
});
|
||||
|
||||
computePathsProcessor.pathTemplates.push({
|
||||
@@ -125,8 +129,14 @@ module.exports = new Package('angularjs', [
|
||||
outputPathTemplate: 'partials/${area}/${moduleName}/${groupType}.html'
|
||||
});
|
||||
|
||||
computePathsProcessor.pathTemplates.push({
|
||||
docTypes: ['example'],
|
||||
pathTemplate: 'examples/${example.id}',
|
||||
outputPathTemplate: 'examples/${example.id}/index${deploymentQualifier}.html'
|
||||
});
|
||||
|
||||
computeIdsProcessor.idTemplates.push({
|
||||
docTypes: ['overview', 'tutorial', 'e2e-test', 'indexPage'],
|
||||
docTypes: ['overview', 'tutorial', 'e2e-test', 'indexPage', 'deploymentData'],
|
||||
getId: function(doc) { return doc.fileInfo.baseName; },
|
||||
getAliases: function(doc) { return [doc.id]; }
|
||||
});
|
||||
|
||||
@@ -35,7 +35,17 @@ module.exports = function generateIndexPagesProcessor() {
|
||||
|
||||
indexDoc.id = 'index' + (deployment.name === 'default' ? '' : '-' + deployment.name);
|
||||
|
||||
var deploymentDoc = {
|
||||
docType: 'deploymentData',
|
||||
id: 'deployment-data-' + deployment.name,
|
||||
template: 'angular-service.template.js',
|
||||
ngModuleName: 'deployment',
|
||||
serviceName: 'DEPLOYMENT',
|
||||
serviceValue: deployment.name
|
||||
};
|
||||
|
||||
docs.push(indexDoc);
|
||||
docs.push(deploymentDoc);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -47,6 +47,14 @@ module.exports = function generateVersionDocProcessor(gitData) {
|
||||
|
||||
var latestMap = {};
|
||||
|
||||
// When the docs are built on a tagged commit, yarn info won't include the latest release,
|
||||
// so we add it manually based on the local version.json file.
|
||||
var missesCurrentVersion = !currentVersion.isSnapshot && !versions.find(function(version) {
|
||||
return version === currentVersion.version;
|
||||
});
|
||||
|
||||
if (missesCurrentVersion) versions.push(currentVersion.version);
|
||||
|
||||
versions = versions
|
||||
.filter(function(versionStr) {
|
||||
return blacklist.indexOf(versionStr) === -1;
|
||||
@@ -70,6 +78,7 @@ module.exports = function generateVersionDocProcessor(gitData) {
|
||||
})
|
||||
.reverse();
|
||||
|
||||
// List the latest version for each branch
|
||||
var latest = sortObject(latestMap, reverse(semver.compare))
|
||||
.map(function(version) { return makeOption(version, 'Latest'); });
|
||||
|
||||
|
||||
@@ -17,21 +17,22 @@ module.exports = function debugDeployment(getVersion) {
|
||||
'../angular-sanitize.js',
|
||||
'../angular-touch.js',
|
||||
'../angular-animate.js',
|
||||
'components/marked-' + getVersion('marked', 'node_modules', 'package.json') + '/lib/marked.js',
|
||||
'components/marked-' + getVersion('marked') + '/lib/marked.js',
|
||||
'js/angular-bootstrap/dropdown-toggle.js',
|
||||
'components/lunr.js-' + getVersion('lunr.js') + '/lunr.js',
|
||||
'components/lunr-' + getVersion('lunr') + '/lunr.js',
|
||||
'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/prettify.js',
|
||||
'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/lang-css.js',
|
||||
'js/current-version-data.js',
|
||||
'js/all-versions-data.js',
|
||||
'js/pages-data.js',
|
||||
'js/nav-data.js',
|
||||
'js/deployment-data-debug.js',
|
||||
'js/docs.js'
|
||||
],
|
||||
stylesheets: [
|
||||
'components/bootstrap-' + getVersion('bootstrap') + '/css/bootstrap.css',
|
||||
'components/open-sans-fontface-' + getVersion('open-sans-fontface') + '/open-sans.css',
|
||||
'css/prettify-theme.css',
|
||||
'css/angular-topnav.css',
|
||||
'css/docs.css',
|
||||
'css/animations.css'
|
||||
]
|
||||
|
||||
@@ -17,21 +17,22 @@ module.exports = function defaultDeployment(getVersion) {
|
||||
'../angular-sanitize.min.js',
|
||||
'../angular-touch.min.js',
|
||||
'../angular-animate.min.js',
|
||||
'components/marked-' + getVersion('marked', 'node_modules', 'package.json') + '/lib/marked.js',
|
||||
'components/marked-' + getVersion('marked') + '/marked.min.js',
|
||||
'js/angular-bootstrap/dropdown-toggle.min.js',
|
||||
'components/lunr.js-' + getVersion('lunr.js') + '/lunr.min.js',
|
||||
'components/lunr-' + getVersion('lunr') + '/lunr.min.js',
|
||||
'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/prettify.js',
|
||||
'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/lang-css.js',
|
||||
'js/current-version-data.js',
|
||||
'js/all-versions-data.js',
|
||||
'js/pages-data.js',
|
||||
'js/nav-data.js',
|
||||
'js/deployment-data-default.js',
|
||||
'js/docs.min.js'
|
||||
],
|
||||
stylesheets: [
|
||||
'components/bootstrap-' + getVersion('bootstrap') + '/css/bootstrap.min.css',
|
||||
'components/open-sans-fontface-' + getVersion('open-sans-fontface') + '/open-sans.css',
|
||||
'css/prettify-theme.css',
|
||||
'css/angular-topnav.css',
|
||||
'css/docs.css',
|
||||
'css/animations.css'
|
||||
]
|
||||
|
||||
+4
-3
@@ -21,21 +21,22 @@ module.exports = function jqueryDeployment(getVersion) {
|
||||
'../angular-sanitize.min.js',
|
||||
'../angular-touch.min.js',
|
||||
'../angular-animate.min.js',
|
||||
'components/marked-' + getVersion('marked', 'node_modules', 'package.json') + '/lib/marked.js',
|
||||
'components/marked-' + getVersion('marked') + '/lib/marked.js',
|
||||
'js/angular-bootstrap/dropdown-toggle.min.js',
|
||||
'components/lunr.js-' + getVersion('lunr.js') + '/lunr.min.js',
|
||||
'components/lunr-' + getVersion('lunr') + '/lunr.min.js',
|
||||
'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/prettify.js',
|
||||
'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/lang-css.js',
|
||||
'js/current-version-data.js',
|
||||
'js/all-versions-data.js',
|
||||
'js/pages-data.js',
|
||||
'js/nav-data.js',
|
||||
'js/deployment-data-jquery.js',
|
||||
'js/docs.min.js'
|
||||
],
|
||||
stylesheets: [
|
||||
'components/bootstrap-' + getVersion('bootstrap') + '/css/bootstrap.min.css',
|
||||
'components/open-sans-fontface-' + getVersion('open-sans-fontface') + '/open-sans.css',
|
||||
'css/prettify-theme.css',
|
||||
'css/angular-topnav.css',
|
||||
'css/docs.css',
|
||||
'css/animations.css'
|
||||
]
|
||||
|
||||
@@ -34,21 +34,22 @@ module.exports = function productionDeployment(getVersion) {
|
||||
cdnUrl + '/angular-sanitize.min.js',
|
||||
cdnUrl + '/angular-touch.min.js',
|
||||
cdnUrl + '/angular-animate.min.js',
|
||||
'components/marked-' + getVersion('marked', 'node_modules', 'package.json') + '/lib/marked.js',
|
||||
'components/marked-' + getVersion('marked') + '/marked.min.js',
|
||||
'js/angular-bootstrap/dropdown-toggle.min.js',
|
||||
'components/lunr.js-' + getVersion('lunr.js') + '/lunr.min.js',
|
||||
'components/lunr-' + getVersion('lunr') + '/lunr.min.js',
|
||||
'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/prettify.js',
|
||||
'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/lang-css.js',
|
||||
'js/current-version-data.js',
|
||||
'https://code.angularjs.org/snapshot/docs/js/all-versions-data.js',
|
||||
'js/pages-data.js',
|
||||
'js/nav-data.js',
|
||||
'js/deployment-data-production.js',
|
||||
'js/docs.min.js'
|
||||
],
|
||||
stylesheets: [
|
||||
'components/bootstrap-' + getVersion('bootstrap') + '/css/bootstrap.min.css',
|
||||
'components/open-sans-fontface-' + getVersion('open-sans-fontface') + '/open-sans.css',
|
||||
'css/prettify-theme.css',
|
||||
'css/angular-topnav.css',
|
||||
'css/docs.css',
|
||||
'css/animations.css'
|
||||
]
|
||||
|
||||
@@ -10,8 +10,8 @@ module.exports = function getVersion(readFilesProcessor) {
|
||||
var basePath = readFilesProcessor.basePath;
|
||||
|
||||
return function(component, sourceFolder, packageFile) {
|
||||
sourceFolder = path.resolve(basePath, sourceFolder || 'docs/bower_components');
|
||||
packageFile = packageFile || 'bower.json';
|
||||
sourceFolder = path.resolve(basePath, sourceFolder || 'node_modules');
|
||||
packageFile = packageFile || 'package.json';
|
||||
return require(path.join(sourceFolder,component,packageFile)).version;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -68,101 +68,95 @@
|
||||
})();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<body class="homepage">
|
||||
<div id="wrapper">
|
||||
<header scroll-y-offset-element class="header header-fixed">
|
||||
<section class="navbar navbar-inverse docs-navbar-primary" ng-controller="DocsSearchCtrl">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-9 header-branding">
|
||||
<a class="brand navbar-brand" href="http://angularjs.org">
|
||||
<img width="117" height="30" class="logo" alt="Link to Angular JS Homepage" ng-src="img/angularjs-for-header-only.svg">
|
||||
</a>
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="divider-vertical"></li>
|
||||
<li><a href="http://angularjs.org"><i class="icon-home icon-white"></i> Home</a></li>
|
||||
<li class="divider-vertical"></li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="icon-eye-open icon-white"></i> Learn <b class="caret"></b>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="disabled"><a href="http://angularjs.org/">Why AngularJS?</a></li>
|
||||
<li><a href="http://www.youtube.com/user/angularjs">Watch</a></li>
|
||||
<li><a href="tutorial">Tutorial</a></li>
|
||||
<li><a href="https://www.madewithangular.com/">Case Studies</a></li>
|
||||
<li><a href="https://github.com/angular/angular-seed">Seed App project template</a></li>
|
||||
<li><a href="misc/faq">FAQ</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="divider-vertical"></li>
|
||||
<li class="dropdown active">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="icon-book icon-white"></i> Develop <b class="caret"></b>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="tutorial">Tutorial</a></li>
|
||||
<li><a href="guide">Developer Guide</a></li>
|
||||
<li><a href="api">API Reference</a></li>
|
||||
<li><a href="error">Error Reference</a></li>
|
||||
<li><a href="misc/contribute">Contribute</a></li>
|
||||
<li><a href="http://code.angularjs.org/">Download</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="divider-vertical"></li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="icon-comment icon-white"></i> Discuss <b class="caret"></b>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="http://blog.angularjs.org">Blog</a></li>
|
||||
<li><a href="http://groups.google.com/group/angular">Mailing List</a></li>
|
||||
<li><a href="http://webchat.freenode.net/?channels=angularjs&uio=d4">Chat Room</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="https://twitter.com/#!/angularjs">Twitter</a></li>
|
||||
<li><a href="https://plus.google.com/110323587230527980117">Google+</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="https://github.com/angular/angular.js">GitHub</a></li>
|
||||
<li><a href="https://github.com/angular/angular.js/issues">Issue Tracker</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="divider-vertical"></li>
|
||||
</ul>
|
||||
</div>
|
||||
<form ng-class="{focus:focus}" class="navbar-search col-md-3 docs-search" ng-submit="submit()">
|
||||
<span class="glyphicon glyphicon-search search-icon"></span>
|
||||
<input type="text"
|
||||
name="as_q"
|
||||
class="search-query"
|
||||
placeholder="Click or press / to search"
|
||||
ng-focus="focus=true"
|
||||
ng-blur="focus=false"
|
||||
ng-change="search(q)"
|
||||
ng-model="q"
|
||||
docs-search-input
|
||||
autocomplete="off" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-results-container" ng-show="hasResults">
|
||||
<header class="header">
|
||||
<nav id="navbar-main" class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner" ng-controller="DocsSearchCtrl">
|
||||
<div class="container">
|
||||
<div class="search-results-frame">
|
||||
<div ng-repeat="(key, value) in results track by key" class="search-results-group" ng-class="colClassName + ' col-group-' + key" ng-show="value.length > 0">
|
||||
<h4 class="search-results-group-heading">{{ key }}</h4>
|
||||
<ul class="search-results">
|
||||
<!-- Do not insert a line break between li and a. Chrome will insert an actual line-break, which breaks the list item view.
|
||||
TODO: use a html minifier instead -->
|
||||
<li ng-repeat="item in value" class="search-result"><a ng-click="hideResults()" ng-href="{{ item.path }}">{{ item.name }}</a></li>
|
||||
<h1 class="brand"><a href="http://angularjs.org"><img width="117" height="30" src="img/angularjs-for-header-only.svg" alt="AngularJS"></a></h1>
|
||||
|
||||
<form class="navbar-search" ng-submit="submit()">
|
||||
<i class="glyphicon glyphicon-search search-icon"></i>
|
||||
<input type="text" name="as_q" class="search-query" placeholder="SEARCH"
|
||||
ng-focus="focus=true"
|
||||
ng-blur="focus=false"
|
||||
ng-change="search(q)"
|
||||
ng-model="q"
|
||||
ng-model-options="{debounce: 150}"
|
||||
docs-search-input
|
||||
autocomplete="off">
|
||||
</form>
|
||||
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="dropdown" uib-dropdown>
|
||||
<a href="#" class="dropdown-toggle" uib-dropdown-toggle>Learn</a>
|
||||
<ul class="dropdown-menu" uib-dropdown-menu>
|
||||
<li><a href="tutorial">Tutorial</a></li>
|
||||
<li><a href="misc/faq">FAQ</a></li>
|
||||
<li><a href="https://www.youtube.com/user/angularjs">Videos</a></li>
|
||||
<li><a href="http://angular.codeschool.com/">Free Course</a></li>
|
||||
<li><a href="https://www.madewithangular.com/">Case Studies</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown" uib-dropdown>
|
||||
<a href="#" class="dropdown-toggle" uib-dropdown-toggle>Develop</a>
|
||||
<ul class="dropdown-menu" uib-dropdown-menu>
|
||||
<li><a href="guide">Developer Guide</a></li>
|
||||
<li><a href="api">API Reference</a></li>
|
||||
<li><a href="error">Error Reference</a></li>
|
||||
<li><a href="misc/contribute">Contribute</a></li>
|
||||
<li><a href="https://github.com/angular/angular-seed">Seed App project template</a></li>
|
||||
<li><a href="https://github.com/angular/angular.js">GitHub</a></li>
|
||||
<li><a href="http://code.angularjs.org/">Download</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown" uib-dropdown>
|
||||
<a href="#" class="dropdown-toggle" uib-dropdown-toggle>Discuss</a>
|
||||
<ul class="dropdown-menu" uib-dropdown-menu>
|
||||
<li><a href="http://blog.angularjs.org">Blog</a></li>
|
||||
<li><a href="https://twitter.com/angular">Twitter</a></li>
|
||||
<li><a href="https://plus.google.com/110323587230527980117">Google+</a></li>
|
||||
<li><a href="https://github.com/angular/angular.js/issues">Feature & Bug Tracker</a></li>
|
||||
<li><a href="http://groups.google.com/group/angular">Mailing List</a></li>
|
||||
<li><a href="http://webchat.freenode.net/?channels=angularjs&uio=d4">IRC</a></li>
|
||||
<li><a href="https://gitter.im/angular/angular.js">Gitter</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="search-results-container" ng-show="hasResults">
|
||||
<div class="container">
|
||||
<div class="search-results-frame">
|
||||
<div ng-repeat="(key, value) in results track by key" class="search-results-group" ng-class="colClassName + ' col-group-' + key" ng-show="value.length > 0">
|
||||
<h4 class="search-results-group-heading">{{ key }}</h4>
|
||||
<ul class="search-results">
|
||||
<li ng-repeat="item in value" class="search-result"><a ng-click="hideResults()" ng-href="{{ item.path }}">{{ item.name }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<a href="" ng-click="hideResults()" class="search-close">
|
||||
<span class="glyphicon glyphicon-remove search-close-icon"></span> Close
|
||||
</a>
|
||||
</div>
|
||||
<a href="" ng-click="hideResults()" class="search-close">
|
||||
<span class="glyphicon glyphicon-remove search-close-icon"></span> Close
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="sup-header">
|
||||
</nav>
|
||||
<nav id="navbar-notice" class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<p class="site-notice visible-phone">
|
||||
This site refers to AngularJS (v1.x). <a href="https://angular.io/">Go to the latest Angular</a>.
|
||||
</p>
|
||||
<p class="site-notice visible-desktop">
|
||||
This site and all of its contents are referring to AngularJS (version 1.x),
|
||||
if you are looking for the latest Angular, please visit <a href="https://angular.io/">angular.io</a>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<nav id="navbar-sub" class="sup-header navbar navbar-fixed-top" scroll-y-offset-element>
|
||||
<div class="container main-grid main-header-grid">
|
||||
<div class="grid-left">
|
||||
<version-picker></version-picker>
|
||||
@@ -176,7 +170,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<section role="main" class="container main-body">
|
||||
@@ -214,7 +208,7 @@
|
||||
<p class="pull-right"><a back-to-top>Back to top</a></p>
|
||||
|
||||
<p>
|
||||
Super-powered by Google ©2010-2016
|
||||
Super-powered by Google ©2010-2017
|
||||
(<a id="version"
|
||||
ng-href="https://github.com/angular/angular.js/blob/master/CHANGELOG.md#{{versionNumber}}"
|
||||
ng-bind-template="v{{version}}" title="Changelog of this version of Angular JS">
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<iframe class="runnable-example-frame" src="{$ doc.example.deployments.default.outputPath $}" name="{$ doc.example.id $}"></iframe>
|
||||
<iframe class="runnable-example-frame" ng-src="{{getExampleIndex('{$ doc.example.deployments.default.path $}')}}" name="{$ doc.example.id $}"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -18,9 +18,6 @@
|
||||
<ul>
|
||||
{% if doc.restrict.element %}
|
||||
<li>as element:
|
||||
{% if doc.name.indexOf('ng') == 0 -%}
|
||||
(This directive can be used as custom element, but be aware of <a href="guide/ie">IE restrictions</a>).
|
||||
{%- endif %}
|
||||
{% code %}
|
||||
<{$ doc.name | dashCase $}
|
||||
{%- for param in doc.params %}
|
||||
@@ -61,12 +58,12 @@
|
||||
</div>
|
||||
{% endblock -%}
|
||||
|
||||
{% include "lib/params.template.html" %}
|
||||
{% include "lib/events.template.html" %}
|
||||
|
||||
{%- if doc.animations %}
|
||||
<h2 id="animations">Animations</h2>
|
||||
{$ doc.animations | marked $}
|
||||
{$ 'module:ngAnimate.$animate' | link('Click here', doc) $} to learn more about the steps involved in the animation.
|
||||
{%- endif -%}
|
||||
|
||||
{% include "lib/params.template.html" %}
|
||||
{% include "lib/events.template.html" %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
@ngdoc error
|
||||
@name $animate:nocb
|
||||
@fullName Do not pass a callback to animate methods
|
||||
@description
|
||||
|
||||
Since Angular 1.3, the methods of {@link ng.$animate} do not accept a callback as the last parameter.
|
||||
Instead, they return a promise to which you can attach `then` handlers to be run when the animation completes.
|
||||
|
||||
If you are getting this error then you need to update your code to use the promise-based API.
|
||||
|
||||
See https://github.com/angular/angular.js/commit/bf0f5502b1bbfddc5cdd2f138efd9188b8c652a9 for information about
|
||||
the change to the animation API and the changes you need to make.
|
||||
@@ -0,0 +1,8 @@
|
||||
@ngdoc error
|
||||
@name $animate:nongcls
|
||||
@fullName `ng-animate` class not allowed
|
||||
@description
|
||||
|
||||
This error occurs, when trying to set `$animateProvider.classNameFilter()` to a RegExp containing
|
||||
the reserved `ng-animate` class. Since `.ng-animate` will be added/removed by `$animate` itself,
|
||||
using it as part of the `classNameFilter` RegExp is not allowed.
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This error occurs when the restrict property of a directive is not valid.
|
||||
|
||||
The directive restrict property must be a string including one of more of the following characters:
|
||||
The directive restrict property must be a string including one or more of the following characters:
|
||||
* E (element)
|
||||
* A (attribute)
|
||||
* C (class)
|
||||
@@ -15,4 +15,4 @@ For example:
|
||||
```javascript
|
||||
restrict: 'E'
|
||||
restrict: 'EAC'
|
||||
```
|
||||
```
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
@ngdoc error
|
||||
@name $compile:missingattr
|
||||
@fullName Missing required attribute
|
||||
@description
|
||||
|
||||
This error may occur only when `$compileProvider.strictComponentBindingsEnabled` is set to `true`.
|
||||
Then all attributes mentioned in `bindings` without `?` must be set. If one or more aren't set,
|
||||
the first one will throw an error.
|
||||
@@ -0,0 +1,38 @@
|
||||
@ngdoc error
|
||||
@name $compile:noslot
|
||||
@fullName No matching slot in parent directive
|
||||
@description
|
||||
|
||||
This error occurs when declaring a specific slot in a {@link ng.ngTransclude `ngTransclude`}
|
||||
which does not map to a specific slot defined in the transclude property of the directive.
|
||||
|
||||
In this example the template has declared a slot missing from the transclude definition.
|
||||
This example will generate a noslot error.
|
||||
```js
|
||||
var componentConfig = {
|
||||
template: '<div>' +
|
||||
'<div ng-transclude="slotProvided"></div>' +
|
||||
'<div ng-transclude="noSlotProvided"></div>' +
|
||||
'</div>',
|
||||
transclude: {
|
||||
// The key value pairs here are considered "slots" that are provided for components to slot into.
|
||||
slotProvided: 'slottedComponent', // mandatory transclusion
|
||||
// There is no slot provided here for the transclude 'noSlotProvided' declared in the above template.
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
If we make the following change we will no longer get the noslot error.
|
||||
```js
|
||||
var componentConfig = {
|
||||
template: '<div>' +
|
||||
'<div ng-transclude="slotProvided"></div>' +
|
||||
'<div ng-transclude="noSlotProvided"></div>' +
|
||||
'</div>',
|
||||
transclude: {
|
||||
slotProvided: 'slottedComponent',
|
||||
noSlotProvided: 'otherComponent' // now it is declared and the error should cease
|
||||
}
|
||||
};
|
||||
|
||||
```
|
||||
@@ -0,0 +1,14 @@
|
||||
@ngdoc error
|
||||
@name $http:baddata
|
||||
@fullName Bad JSON Data
|
||||
@description
|
||||
|
||||
The default {@link ng.$http#default-transformations `transformResponse`} will try to parse the
|
||||
response as JSON if the `Content-Type` header is `application/json`, or the response looks like a
|
||||
valid JSON-stringified object or array.
|
||||
This error occurs when that data is not a valid JSON object.
|
||||
|
||||
To resolve this error, make sure you pass valid JSON data to `transformResponse`. If the response
|
||||
data looks like JSON, but has a different `Content-Type` header, you must
|
||||
{@link ng.$http#overriding-the-default-transformations-per-request implement your own response
|
||||
transformer on a per request basis}, or {@link ng.$http#default-transformations modify the default `$http` responseTransform}.
|
||||
@@ -0,0 +1,11 @@
|
||||
@ngdoc error
|
||||
@name $sanitize:elclob
|
||||
@fullName Failed to sanitize html because the element is clobbered
|
||||
@description
|
||||
|
||||
This error occurs when `$sanitize` sanitizer is unable to traverse the HTML because one or more of the elements in the
|
||||
HTML have been "clobbered". This could be a sign that the payload contains code attempting to cause a DoS attack on the
|
||||
browser.
|
||||
|
||||
Typically clobbering breaks the `nextSibling` property on an element so that it points to one of its child nodes. This
|
||||
makes it impossible to walk the HTML tree without getting stuck in an infinite loop, which causes the browser to freeze.
|
||||
@@ -0,0 +1,7 @@
|
||||
@ngdoc error
|
||||
@name ng:aobj
|
||||
@fullName Invalid Argument
|
||||
@description
|
||||
|
||||
The argument passed should be an object. Check the value that was passed to the function where
|
||||
this error was thrown.
|
||||
@@ -232,27 +232,27 @@ than the hash fragment was changed.
|
||||
### Example
|
||||
|
||||
```js
|
||||
it('should show example', inject(
|
||||
function($locationProvider) {
|
||||
it('should show example', function() {
|
||||
module(function($locationProvider) {
|
||||
$locationProvider.html5Mode(false);
|
||||
$locationProvider.hashPrefix('!');
|
||||
},
|
||||
function($location) {
|
||||
});
|
||||
inject(function($location) {
|
||||
// open http://example.com/base/index.html#!/a
|
||||
$location.absUrl() === 'http://example.com/base/index.html#!/a'
|
||||
$location.path() === '/a'
|
||||
expect($location.absUrl()).toBe('http://example.com/base/index.html#!/a');
|
||||
expect($location.path()).toBe('/a');
|
||||
|
||||
$location.path('/foo')
|
||||
$location.absUrl() === 'http://example.com/base/index.html#!/foo'
|
||||
$location.path('/foo');
|
||||
expect($location.absUrl()).toBe('http://example.com/base/index.html#!/foo');
|
||||
|
||||
$location.search() === {}
|
||||
expect($location.search()).toEqual({});
|
||||
$location.search({a: 'b', c: true});
|
||||
$location.absUrl() === 'http://example.com/base/index.html#!/foo?a=b&c'
|
||||
expect($location.absUrl()).toBe('http://example.com/base/index.html#!/foo?a=b&c');
|
||||
|
||||
$location.path('/new').search('x=y');
|
||||
$location.absUrl() === 'http://example.com/base/index.html#!/new?x=y'
|
||||
}
|
||||
));
|
||||
expect($location.absUrl()).toBe('http://example.com/base/index.html#!/new?x=y');
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## HTML5 mode
|
||||
@@ -274,40 +274,50 @@ and updates the url in a way that never performs a full page reload.
|
||||
### Example
|
||||
|
||||
```js
|
||||
it('should show example', inject(
|
||||
function($locationProvider) {
|
||||
it('should show example', function() {
|
||||
module(function($locationProvider) {
|
||||
$locationProvider.html5Mode(true);
|
||||
$locationProvider.hashPrefix('!');
|
||||
},
|
||||
function($location) {
|
||||
});
|
||||
inject(function($location) {
|
||||
// in browser with HTML5 history support:
|
||||
// open http://example.com/#!/a -> rewrite to http://example.com/a
|
||||
// (replacing the http://example.com/#!/a history record)
|
||||
$location.path() === '/a'
|
||||
expect($location.path()).toBe('/a');
|
||||
|
||||
$location.path('/foo');
|
||||
$location.absUrl() === 'http://example.com/foo'
|
||||
expect($location.absUrl()).toBe('http://example.com/foo');
|
||||
|
||||
$location.search() === {}
|
||||
expect($location.search()).toEqual({});
|
||||
$location.search({a: 'b', c: true});
|
||||
$location.absUrl() === 'http://example.com/foo?a=b&c'
|
||||
expect($location.absUrl()).toBe('http://example.com/foo?a=b&c');
|
||||
|
||||
$location.path('/new').search('x=y');
|
||||
$location.url() === 'new?x=y'
|
||||
$location.absUrl() === 'http://example.com/new?x=y'
|
||||
expect($location.url()).toBe('/new?x=y');
|
||||
expect($location.absUrl()).toBe('http://example.com/new?x=y');
|
||||
});
|
||||
});
|
||||
|
||||
it('should show example (when browser doesn\'t support HTML5 mode', function() {
|
||||
module(function($provide, $locationProvider) {
|
||||
$locationProvider.html5Mode(true);
|
||||
$locationProvider.hashPrefix('!');
|
||||
$provide.value('$sniffer', {history: false});
|
||||
});
|
||||
inject(initBrowser({ url: 'http://example.com/new?x=y', basePath: '/' }),
|
||||
function($location) {
|
||||
// in browser without html5 history support:
|
||||
// open http://example.com/new?x=y -> redirect to http://example.com/#!/new?x=y
|
||||
// (again replacing the http://example.com/new?x=y history item)
|
||||
$location.path() === '/new'
|
||||
$location.search() === {x: 'y'}
|
||||
expect($location.path()).toBe('/new');
|
||||
expect($location.search()).toEqual({x: 'y'});
|
||||
|
||||
$location.path('/foo/bar');
|
||||
$location.path() === '/foo/bar'
|
||||
$location.url() === '/foo/bar?x=y'
|
||||
$location.absUrl() === 'http://example.com/#!/foo/bar?x=y'
|
||||
}
|
||||
));
|
||||
expect($location.path()).toBe('/foo/bar');
|
||||
expect($location.url()).toBe('/foo/bar?x=y');
|
||||
expect($location.absUrl()).toBe('http://example.com/#!/foo/bar?x=y');
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
### Fallback for legacy browsers
|
||||
@@ -555,7 +565,7 @@ In these examples we use `<base href="/base/index.html" />`. The inputs represen
|
||||
|
||||
</example>
|
||||
|
||||
####Browser in HTML5 Fallback mode (Hashbang mode)
|
||||
#### Browser in HTML5 Fallback mode (Hashbang mode)
|
||||
<example module="hashbang-mode" name="location-hashbang-mode">
|
||||
<file name="index.html">
|
||||
<div ng-controller="LocationController">
|
||||
|
||||
+253
-206
@@ -6,20 +6,26 @@
|
||||
|
||||
# Animations
|
||||
|
||||
AngularJS provides animation hooks for common directives such as `ngRepeat`, `ngSwitch`, and `ngView`, as well as custom directives
|
||||
via the `$animate` service. These animation hooks are set in place to trigger animations during the life cycle of various directives and when
|
||||
triggered, will attempt to perform a CSS Transition, CSS Keyframe Animation or a JavaScript callback Animation (depending on if an animation is
|
||||
placed on the given directive). Animations can be placed using vanilla CSS by following the naming conventions set in place by AngularJS
|
||||
or with JavaScript code when it's defined as a factory.
|
||||
AngularJS provides animation hooks for common directives such as
|
||||
{@link ng.directive:ngRepeat ngRepeat}, {@link ng.directive:ngSwitch ngSwitch}, and
|
||||
{@link ngRoute.directive:ngView ngView}, as well as custom directives via the `$animate` service.
|
||||
These animation hooks are set in place to trigger animations during the life cycle of various
|
||||
directives and when triggered, will attempt to perform a CSS Transition, CSS Keyframe Animation or a
|
||||
JavaScript callback Animation (depending on whether an animation is placed on the given directive).
|
||||
Animations can be placed using vanilla CSS by following the naming conventions set in place by
|
||||
AngularJS or with JavaScript code, defined as a factory.
|
||||
|
||||
<div class="alert alert-info">
|
||||
Note that we have used non-prefixed CSS transition properties in our examples as the major browsers now support non-prefixed
|
||||
properties. If you intend to support older browsers or certain mobile browsers then you will need to include prefixed
|
||||
versions of the transition properties. Take a look at http://caniuse.com/#feat=css-transitions for what browsers require prefixes,
|
||||
and https://github.com/postcss/autoprefixer for a tool that can automatically generate the prefixes for you.
|
||||
Note that we have used non-prefixed CSS transition properties in our examples as the major
|
||||
browsers now support non-prefixed properties. If you intend to support older browsers or certain
|
||||
mobile browsers then you will need to include prefixed versions of the transition properties. Take
|
||||
a look at http://caniuse.com/#feat=css-transitions for what browsers require prefixes, and
|
||||
https://github.com/postcss/autoprefixer for a tool that can automatically generate the prefixes
|
||||
for you.
|
||||
</div>
|
||||
|
||||
Animations are not available unless you include the {@link ngAnimate `ngAnimate` module} as a dependency within your application.
|
||||
Animations are not available unless you include the {@link ngAnimate `ngAnimate` module} as a
|
||||
dependency of your application.
|
||||
|
||||
Below is a quick example of animations being enabled for `ngShow` and `ngHide`:
|
||||
|
||||
@@ -59,8 +65,9 @@ You may also want to setup a separate CSS file for defining CSS-based animations
|
||||
|
||||
## How they work
|
||||
|
||||
Animations in AngularJS are completely based on CSS classes. As long as you have a CSS class attached to a HTML element within
|
||||
your website, you can apply animations to it. Lets say for example that we have an HTML template with a repeater in it like so:
|
||||
Animations in AngularJS are completely based on CSS classes. As long as you have a CSS class
|
||||
attached to a HTML element within your application, you can apply animations to it. Lets say for
|
||||
example that we have an HTML template with a repeater like so:
|
||||
|
||||
```html
|
||||
<div ng-repeat="item in items" class="repeated-item">
|
||||
@@ -68,22 +75,21 @@ your website, you can apply animations to it. Lets say for example that we have
|
||||
</div>
|
||||
```
|
||||
|
||||
As you can see, the `.repeated-item` class is present on the element that will be repeated and this class will be
|
||||
used as a reference within our application's CSS and/or JavaScript animation code to tell AngularJS to perform an animation.
|
||||
As you can see, the `repeated-item` class is present on the element that will be repeated and this
|
||||
class will be used as a reference within our application's CSS and/or JavaScript animation code to
|
||||
tell AngularJS to perform an animation.
|
||||
|
||||
As ngRepeat does its thing, each time a new item is added into the list, ngRepeat will add
|
||||
a `ng-enter` class name to the element that is being added. When removed it will apply a `ng-leave` class name and when moved around
|
||||
it will apply a `ng-move` class name.
|
||||
As `ngRepeat` does its thing, each time a new item is added into the list, `ngRepeat` will add an
|
||||
`ng-enter` class to the element that is being added. When removed it will apply an `ng-leave` class
|
||||
and when moved around it will apply an `ng-move` class.
|
||||
|
||||
Taking a look at the following CSS code, we can see some transition and keyframe animation code set for each of those events that
|
||||
occur when ngRepeat triggers them:
|
||||
Taking a look at the following CSS code, we can see some transition and keyframe animation code set
|
||||
up for each of those events that occur when `ngRepeat` triggers them:
|
||||
|
||||
```css
|
||||
/*
|
||||
We're using CSS transitions for when
|
||||
the enter and move events are triggered
|
||||
for the element that has the .repeated-item
|
||||
class
|
||||
We are using CSS transitions for when the enter and move events
|
||||
are triggered for the element that has the `repeated-item` class
|
||||
*/
|
||||
.repeated-item.ng-enter, .repeated-item.ng-move {
|
||||
transition: all 0.5s linear;
|
||||
@@ -91,10 +97,8 @@ occur when ngRepeat triggers them:
|
||||
}
|
||||
|
||||
/*
|
||||
The ng-enter-active and ng-move-active
|
||||
are where the transition destination properties
|
||||
are set so that the animation knows what to
|
||||
animate.
|
||||
`.ng-enter-active` and `.ng-move-active` are where the transition destination
|
||||
properties are set so that the animation knows what to animate
|
||||
*/
|
||||
.repeated-item.ng-enter.ng-enter-active,
|
||||
.repeated-item.ng-move.ng-move-active {
|
||||
@@ -102,148 +106,149 @@ occur when ngRepeat triggers them:
|
||||
}
|
||||
|
||||
/*
|
||||
We're using CSS keyframe animations for when
|
||||
the leave event is triggered for the element
|
||||
that has the .repeated-item class
|
||||
We are using CSS keyframe animations for when the `leave` event
|
||||
is triggered for the element that has the `repeated-item` class
|
||||
*/
|
||||
.repeated-item.ng-leave {
|
||||
animation: 0.5s my_animation;
|
||||
}
|
||||
|
||||
@keyframes my_animation {
|
||||
from { opacity:1; }
|
||||
to { opacity:0; }
|
||||
from { opacity: 1; }
|
||||
to { opacity: 0; }
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
The same approach to animation can be used using JavaScript code (**jQuery is used within to perform animations**):
|
||||
The same approach to animation can be used using JavaScript code
|
||||
(**for simplicity, we rely on jQuery to perform animations here**):
|
||||
|
||||
```js
|
||||
myModule.animation('.repeated-item', function() {
|
||||
return {
|
||||
enter : function(element, done) {
|
||||
element.css('opacity',0);
|
||||
jQuery(element).animate({
|
||||
opacity: 1
|
||||
}, done);
|
||||
|
||||
// optional onDone or onCancel callback
|
||||
// function to handle any post-animation
|
||||
// cleanup operations
|
||||
return function(isCancelled) {
|
||||
if(isCancelled) {
|
||||
jQuery(element).stop();
|
||||
}
|
||||
}
|
||||
},
|
||||
leave : function(element, done) {
|
||||
element.css('opacity', 1);
|
||||
jQuery(element).animate({
|
||||
opacity: 0
|
||||
}, done);
|
||||
|
||||
// optional onDone or onCancel callback
|
||||
// function to handle any post-animation
|
||||
// cleanup operations
|
||||
return function(isCancelled) {
|
||||
if(isCancelled) {
|
||||
jQuery(element).stop();
|
||||
}
|
||||
}
|
||||
},
|
||||
move : function(element, done) {
|
||||
enter: function(element, done) {
|
||||
// Initialize the element's opacity
|
||||
element.css('opacity', 0);
|
||||
jQuery(element).animate({
|
||||
opacity: 1
|
||||
}, done);
|
||||
|
||||
// optional onDone or onCancel callback
|
||||
// function to handle any post-animation
|
||||
// cleanup operations
|
||||
// Animate the element's opacity
|
||||
// (`element.animate()` is provided by jQuery)
|
||||
element.animate({opacity: 1}, done);
|
||||
|
||||
// Optional `onDone`/`onCancel` callback function
|
||||
// to handle any post-animation cleanup operations
|
||||
return function(isCancelled) {
|
||||
if(isCancelled) {
|
||||
jQuery(element).stop();
|
||||
if (isCancelled) {
|
||||
// Abort the animation if cancelled
|
||||
// (`element.stop()` is provided by jQuery)
|
||||
element.stop();
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
leave: function(element, done) {
|
||||
// Initialize the element's opacity
|
||||
element.css('opacity', 1);
|
||||
|
||||
// Animate the element's opacity
|
||||
// (`element.animate()` is provided by jQuery)
|
||||
element.animate({opacity: 0}, done);
|
||||
|
||||
// Optional `onDone`/`onCancel` callback function
|
||||
// to handle any post-animation cleanup operations
|
||||
return function(isCancelled) {
|
||||
if (isCancelled) {
|
||||
// Abort the animation if cancelled
|
||||
// (`element.stop()` is provided by jQuery)
|
||||
element.stop();
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
// you can also capture these animation events
|
||||
addClass : function(element, className, done) {},
|
||||
removeClass : function(element, className, done) {}
|
||||
// We can also capture the following animation events:
|
||||
move: function(element, done) {},
|
||||
addClass: function(element, className, done) {},
|
||||
removeClass: function(element, className, done) {}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
With these generated CSS class names present on the element at the time, AngularJS automatically
|
||||
figures out whether to perform a CSS and/or JavaScript animation. If both CSS and JavaScript animation
|
||||
code is present, and match the CSS class name on the element, then AngularJS will run both animations at the same time.
|
||||
figures out whether to perform a CSS and/or JavaScript animation. Note that you can't have both CSS
|
||||
and JavaScript animations based on the same CSS class. See
|
||||
{@link ngAnimate#css-js-animations-together here} for more details.
|
||||
|
||||
## Class and ngClass animation hooks
|
||||
## Class and `ngClass` animation hooks
|
||||
|
||||
AngularJS also pays attention to CSS class changes on elements by triggering the **add** and **remove** hooks.
|
||||
This means that if a CSS class is added to or removed from an element then an animation can be executed in between,
|
||||
before the CSS class addition or removal is finalized. (Keep in mind that AngularJS will only be
|
||||
able to capture class changes if an **expression** or the **ng-class** directive is used on the element.)
|
||||
AngularJS also pays attention to CSS class changes on elements by triggering the **add** and
|
||||
**remove** hooks. This means that if a CSS class is added to or removed from an element then an
|
||||
animation can be executed in between, before the CSS class addition or removal is finalized.
|
||||
(Keep in mind that AngularJS will only be able to capture class changes if an
|
||||
**interpolated expression** or the **ng-class** directive is used on the element.)
|
||||
|
||||
The example below shows how to perform animations during class changes:
|
||||
|
||||
<example module="ngAnimate" deps="angular-animate.js" animations="true" name="animate-css-class">
|
||||
<file name="index.html">
|
||||
<p>
|
||||
<input type="button" value="set" ng-click="myCssVar='css-class'">
|
||||
<input type="button" value="clear" ng-click="myCssVar=''">
|
||||
<br>
|
||||
<span ng-class="myCssVar">CSS-Animated Text</span>
|
||||
</p>
|
||||
</file>
|
||||
<file name="style.css">
|
||||
.css-class-add, .css-class-remove {
|
||||
transition: all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
||||
}
|
||||
<file name="index.html">
|
||||
<p>
|
||||
<button ng-click="myCssVar='css-class'">Set</button>
|
||||
<button ng-click="myCssVar=''">Clear</button>
|
||||
<br>
|
||||
<span ng-class="myCssVar">CSS-Animated Text</span>
|
||||
</p>
|
||||
</file>
|
||||
<file name="style.css">
|
||||
.css-class-add, .css-class-remove {
|
||||
transition: all 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940);
|
||||
}
|
||||
|
||||
.css-class,
|
||||
.css-class-add.css-class-add-active {
|
||||
color: red;
|
||||
font-size:3em;
|
||||
}
|
||||
.css-class,
|
||||
.css-class-add.css-class-add-active {
|
||||
color: red;
|
||||
font-size: 3em;
|
||||
}
|
||||
|
||||
.css-class-remove.css-class-remove-active {
|
||||
font-size:1.0em;
|
||||
color: black;
|
||||
}
|
||||
</file>
|
||||
.css-class-remove.css-class-remove-active {
|
||||
font-size: 1em;
|
||||
color: black;
|
||||
}
|
||||
</file>
|
||||
</example>
|
||||
|
||||
Although the CSS is a little different than what we saw before, the idea is the same.
|
||||
|
||||
## Which directives support animations?
|
||||
|
||||
A handful of common AngularJS directives support and trigger animation hooks whenever any major event occurs during its life cycle.
|
||||
The table below explains in detail which animation events are triggered
|
||||
A handful of common AngularJS directives support and trigger animation hooks whenever any major
|
||||
event occurs during their life cycle. The table below explains in detail which animation events are
|
||||
triggered:
|
||||
|
||||
| Directive | Supported Animations |
|
||||
|-------------------------------------------------------------------------------------|------------------------------------------|
|
||||
| {@link ng.directive:ngRepeat#animations ngRepeat} | enter, leave, and move |
|
||||
| {@link ngRoute.directive:ngView#animations ngView} | enter and leave |
|
||||
| {@link ng.directive:ngInclude#animations ngInclude} | enter and leave |
|
||||
| {@link ng.directive:ngSwitch#animations ngSwitch} | enter and leave |
|
||||
| {@link ng.directive:ngIf#animations ngIf} | enter and leave |
|
||||
| {@link ng.directive:ngClass#animations ngClass or {{class}}} | add and remove |
|
||||
| {@link ng.directive:ngShow#animations ngShow & ngHide} | add and remove (the ng-hide class value) |
|
||||
| Directive | Supported Animations |
|
||||
|-------------------------------------------------------------------------------|---------------------------------------------------------------------------|
|
||||
| {@link ng.directive:ngRepeat#animations ngRepeat} | enter, leave, and move |
|
||||
| {@link ng.directive:ngIf#animations ngIf} | enter and leave |
|
||||
| {@link ng.directive:ngSwitch#animations ngSwitch} | enter and leave |
|
||||
| {@link ng.directive:ngInclude#animations ngInclude} | enter and leave |
|
||||
| {@link ngRoute.directive:ngView#animations ngView} | enter and leave |
|
||||
| {@link module:ngMessages#animations ngMessage / ngMessageExp} | enter and leave |
|
||||
| {@link ng.directive:ngClass#animations ngClass / {{class}​}} | add and remove |
|
||||
| {@link ng.directive:ngClass#animations ngClassEven / ngClassOdd} | add and remove |
|
||||
| {@link ng.directive:ngHide#animations ngHide} | add and remove (the `ng-hide` class) |
|
||||
| {@link ng.directive:ngShow#animations ngShow} | add and remove (the `ng-hide` class) |
|
||||
| {@link ng.directive:ngModel#animation-hooks ngModel} | add and remove ({@link ng.directive:ngModel#css-classes various classes}) |
|
||||
| {@link ng.directive:form#animation-hooks form / ngForm} | add and remove ({@link ng.directive:form#css-classes various classes}) |
|
||||
| {@link module:ngMessages#animations ngMessages} | add and remove (the `ng-active`/`ng-inactive` classes) |
|
||||
|
||||
For a full breakdown of the steps involved during each animation event, refer to the {@link ng.$animate API docs}.
|
||||
For a full breakdown of the steps involved during each animation event, refer to the
|
||||
{@link ng.$animate API docs}.
|
||||
|
||||
## How do I use animations in my own directives?
|
||||
|
||||
Animations within custom directives can also be established by injecting `$animate` directly into your directive and
|
||||
making calls to it when needed.
|
||||
Animations within custom directives can also be established by injecting `$animate` directly into
|
||||
your directive and making calls to it when needed.
|
||||
|
||||
```js
|
||||
myModule.directive('my-directive', ['$animate', function($animate) {
|
||||
return function(scope, element, attrs) {
|
||||
return function(scope, element) {
|
||||
element.on('click', function() {
|
||||
if(element.hasClass('clicked')) {
|
||||
if (element.hasClass('clicked')) {
|
||||
$animate.removeClass(element, 'clicked');
|
||||
} else {
|
||||
$animate.addClass(element, 'clicked');
|
||||
@@ -255,17 +260,19 @@ myModule.directive('my-directive', ['$animate', function($animate) {
|
||||
|
||||
## Animations on app bootstrap / page load
|
||||
|
||||
By default, animations are disabled when the Angular app {@link guide/bootstrap bootstraps}. If you are using the {@link ngApp} directive,
|
||||
this happens in the `DOMContentLoaded` event, so immediately after the page has been loaded.
|
||||
Animations are disabled, so that UI and content are instantly visible. Otherwise, with many animations on
|
||||
the page, the loading process may become too visually overwhelming, and the performance may suffer.
|
||||
By default, animations are disabled when the AngularJS app {@link guide/bootstrap bootstraps}. If you
|
||||
are using the {@link ngApp} directive, this happens in the `DOMContentLoaded` event, so immediately
|
||||
after the page has been loaded. Animations are disabled, so that UI and content are instantly
|
||||
visible. Otherwise, with many animations on the page, the loading process may become too visually
|
||||
overwhelming, and the performance may suffer.
|
||||
|
||||
Internally, `ngAnimate` waits until all template downloads that are started right after bootstrap have finished.
|
||||
Then, it waits for the currently running {@link ng.$rootScope.Scope#$digest} and the one after that to finish.
|
||||
This ensures that the whole app has been compiled fully before animations are attempted.
|
||||
Internally, `ngAnimate` waits until all template downloads that are started right after bootstrap
|
||||
have finished. Then, it waits for the currently running {@link ng.$rootScope.Scope#$digest $digest}
|
||||
and one more after that, to finish. This ensures that the whole app has been compiled fully before
|
||||
animations are attempted.
|
||||
|
||||
If you do want your animations to play when the app bootstraps, you can enable animations globally in
|
||||
your main module's {@link angular.Module#run run} function:
|
||||
If you do want your animations to play when the app bootstraps, you can enable animations globally
|
||||
in your main module's {@link angular.Module#run run} function:
|
||||
|
||||
```js
|
||||
myModule.run(function($animate) {
|
||||
@@ -275,17 +282,50 @@ myModule.run(function($animate) {
|
||||
|
||||
## How to (selectively) enable, disable and skip animations
|
||||
|
||||
There are three different ways to disable animations, both globally and for specific animations.
|
||||
Disabling specific animations can help to speed up the render performance, for example for large `ngRepeat`
|
||||
lists that don't actually have animations. Because ngAnimate checks at runtime if animations are present,
|
||||
performance will take a hit even if an element has no animation.
|
||||
There are several different ways to disable animations, both globally and for specific animations.
|
||||
Disabling specific animations can help to speed up the render performance, for example for large
|
||||
`ngRepeat` lists that don't actually have animations. Because `ngAnimate` checks at runtime if
|
||||
animations are present, performance will take a hit even if an element has no animation.
|
||||
|
||||
### In the config: {@link $animateProvider#classNameFilter $animateProvider.classNameFilter()}
|
||||
### During the config: {@link $animateProvider#customFilter $animateProvider.customFilter()}
|
||||
|
||||
This function can be called in the {@link angular.Module#config config} phase of an app. It takes a regex as the only argument,
|
||||
which will then be matched against the classes of any element that is about to be animated. The regex
|
||||
allows a lot of flexibility - you can either allow animations only for specific classes (useful when
|
||||
you are working with 3rd party animations), or exclude specific classes from getting animated.
|
||||
This function can be called during the {@link angular.Module#config config} phase of an app. It
|
||||
takes a filter function as the only argument, which will then be used to "filter" animations (based
|
||||
on the animated element, the event type, and the animation options). Only when the filter function
|
||||
returns `true`, will the animation be performed. This allows great flexibility - you can easily
|
||||
create complex rules, such as allowing specific events only or enabling animations on specific
|
||||
subtrees of the DOM, and dynamically modify them, for example disabling animations at certain points
|
||||
in time or under certain circumstances.
|
||||
|
||||
```js
|
||||
app.config(function($animateProvider) {
|
||||
$animateProvider.customFilter(function(node, event, options) {
|
||||
// Example: Only animate `enter` and `leave` operations.
|
||||
return event === 'enter' || event === 'leave';
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
The `customFilter` approach generally gives a big speed boost compared to other strategies, because
|
||||
the matching is done before other animation disabling strategies are checked.
|
||||
|
||||
<div class="alert alert-success">
|
||||
**Best Practice:**
|
||||
Keep the filtering function as lean as possible, because it will be called for each DOM
|
||||
action (e.g. insertion, removal, class change) performed by "animation-aware" directives.
|
||||
See {@link guide/animations#which-directives-support-animations- here} for a list of built-in
|
||||
directives that support animations.
|
||||
Performing computationally expensive or time-consuming operations on each call of the
|
||||
filtering function can make your animations sluggish.
|
||||
</div>
|
||||
|
||||
### During the config: {@link $animateProvider#classNameFilter $animateProvider.classNameFilter()}
|
||||
|
||||
This function too can be called during the {@link angular.Module#config config} phase of an app. It
|
||||
takes a regex as the only argument, which will then be matched against the classes of any element
|
||||
that is about to be animated. The regex allows a lot of flexibility - you can either allow
|
||||
animations for specific classes only (useful when you are working with 3rd party animations), or
|
||||
exclude specific classes from getting animated.
|
||||
|
||||
```js
|
||||
app.config(function($animateProvider) {
|
||||
@@ -294,42 +334,43 @@ app.config(function($animateProvider) {
|
||||
```
|
||||
|
||||
```css
|
||||
/* prefixed with animate- */
|
||||
/* prefixed with `animate-` */
|
||||
.animate-fade-add.animate-fade-add-active {
|
||||
transition: all 1s linear;
|
||||
opacity: 0;
|
||||
}
|
||||
```
|
||||
|
||||
The classNameFilter approach generally applies the biggest speed boost, because the matching is
|
||||
done before any other animation disabling strategies are checked. However, that also means it is not
|
||||
possible to override class name matching with the two following strategies. It's of course still possible
|
||||
to enable / disable animations by changing an element's class name at runtime.
|
||||
The `classNameFilter` approach generally gives a big speed boost compared to other strategies,
|
||||
because the matching is done before other animation disabling strategies are checked. However, that
|
||||
also means it is not possible to override class name matching with the two following strategies.
|
||||
It's of course still possible to enable / disable animations by changing an element's class name at
|
||||
runtime.
|
||||
|
||||
### At runtime: {@link ng.$animate#enabled $animate.enabled()}
|
||||
|
||||
This function can be used to enable / disable animations in two different ways:
|
||||
|
||||
With a single `boolean` argument, it enables / disables animations globally: `$animate.enabled(false)`
|
||||
disables all animations in your app.
|
||||
With a single `boolean` argument, it enables / disables animations globally:
|
||||
`$animate.enabled(false)` disables all animations in your app.
|
||||
|
||||
When the first argument is a native DOM or jqLite/jQuery element, the function enables / disables
|
||||
animations on this element *and all its children*: `$animate.enabled(myElement, false)`. This is the
|
||||
most flexible way to change the animation state. For example, even if you have used it to disable
|
||||
animations on a parent element, you can still re-enable it for a child element. And compared to the
|
||||
`classNameFilter`, you can change the animation status at runtime instead of during the config phase.
|
||||
animations on this element *and all its children*: `$animate.enabled(myElement, false)`. You can
|
||||
still use it to re-enable animations for a child element, even if you have disabled them on a parent
|
||||
element. And compared to the `classNameFilter`, you can change the animation status at runtime
|
||||
instead of during the config phase.
|
||||
|
||||
Note however that the `$animate.enabled()` state for individual elements does not overwrite disabling
|
||||
rules that have been set in the {@link $animateProvider#classNameFilter classNameFilter}.
|
||||
Note however that the `$animate.enabled()` state for individual elements does not overwrite
|
||||
disabling rules that have been set in the {@link $animateProvider#classNameFilter classNameFilter}.
|
||||
|
||||
### Via CSS styles: overwriting styles in the `ng-animate` CSS class
|
||||
Whenever an animation is started, ngAnimate applies the `ng-animate` class to the element for the
|
||||
whole duration of the animation. By applying CSS transition / animation styling to the class,
|
||||
you can skip an animation:
|
||||
|
||||
Whenever an animation is started, `ngAnimate` applies the `ng-animate` class to the element for the
|
||||
whole duration of the animation. By applying CSS transition / animation styling to that class, you
|
||||
can skip an animation:
|
||||
|
||||
```css
|
||||
|
||||
.my-class{
|
||||
.my-class {
|
||||
transition: transform 2s;
|
||||
}
|
||||
|
||||
@@ -340,23 +381,23 @@ you can skip an animation:
|
||||
my-class.ng-animate {
|
||||
transition: 0s;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
By setting `transition: 0s`, ngAnimate will ignore the existing transition styles, and not try to animate them (Javascript
|
||||
animations will still execute, though). This can be used to prevent {@link guide/animations#preventing-collisions-with-existing-animations-and-third-party-libraries
|
||||
issues with existing animations interfering with ngAnimate}.
|
||||
By setting `transition: 0s`, `ngAnimate` will ignore the existing transition styles, and not try to
|
||||
animate them (Javascript animations will still execute, though). This can be used to prevent
|
||||
{@link guide/animations#preventing-collisions-with-existing-animations-and-third-party-libraries
|
||||
issues with existing animations interfering with `ngAnimate`}.
|
||||
|
||||
|
||||
## Preventing flicker before an animation starts
|
||||
|
||||
When nesting elements with structural animations such as `ngIf` into elements that have class-based
|
||||
animations such as `ngClass`, it sometimes happens that before the actual animation starts, there is a brief flicker or flash of content
|
||||
where the animated element is briefly visible.
|
||||
When nesting elements with structural animations, such as `ngIf`, into elements that have
|
||||
class-based animations such as `ngClass`, it sometimes happens that before the actual animation
|
||||
starts, there is a brief flicker or flash of content where the animated element is briefly visible.
|
||||
|
||||
To prevent this, you can apply styles to the `ng-[event]-prepare` class, which is added as soon as an animation is initialized,
|
||||
but removed before the actual animation starts (after waiting for a $digest). This class is only added for *structural*
|
||||
animations (`enter`, `move`, and `leave`).
|
||||
To prevent this, you can apply styles to the `ng-[event]-prepare` class, which is added as soon as
|
||||
an animation is initialized, but removed before the actual animation starts (after waiting for a
|
||||
`$digest`). This class is only added for *structural* animations (`enter`, `move`, and `leave`).
|
||||
|
||||
Here's an example where you might see flickering:
|
||||
|
||||
@@ -368,8 +409,9 @@ Here's an example where you might see flickering:
|
||||
</div>
|
||||
```
|
||||
|
||||
It is possible that during the `enter` event, the `.message` div will be briefly visible before it starts animating.
|
||||
In that case, you can add styles to the CSS that make sure the element stays hidden before the animation starts:
|
||||
It is possible that during the `enter` event, the `.message` div will be briefly visible before it
|
||||
starts animating. In that case, you can add styles to the CSS that make sure the element stays
|
||||
hidden before the animation starts:
|
||||
|
||||
```css
|
||||
.message.ng-enter-prepare {
|
||||
@@ -379,66 +421,71 @@ In that case, you can add styles to the CSS that make sure the element stays hid
|
||||
/* Other animation styles ... */
|
||||
```
|
||||
|
||||
## Preventing Collisions with Existing Animations and Third Party Libraries
|
||||
By default, any `ngAnimate` enabled directives will assume any transition / animation styles on the
|
||||
element are part of an `ngAnimate` animation. This can lead to problems when the styles are actually
|
||||
for animations that are independent of `ngAnimate`.
|
||||
## Preventing collisions with existing animations and third-party libraries
|
||||
|
||||
For example, an element acts as a loading spinner. It has an infinite css animation on it, and also an
|
||||
{@link ngIf `ngIf`} directive, for which no animations are defined:
|
||||
By default, any `ngAnimate`-enabled directives will assume that `transition` / `animation` styles on
|
||||
the element are part of an `ngAnimate` animation. This can lead to problems when the styles are
|
||||
actually for animations that are independent of `ngAnimate`.
|
||||
|
||||
For example, an element acts as a loading spinner. It has an infinite css animation on it, and also
|
||||
an {@link ngIf `ngIf`} directive, for which no animations are defined:
|
||||
|
||||
```css
|
||||
@keyframes rotating {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
.spinner {
|
||||
animation: rotating 2s linear infinite;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
animation: rotating 2s linear infinite;
|
||||
@keyframes rotating {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
```
|
||||
|
||||
Now, when the `ngIf` changes, `ngAnimate` will see the spinner animation and use
|
||||
it to animate the `enter`/`leave` event, which doesn't work because
|
||||
the animation is infinite. The element will still be added / removed after a timeout, but there will be a
|
||||
noticable delay.
|
||||
Now, when the `ngIf` expression changes, `ngAnimate` will see the spinner animation and use it to
|
||||
animate the `enter`/`leave` event, which doesn't work because the animation is infinite. The element
|
||||
will still be added / removed after a timeout, but there will be a noticeable delay.
|
||||
|
||||
This might also happen because some third-party frameworks place animation duration defaults
|
||||
across many element or className selectors in order to make their code small and reuseable.
|
||||
This might also happen because some third-party frameworks place animation duration defaults across
|
||||
many element or className selectors in order to make their code small and reusable.
|
||||
|
||||
You can prevent this unwanted behavior by adding CSS to the `.ng-animate` class that is added
|
||||
for the whole duration of an animation. Simply overwrite the transition / animation duration. In the
|
||||
You can prevent this unwanted behavior by adding CSS to the `.ng-animate` class, that is added for
|
||||
the whole duration of each animation. Simply overwrite the transition / animation duration. In the
|
||||
case of the spinner, this would be:
|
||||
|
||||
```css
|
||||
.spinner.ng-animate {
|
||||
transition: 0s none;
|
||||
animation: 0s none;
|
||||
animation: 0s none;
|
||||
transition: 0s none;
|
||||
}
|
||||
```
|
||||
|
||||
If you do have CSS transitions / animations defined for the animation events, make sure they have higher priority
|
||||
than any styles that are independent from ngAnimate.
|
||||
If you do have CSS transitions / animations defined for the animation events, make sure they have a
|
||||
higher priority than any styles that are not related to `ngAnimate`.
|
||||
|
||||
You can also use one of the two other {@link guide/animations#how-to-selectively-enable-disable-and-skip-animations strategies to disable animations}.
|
||||
You can also use one of the other
|
||||
{@link guide/animations#how-to-selectively-enable-disable-and-skip-animations
|
||||
strategies to disable animations}.
|
||||
|
||||
|
||||
### Enable animations for elements outside of the Angular application DOM tree: {@link ng.$animate#pin $animate.pin()}
|
||||
## Enable animations outside of the application DOM tree: {@link ng.$animate#pin $animate.pin()}
|
||||
|
||||
Before animating, `ngAnimate` checks to see if the element being animated is inside the application DOM tree,
|
||||
and if it is not, no animation is run. Usually, this is not a problem as most apps use the `ngApp`
|
||||
attribute / bootstrap the app on the `html` or `body` element.
|
||||
Before animating, `ngAnimate` checks if the animated element is inside the application DOM tree. If
|
||||
not, no animation is run. Usually, this is not a problem since most apps use the `html` or `body`
|
||||
elements as their root.
|
||||
|
||||
Problems arise when the application is bootstrapped on a different element, and animations are
|
||||
attempted on elements that are outside the application tree, e.g. when libraries append popup and modal
|
||||
elements as the last child in the body tag.
|
||||
attempted on elements that are outside the application tree, e.g. when libraries append popup or
|
||||
modal elements to the body tag.
|
||||
|
||||
You can use {@link ng.$animate#pin `$animate.pin(elementToAnimate, parentHost)`} to specify that an
|
||||
element belongs to your application. Simply call it before the element is added to the DOM / before
|
||||
the animation starts, with the element you want to animate, and the element which should be its
|
||||
assumed parent.
|
||||
You can use {@link ng.$animate#pin `$animate.pin(element, parentHost)`} to associate an element with
|
||||
another element that belongs to your application. Simply call it before the element is added to the
|
||||
DOM / before the animation starts, with the element you want to animate, and the element which
|
||||
should be its assumed parent.
|
||||
|
||||
|
||||
## More about animations
|
||||
|
||||
For a full breakdown of each method available on `$animate`, see the {@link ng.$animate API documentation}.
|
||||
For a full breakdown of each method available on `$animate`, see the
|
||||
{@link ng.$animate API documentation}.
|
||||
|
||||
To see a complete demo, see the {@link tutorial/step_14 animation step within the AngularJS phonecat tutorial}.
|
||||
To see a complete demo, see the {@link tutorial/step_14 animation step in the phonecat tutorial}.
|
||||
|
||||
@@ -40,8 +40,8 @@ initialization.
|
||||
<html ng-app>
|
||||
|
||||
3. If you choose to use the old style directive syntax `ng:` then include xml-namespace in `html`
|
||||
to make IE happy. (This is here for historical reasons, and we no longer recommend use of
|
||||
`ng:`.)
|
||||
when running the page in the XHTML mode. (This is here for historical reasons, and we no longer
|
||||
recommend use of `ng:`.)
|
||||
|
||||
<html xmlns:ng="http://angularjs.org">
|
||||
|
||||
|
||||
@@ -5,19 +5,18 @@
|
||||
|
||||
# Component Router
|
||||
|
||||
<div class="alert alert-info">
|
||||
**Deprecation Notice:** In an effort to keep synchronized with router changes in Angular 2, this implementation of the Component Router (ngComponentRouter module) has been deprecated and will not receive further updates.
|
||||
We are investigating backporting the Angular 2 Router to Angular 1, but alternatively, use the {@link ngRoute} module or community developed projects (e.g. [ui-router](https://github.com/angular-ui/ui-router)).
|
||||
<div class="alert alert-danger">
|
||||
**Deprecation Notice:** In an effort to keep synchronized with router changes in the new Angular, this implementation of the Component Router (ngComponentRouter module) has been deprecated and will not receive further updates.
|
||||
We are investigating backporting the new Angular Router to AngularJS, but alternatively, use the {@link ngRoute} module or community developed projects (e.g. [ui-router](https://github.com/angular-ui/ui-router)).
|
||||
</div>
|
||||
|
||||
This guide describes the new Component Router for AngularJS 1.5.
|
||||
|
||||
<div class="alert alert-info">
|
||||
If you are looking for information about the old router for AngularJS 1.4 and
|
||||
earlier have a look at the {@link ngRoute} module.
|
||||
If you are looking for information about the default router for AngularJS have a look at the {@link ngRoute} module.
|
||||
|
||||
If you are looking for information about the Component Router for Angular 2 then
|
||||
check out the [Angular 2 Router Guide](https://angular.io/docs/ts/latest/guide/router.html).
|
||||
If you are looking for information about the Component Router for the new Angular then
|
||||
check out the [Angular Router Guide](https://angular.io/docs/ts/latest/guide/router.html).
|
||||
</div>
|
||||
|
||||
## Overview
|
||||
|
||||
@@ -39,14 +39,8 @@ Components can be registered using the `.component()` method of an Angular modul
|
||||
});
|
||||
</file>
|
||||
<file name="heroDetail.js">
|
||||
|
||||
function HeroDetailController() {
|
||||
|
||||
}
|
||||
|
||||
angular.module('heroApp').component('heroDetail', {
|
||||
templateUrl: 'heroDetail.html',
|
||||
controller: HeroDetailController,
|
||||
bindings: {
|
||||
hero: '='
|
||||
}
|
||||
@@ -78,6 +72,7 @@ It's also possible to add components via {@link $compileProvider#component} in a
|
||||
| link functions | Yes | No |
|
||||
| multiElement | Yes | No |
|
||||
| priority | Yes | No |
|
||||
| replace | Yes (deprecated) | No |
|
||||
| require | Yes | Yes |
|
||||
| restrict | Yes | No (restricted to elements only) |
|
||||
| scope | Yes (default: false) | No (scope is always isolate) |
|
||||
@@ -461,7 +456,7 @@ The examples use the [Jasmine](http://jasmine.github.io/) testing framework.
|
||||
|
||||
**Controller Test:**
|
||||
```js
|
||||
describe('component: heroDetail', function() {
|
||||
describe('HeroDetailController', function() {
|
||||
var $componentController;
|
||||
|
||||
beforeEach(module('heroApp'));
|
||||
@@ -469,15 +464,6 @@ describe('component: heroDetail', function() {
|
||||
$componentController = _$componentController_;
|
||||
}));
|
||||
|
||||
it('should expose a `hero` object', function() {
|
||||
// Here we are passing actual bindings to the component
|
||||
var bindings = {hero: {name: 'Wolverine'}};
|
||||
var ctrl = $componentController('heroDetail', null, bindings);
|
||||
|
||||
expect(ctrl.hero).toBeDefined();
|
||||
expect(ctrl.hero.name).toBe('Wolverine');
|
||||
});
|
||||
|
||||
it('should call the `onDelete` binding, when deleting the hero', function() {
|
||||
var onDeleteSpy = jasmine.createSpy('onDelete');
|
||||
var bindings = {hero: {}, onDelete: onDeleteSpy};
|
||||
|
||||
@@ -186,7 +186,7 @@ Right now, the `InvoiceController` contains all logic of our example. When the a
|
||||
is a good practice to move view-independent logic from the controller into a
|
||||
<a name="service">{@link services service}</a>, so it can be reused by other parts
|
||||
of the application as well. Later on, we could also change that service to load the exchange rates
|
||||
from the web, e.g. by calling the Yahoo Finance API, without changing the controller.
|
||||
from the web, e.g. by calling the [Fixer.io](http://fixer.io) exchange rate API, without changing the controller.
|
||||
|
||||
Let's refactor our example and move the currency conversion into a service in another file:
|
||||
|
||||
@@ -300,7 +300,7 @@ to something shorter like `a`.
|
||||
|
||||
## Accessing the backend
|
||||
|
||||
Let's finish our example by fetching the exchange rates from the Yahoo Finance API.
|
||||
Let's finish our example by fetching the exchange rates from the [Fixer.io](http://fixer.io) exchange rate API.
|
||||
The following example shows how this is done with Angular:
|
||||
|
||||
<example name="guide-concepts-3" ng-app-included="true">
|
||||
@@ -323,10 +323,6 @@ The following example shows how this is done with Angular:
|
||||
<file name="finance3.js">
|
||||
angular.module('finance3', [])
|
||||
.factory('currencyConverter', ['$http', function($http) {
|
||||
var YAHOO_FINANCE_URL_PATTERN =
|
||||
'//query.yahooapis.com/v1/public/yql?q=select * from ' +
|
||||
'yahoo.finance.xchange where pair in ("PAIRS")&format=json&' +
|
||||
'env=store://datatables.org/alltableswithkeys';
|
||||
var currencies = ['USD', 'EUR', 'CNY'];
|
||||
var usdToForeignRates = {};
|
||||
|
||||
@@ -335,15 +331,10 @@ The following example shows how this is done with Angular:
|
||||
};
|
||||
|
||||
var refresh = function() {
|
||||
var url = YAHOO_FINANCE_URL_PATTERN.
|
||||
replace('PAIRS', 'USD' + currencies.join('","USD'));
|
||||
var url = 'https://api.fixer.io/latest?base=USD&symbols=' + currencies.join(",");
|
||||
return $http.get(url).then(function(response) {
|
||||
var newUsdToForeignRates = {};
|
||||
angular.forEach(response.data.query.results.rate, function(rate) {
|
||||
var currency = rate.id.substring(3,6);
|
||||
newUsdToForeignRates[currency] = window.parseFloat(rate.Rate);
|
||||
});
|
||||
usdToForeignRates = newUsdToForeignRates;
|
||||
usdToForeignRates = response.data.rates;
|
||||
usdToForeignRates['USD'] = 1;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -120,11 +120,13 @@ The other forms shown above are accepted for legacy reasons but we advise you to
|
||||
|
||||
### Directive types
|
||||
|
||||
`$compile` can match directives based on element names, attributes, class names, as well as comments.
|
||||
`$compile` can match directives based on element names (E), attributes (A), class names (C),
|
||||
and comments (M).
|
||||
|
||||
All of the Angular-provided directives match attribute name, tag name, comments, or class name.
|
||||
The following demonstrates the various ways a directive (`myDir` in this case) can be referenced
|
||||
from within a template:
|
||||
The built-in AngularJS directives show in their documentation page which type of matching they support.
|
||||
|
||||
The following demonstrates the various ways a directive that matches all 4 types
|
||||
(`myDir` in this case) can be referenced from within a template.
|
||||
|
||||
```html
|
||||
<my-dir></my-dir>
|
||||
@@ -133,6 +135,10 @@ from within a template:
|
||||
<span class="my-dir: exp;"></span>
|
||||
```
|
||||
|
||||
A directive can specify which of the 4 matching types it supports in the
|
||||
{@link ng.$compile#-restrict- `restrict`} property of the directive definition object.
|
||||
The default is `EA`.
|
||||
|
||||
<div class="alert alert-success">
|
||||
**Best Practice:** Prefer using directives via tag name and attributes over comment and class names.
|
||||
Doing so generally makes it easier to determine what directives a given element matches.
|
||||
|
||||
@@ -241,7 +241,7 @@ An expression that starts with `::` is considered a one-time expression. One-tim
|
||||
will stop recalculating once they are stable, which happens after the first digest if the expression
|
||||
result is a non-undefined value (see value stabilization algorithm below).
|
||||
|
||||
<example module="oneTimeBidingExampleApp" name="expression-one-time">
|
||||
<example module="oneTimeBindingExampleApp" name="expression-one-time">
|
||||
<file name="index.html">
|
||||
<div ng-controller="EventController">
|
||||
<button ng-click="clickMe($event)">Click Me</button>
|
||||
@@ -250,7 +250,7 @@ result is a non-undefined value (see value stabilization algorithm below).
|
||||
</div>
|
||||
</file>
|
||||
<file name="script.js">
|
||||
angular.module('oneTimeBidingExampleApp', []).
|
||||
angular.module('oneTimeBindingExampleApp', []).
|
||||
controller('EventController', ['$scope', function($scope) {
|
||||
var counter = 0;
|
||||
var names = ['Igor', 'Misko', 'Chirayu', 'Lucas'];
|
||||
@@ -265,24 +265,24 @@ result is a non-undefined value (see value stabilization algorithm below).
|
||||
</file>
|
||||
<file name="protractor.js" type="protractor">
|
||||
it('should freeze binding after its value has stabilized', function() {
|
||||
var oneTimeBiding = element(by.id('one-time-binding-example'));
|
||||
var oneTimeBinding = element(by.id('one-time-binding-example'));
|
||||
var normalBinding = element(by.id('normal-binding-example'));
|
||||
|
||||
expect(oneTimeBiding.getText()).toEqual('One time binding:');
|
||||
expect(oneTimeBinding.getText()).toEqual('One time binding:');
|
||||
expect(normalBinding.getText()).toEqual('Normal binding:');
|
||||
element(by.buttonText('Click Me')).click();
|
||||
|
||||
expect(oneTimeBiding.getText()).toEqual('One time binding: Igor');
|
||||
expect(oneTimeBinding.getText()).toEqual('One time binding: Igor');
|
||||
expect(normalBinding.getText()).toEqual('Normal binding: Igor');
|
||||
element(by.buttonText('Click Me')).click();
|
||||
|
||||
expect(oneTimeBiding.getText()).toEqual('One time binding: Igor');
|
||||
expect(oneTimeBinding.getText()).toEqual('One time binding: Igor');
|
||||
expect(normalBinding.getText()).toEqual('Normal binding: Misko');
|
||||
|
||||
element(by.buttonText('Click Me')).click();
|
||||
element(by.buttonText('Click Me')).click();
|
||||
|
||||
expect(oneTimeBiding.getText()).toEqual('One time binding: Igor');
|
||||
expect(oneTimeBinding.getText()).toEqual('One time binding: Igor');
|
||||
expect(normalBinding.getText()).toEqual('Normal binding: Lucas');
|
||||
});
|
||||
</file>
|
||||
|
||||
@@ -119,7 +119,8 @@ You can find a larger list of Angular external libraries at [ngmodules.org](http
|
||||
### Books
|
||||
* [AngularJS Directives](http://www.amazon.com/AngularJS-Directives-Alex-Vanston/dp/1783280336) by Alex Vanston
|
||||
* [AngularJS Essentials (Free eBook)](https://www.packtpub.com/packt/free-ebook/angularjs-essentials) by Rodrigo Branas
|
||||
* [AngularJS : Novice to Ninja](http://www.amazon.in/AngularJS-Novice-Ninja-Sandeep-Panda/dp/0992279453) by Sandeep Panda
|
||||
* [AngularJS in Action](https://www.manning.com/books/angularjs-in-action) by Lukas Ruebbelke
|
||||
* [AngularJS: Novice to Ninja](http://www.amazon.in/AngularJS-Novice-Ninja-Sandeep-Panda/dp/0992279453) by Sandeep Panda
|
||||
* [AngularJS UI Development](http://www.amazon.com/AngularJS-UI-Development-Amit-Ghart-ebook/dp/B00OXVAK7A) by Amit Gharat and Matthias Nehlsen
|
||||
* [AngularJS: Up and Running](http://www.amazon.com/AngularJS-Running-Enhanced-Productivity-Structured/dp/1491901942) by Brad Green and Shyam Seshadri
|
||||
* [Developing an AngularJS Edge](http://www.amazon.com/Developing-AngularJS-Edge-Christopher-Hiller-ebook/dp/B00CJLFF8K) by Christopher Hiller
|
||||
@@ -138,7 +139,7 @@ You can find a larger list of Angular external libraries at [ngmodules.org](http
|
||||
[CodeAcademy](http://www.codecademy.com/courses/javascript-advanced-en-2hJ3J/0/1),
|
||||
[CodeSchool](https://www.codeschool.com/courses/shaping-up-with-angular-js)
|
||||
* **Paid online:**
|
||||
[Pluralsight (3 courses)](http://www.pluralsight.com/training/Courses/Find?highlight=true&searchTerm=angularjs),
|
||||
[Pluralsight](https://www.pluralsight.com/search?q=angularjs),
|
||||
[Tuts+](https://tutsplus.com/course/easier-js-apps-with-angular/),
|
||||
[lynda.com](http://www.lynda.com/AngularJS-tutorials/Up-Running-AngularJS/133318-2.html),
|
||||
[WintellectNOW (4 lessons)](http://www.wintellectnow.com/Course/Detail/mastering-angularjs),
|
||||
|
||||
@@ -28,8 +28,8 @@ for other directives to augment its behavior.
|
||||
<form novalidate class="simple-form">
|
||||
<label>Name: <input type="text" ng-model="user.name" /></label><br />
|
||||
<label>E-mail: <input type="email" ng-model="user.email" /></label><br />
|
||||
Gender: <label><input type="radio" ng-model="user.gender" value="male" />male</label>
|
||||
<label><input type="radio" ng-model="user.gender" value="female" />female</label><br />
|
||||
Best Editor: <label><input type="radio" ng-model="user.preference" value="vi" />vi</label>
|
||||
<label><input type="radio" ng-model="user.preference" value="emacs" />emacs</label><br />
|
||||
<input type="button" ng-click="reset()" value="Reset" />
|
||||
<input type="submit" ng-click="update(user)" value="Save" />
|
||||
</form>
|
||||
|
||||
@@ -26,7 +26,7 @@ directive}. Additionally, you can use {@link guide/i18n#messageformat-extension
|
||||
All localizable Angular components depend on locale-specific rule sets managed by the {@link
|
||||
ng.$locale `$locale` service}.
|
||||
|
||||
There a few examples that showcase how to use Angular filters with various locale rule sets in the
|
||||
There are a few examples that showcase how to use Angular filters with various locale rule sets in the
|
||||
[`i18n/e2e` directory](https://github.com/angular/angular.js/tree/master/i18n/e2e) of the Angular
|
||||
source code.
|
||||
|
||||
@@ -85,7 +85,7 @@ requires German locale, you would serve index_de-de.html which will look somethi
|
||||
|
||||
Both approaches described above require you to prepare different `index.html` pages or JavaScript
|
||||
files for each locale that your app may use. You also need to configure your server to serve
|
||||
the correct file that correspond to the desired locale.
|
||||
the correct file that corresponds to the desired locale.
|
||||
|
||||
The second approach (including the locale JavaScript file in `index.html`) may be slower because
|
||||
an extra script needs to be loaded.
|
||||
@@ -281,18 +281,18 @@ categories as you need.
|
||||
#### Selection Keywords
|
||||
|
||||
The selection keywords can be either exact matches or language dependent [plural
|
||||
categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html).
|
||||
categories](http://cldr.unicode.org/index/cldr-spec/plural-rules).
|
||||
|
||||
Exact matches are written as the equal sign followed by the exact value. `=0`, `=1`, `=2` and
|
||||
`=123` are all examples of exact matches. Note that there should be no space between the equal sign
|
||||
and the numeric value.
|
||||
|
||||
Plural category matches are single words corresponding to the [plural
|
||||
categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html) of
|
||||
the CLDR plural category spec. These categories vary by locale. The "en" (English) locale, for
|
||||
example, defines just "one" and "other" while the "ga" (Irish) locale defines "one", "two", "few",
|
||||
"many" and "other". Typically, you would just write the categories for your language. During
|
||||
translation, the translators will add or remove more categories depending on the target locale.
|
||||
categories](http://cldr.unicode.org/index/cldr-spec/plural-rules) of the CLDR plural category spec.
|
||||
These categories vary by locale. The "en" (English) locale, for example, defines just "one" and
|
||||
"other" while the "ga" (Irish) locale defines "one", "two", "few", "many" and "other". Typically,
|
||||
you would just write the categories for your language. During translation, the translators will add
|
||||
or remove more categories depending on the target locale.
|
||||
|
||||
Exact matches always win over keyword matches. Therefore, if you define both `=0` and `zero`, when
|
||||
the value of the expression is zero, the `=0` message is the one that will be selected. (The
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<div class="alert alert-warning">
|
||||
**Note:** AngularJS 1.3 has dropped support for IE8. Read more about it on
|
||||
[our blog](http://blog.angularjs.org/2013/12/angularjs-13-new-release-approaches.html).
|
||||
[our blog](https://blog.angularjs.org/2013/12/angularjs-13-new-release-approaches.html).
|
||||
AngularJS 1.2 will continue to support IE8, but the core team does not plan to spend time
|
||||
addressing issues specific to IE8 or earlier.
|
||||
</div>
|
||||
@@ -19,7 +19,7 @@ on IE.
|
||||
The project currently supports and will attempt to fix bugs for IE9 and above. The continuous
|
||||
integration server runs all the tests against IE9, IE10, and IE11. See
|
||||
[Travis CI](https://travis-ci.org/angular/angular.js) and
|
||||
[ci.angularjs.org](http://ci.angularjs.org).
|
||||
[ci.angularjs.org](https://ci.angularjs.org).
|
||||
|
||||
We do not run tests on IE8 and below. A subset of the AngularJS functionality may work on these
|
||||
browsers, but it is up to you to test and decide whether it works for your particular app.
|
||||
@@ -27,8 +27,8 @@ browsers, but it is up to you to test and decide whether it works for your parti
|
||||
|
||||
To ensure your Angular application works on IE please consider:
|
||||
|
||||
1. Use `ng-style` tags instead of `style="{{ someCss }}"`. The latter works in Chrome and Firefox
|
||||
but does not work in Internet Explorer <= 11 (the most recent version at time of writing).
|
||||
1. Use `ng-style` tags instead of `style="{{ someCss }}"`. The latter works in Chrome, Firefox,
|
||||
Safari and Edge but does not work in Internet Explorer (even 11).
|
||||
2. For the `type` attribute of buttons, use `ng-attr-type` tags instead of
|
||||
`type="{{ someExpression }}"`. If using the latter, Internet Explorer overwrites the expression
|
||||
with `type="submit"` before Angular has a chance to interpolate it.
|
||||
|
||||
@@ -32,7 +32,7 @@ If the interpolated value is not a `String`, it is computed as follows:
|
||||
- `undefined` and `null` are converted to `''`
|
||||
- if the value is an object that is not a `Number`, `Date` or `Array`, $interpolate looks for
|
||||
a custom `toString()` function on the object, and uses that. Custom means that
|
||||
`myObject.toString !== `Object.prototype.toString`.
|
||||
`myObject.toString !== Object.prototype.toString`.
|
||||
- if the above doesn't apply, `JSON.stringify` is used.
|
||||
|
||||
### Binding to boolean attributes
|
||||
|
||||
@@ -75,8 +75,8 @@ commits for more info.
|
||||
- **$location** now uses `'!'` as the default hash-prefix for hash-bang URLs, instead of the empty
|
||||
string. ([Details](guide/migration#commit-aa077e8))
|
||||
|
||||
- **$compile** will (by default) not pre-assign bindings on controller instances.
|
||||
([Details](guide/migration#commit-bcd0d4))
|
||||
- **$compile** will (by default) not pre-assign bindings on component/directive controller
|
||||
instances. ([Details](guide/migration#commit-bcd0d4))
|
||||
|
||||
- **http** imposes additional restrictions to **JSONP** requests for security reasons
|
||||
(see [details](guide/migration#migrate1.5to1.6-ng-services-$http) below):
|
||||
@@ -88,7 +88,9 @@ commits for more info.
|
||||
|
||||
- **jqLite** is more aligned to jQuery 3, which required the following changes
|
||||
(see [details](guide/migration#migrate1.5to1.6-ng-misc-jqLite) below):
|
||||
- Keys passed to `.data()` and `.css()` are now camelCased in the same as jQuery does it.
|
||||
- Keys passed to `.data()` and `.css()` are now camelCased in the same way as the jQuery methods
|
||||
do.
|
||||
- Getting/setting boolean attributes no longer takes the corresponding properties into account.
|
||||
- Setting boolean attributes to empty string no longer removes the attribute.
|
||||
- Calling `.val()` on a multiple select will always return an array, even if no option is
|
||||
selected.
|
||||
@@ -410,14 +412,14 @@ if the option does not provide a value attribute.
|
||||
<major />
|
||||
<a name="commit-bcd0d4"></a>
|
||||
**Due to [bcd0d4](https://github.com/angular/angular.js/commit/bcd0d4d896d0dfdd988ff4f849c1d40366125858)**,
|
||||
pre-assigning bindings on controller instances is disabled by default. It is still possible to turn
|
||||
it back on, which should help during the migration. Pre-assigning bindings has been deprecated and
|
||||
will be removed in a future version, so we strongly recommend migrating your applications to not
|
||||
rely on it as soon as possible.
|
||||
pre-assigning bindings on component/directive controller instances is disabled by default, which
|
||||
means that they will no longer be available inside the constructors. It is still possible to turn it
|
||||
back on, which should help during the migration. Pre-assigning bindings has been deprecated and will
|
||||
be removed in a future version, so we strongly recommend migrating your applications to not rely on
|
||||
it as soon as possible.
|
||||
|
||||
Initialization logic that relies on bindings being present should be put in the controller's
|
||||
`$onInit()` method, which is guarranteed to always be called _after_ the bindings have been
|
||||
assigned.
|
||||
`$onInit()` method, which is guaranteed to always be called _after_ the bindings have been assigned.
|
||||
|
||||
Before:
|
||||
|
||||
@@ -482,14 +484,6 @@ lifecycle hook), you may need to manually call `$onInit()` from your constructor
|
||||
})
|
||||
```
|
||||
|
||||
<hr />
|
||||
<minor />
|
||||
**Due to [13c252](https://github.com/angular/angular.js/commit/13c2522baf7c8f616b2efcaab4bffd54c8736591)**,
|
||||
on **IE11 only**, consecutive text nodes will always get merged. Previously, they would not get
|
||||
merged if they had no parent. The new behavior, which fixes an IE11 bug affecting interpolation
|
||||
under certain circumstances, might in some edge-cases have unexpected side effects that you should
|
||||
be aware of. Please, check the commit message for more details.
|
||||
|
||||
<hr />
|
||||
<minor />
|
||||
**Due to [04cad4](https://github.com/angular/angular.js/commit/04cad41d26ebaf44b5ee0c29a152d61f235f3efa)**,
|
||||
@@ -501,7 +495,7 @@ running at `https://docs.angularjs.org` then the following will fail:
|
||||
<link href="{{ 'http://mydomain.org/unsafe.css' }}" rel="stylesheet" />
|
||||
```
|
||||
|
||||
By default, only URLs with the same domain and prototocl as the application document are considered
|
||||
By default, only URLs with the same domain and protocol as the application document are considered
|
||||
safe in the `RESOURCE_URL` context. To use URLs from other domains and/or protocols, you may either
|
||||
whitelist them or wrap them into a trusted value by calling `$sce.trustAsResourceUrl(url)`.
|
||||
|
||||
@@ -586,7 +580,7 @@ trust a URL:
|
||||
|
||||
```js
|
||||
appModule.config(['$sceDelegateProvider', function($sceDelegateProvider) {
|
||||
$sceDelegateProvider.resourceUrlWhiteList([
|
||||
$sceDelegateProvider.resourceUrlWhitelist([
|
||||
// Allow same origin resource loads.
|
||||
'self',
|
||||
// Allow JSONP calls that match this pattern
|
||||
@@ -880,6 +874,48 @@ var bgColor = elem.css('background-color');
|
||||
var bgColor = elem.css('backgroundColor');
|
||||
```
|
||||
|
||||
<hr />
|
||||
<major />
|
||||
**Due to [7ceb5f](https://github.com/angular/angular.js/commit/7ceb5f6fcc43d35d1b66c3151ce6a71c60309304)**,
|
||||
getting/setting boolean attributes will no longer take the corresponding properties into account.
|
||||
Previously, all boolean attributes were reflected into the corresponding property when calling a
|
||||
setter and from the corresponding property when calling a getter, even on elements that don't treat
|
||||
those attributes in a special way. Now Angular doesn't do it by itself, but relies on browsers to
|
||||
know when to reflect the property. Note that this browser-level conversion differs between browsers;
|
||||
if you need to dynamically change the state of an element, you should modify the property, not the
|
||||
attribute. See https://jquery.com/upgrade-guide/1.9/#attr-versus-prop- for a more detailed
|
||||
description about a related change in jQuery 1.9.
|
||||
|
||||
This change aligns jqLite with jQuery 3. To migrate the code follow the example below:
|
||||
|
||||
Before:
|
||||
|
||||
```css
|
||||
/* CSS */
|
||||
|
||||
input[checked="checked"] { ... }
|
||||
```
|
||||
```js
|
||||
// JS
|
||||
|
||||
elem1.attr('checked', 'checked');
|
||||
elem2.attr('checked', false);
|
||||
```
|
||||
|
||||
After:
|
||||
|
||||
```css
|
||||
/* CSS */
|
||||
|
||||
input:checked { ... }
|
||||
```
|
||||
```js
|
||||
// JS
|
||||
|
||||
elem1.prop('checked', true);
|
||||
elem2.prop('checked', false);
|
||||
```
|
||||
|
||||
<hr />
|
||||
<major />
|
||||
**Due to [3faf45](https://github.com/angular/angular.js/commit/3faf4505732758165083c9d21de71fa9b6983f4a)**,
|
||||
@@ -1169,7 +1205,7 @@ with an unencoded `;` character.
|
||||
Previously, in cases where `ngView` was loaded asynchronously, `$route` (and its dependencies) might
|
||||
also have been instantiated asynchronously.
|
||||
|
||||
Although this is not expected to have unwanted side-effects in normal application bebavior, it may
|
||||
Although this is not expected to have unwanted side-effects in normal application behavior, it may
|
||||
affect your unit tests: When testing a module that (directly or indirectly) depends on `ngRoute`, a
|
||||
request will be made for the default route's template. If not properly "trained", `$httpBackend`
|
||||
will complain about this unexpected request. You can restore the previous behavior (and avoid
|
||||
@@ -1276,7 +1312,7 @@ jqLite/jQuery collections
|
||||
|
||||
#### Helper Functions:
|
||||
|
||||
The {@link angular.lowercase `angular.lowercase`} and {@link angular.uppercase `angular.uppercase`} functions have been **deprecated** and will be removed
|
||||
The `angular.lowercase` and `angular.uppercase` functions have been **deprecated** and will be removed
|
||||
in version 1.7.0. It is recommended to use [String.prototype.toLowerCase](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase) and [String.prototype.toUpperCase](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase) functions instead.
|
||||
|
||||
|
||||
@@ -1410,9 +1446,8 @@ For more info on the topic, you can take a look at this
|
||||
|
||||
## Migrating from 1.3 to 1.4
|
||||
|
||||
Angular 1.4 fixes major animation issues and introduces a new API for `ngCookies`. Further, there
|
||||
are changes to `ngMessages`, `$compile`, `ngRepeat`, `ngOptions `and some fixes to core filters:
|
||||
`limitTo` and `filter`.
|
||||
AngularJS 1.4 fixes major animation issues and introduces a new API for `ngCookies`. Further, there
|
||||
are changes to `ngMessages`, `$compile`, `ngRepeat`, `ngOptions`, `ngPattern`, `pattern` and some fixes to core filters: `limitTo` and `filter`.
|
||||
|
||||
The reason for the ngAnimate refactor was to fix timing issues and to expose new APIs to allow
|
||||
for developers to construct more versatile animations. We now have access to `$animateCss`
|
||||
@@ -1425,9 +1460,9 @@ to render error messages with ngMessages that are listed with a directive such a
|
||||
involves pulling error message data from a server and then displaying that data via the mechanics of ngMessages. Be
|
||||
sure to read the breaking change involved with `ngMessagesInclude` to upgrade your template code.
|
||||
|
||||
Other changes, such as the ordering of elements with ngRepeat and ngOptions, may also affect the behavior of your
|
||||
application. And be sure to also read up on the changes to `$cookies`. The migration jump from 1.3 to 1.4 should be
|
||||
relatively straightforward otherwise.
|
||||
Other changes, such as the ordering of elements with ngRepeat and ngOptions and the way ngPattern and pattern directives
|
||||
validate the regex, may also affect the behavior of your application. And be sure to also read up on the changes to `$cookies`.
|
||||
The migration jump from 1.3 to 1.4 should be relatively straightforward otherwise.
|
||||
|
||||
|
||||
|
||||
@@ -1531,7 +1566,7 @@ class based animations (animations triggered via ngClass) in order to ensure tha
|
||||
|
||||
|
||||
|
||||
### Forms (`ngMessages`, `ngOptions`, `select`)
|
||||
### Forms (`ngMessages`, `ngOptions`, `select`, `ngPattern` and `pattern`)
|
||||
|
||||
#### ngMessages
|
||||
The ngMessages module has also been subject to an internal refactor to allow it to be more flexible
|
||||
@@ -1639,6 +1674,79 @@ ngModelCtrl.$formatters.push(function(value) {
|
||||
});
|
||||
```
|
||||
|
||||
#### ngPattern and pattern
|
||||
|
||||
Due to [0e001084](https://github.com/angular/angular.js/commit/0e001084ffff8674efad289d37cb16cc4e46b50a),
|
||||
The `ngPattern` and `pattern` directives will validate the regex
|
||||
against the `$viewValue` of `ngModel`, i.e. the value of the model
|
||||
before the $parsers are applied. Previously, the `$modelValue`
|
||||
(the result of the $parsers) was validated.
|
||||
|
||||
This fixes issues where `input[date]` and `input[number]` cannot
|
||||
be validated because the `$viewValue` string is parsed into
|
||||
`Date` and `Number` respectively (starting with AngularJS 1.3).
|
||||
It also brings the directives in line with HTML5 constraint
|
||||
validation, which validates against the input value.
|
||||
|
||||
This change is unlikely to cause applications to fail, because even
|
||||
in AngularJS 1.2, the value that was validated by pattern could have
|
||||
been manipulated by the $parsers, as all validation was done
|
||||
inside this pipeline.
|
||||
|
||||
If you rely on the pattern being validated against the `$modelValue`,
|
||||
you must create your own validator directive that overwrites
|
||||
the built-in pattern validator:
|
||||
|
||||
```
|
||||
.directive('patternModelOverwrite', function patternModelOverwriteDirective() {
|
||||
return {
|
||||
restrict: 'A',
|
||||
require: '?ngModel',
|
||||
priority: 1,
|
||||
compile: function() {
|
||||
var regexp, patternExp;
|
||||
|
||||
return {
|
||||
pre: function(scope, elm, attr, ctrl) {
|
||||
if (!ctrl) return;
|
||||
|
||||
attr.$observe('pattern', function(regex) {
|
||||
/**
|
||||
* The built-in directive will call our overwritten validator
|
||||
* (see below). We just need to update the regex.
|
||||
* The preLink fn guaranetees our observer is called first.
|
||||
*/
|
||||
if (isString(regex) && regex.length > 0) {
|
||||
regex = new RegExp('^' + regex + '$');
|
||||
}
|
||||
|
||||
if (regex && !regex.test) {
|
||||
//The built-in validator will throw at this point
|
||||
return;
|
||||
}
|
||||
|
||||
regexp = regex || undefined;
|
||||
});
|
||||
|
||||
},
|
||||
post: function(scope, elm, attr, ctrl) {
|
||||
if (!ctrl) return;
|
||||
|
||||
regexp, patternExp = attr.ngPattern || attr.pattern;
|
||||
|
||||
//The postLink fn guarantees we overwrite the built-in pattern validator
|
||||
ctrl.$validators.pattern = function(value) {
|
||||
return ctrl.$isEmpty(value) ||
|
||||
isUndefined(regexp) ||
|
||||
regexp.test(value);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
### form
|
||||
|
||||
@@ -2605,7 +2713,7 @@ See [38deedd6](https://github.com/angular/angular.js/commit/38deedd6e3d806eb8262
|
||||
|
||||
### Interpolations inside DOM event handlers are now disallowed
|
||||
|
||||
DOM event handlers execute arbitrary Javascript code. Using an interpolation for such handlers
|
||||
DOM event handlers execute arbitrary JavaScript code. Using an interpolation for such handlers
|
||||
means that the interpolated value is a JS string that is evaluated. Storing or generating such
|
||||
strings is error prone and leads to XSS vulnerabilities. On the other hand, `ngClick` and other
|
||||
Angular specific event handlers evaluate Angular expressions in non-window (Scope) context which
|
||||
|
||||
@@ -100,8 +100,7 @@ Protection from JSON Hijacking is provided if the server prefixes all JSON reque
|
||||
Angular will automatically strip the prefix before processing it as JSON.
|
||||
For more information please visit {@link $http#json-vulnerability-protection JSON Hijacking Protection}.
|
||||
|
||||
Bear in mind that calling `$http.jsonp`, like in [our Yahoo! finance example](https://docs.angularjs.org/guide/concepts#accessing-the-backend),
|
||||
gives the remote server (and, if the request is not secured, any Man-in-the-Middle attackers)
|
||||
Bear in mind that calling `$http.jsonp` gives the remote server (and, if the request is not secured, any Man-in-the-Middle attackers)
|
||||
instant remote code execution in your application: the result of these requests is handed off
|
||||
to the browser as regular `<script>` tag.
|
||||
|
||||
|
||||
@@ -221,8 +221,8 @@ it('should clear messages after alert', function() {
|
||||
notify('two');
|
||||
notify('third');
|
||||
|
||||
expect(mock.alert.callCount).toEqual(2);
|
||||
expect(mock.alert.mostRecentCall.args).toEqual(["more\ntwo\nthird"]);
|
||||
expect(mock.alert.calls.count()).toEqual(2);
|
||||
expect(mock.alert.calls.mostRecent().args).toEqual(["more\ntwo\nthird"]);
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ curly-brace {@link expression expression} bindings:
|
||||
string expression 'buttonText'
|
||||
wrapped in "{{ }}" markup -->
|
||||
<button ng-click="changeFoo()">{{buttonText}}</button>
|
||||
<script src="angular.js">
|
||||
<script src="angular.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
@@ -140,13 +140,13 @@ tests once on Chrome run:
|
||||
grunt test:unit
|
||||
```
|
||||
|
||||
To run the tests on other browsers (Chrome, ChromeCanary, Firefox, Opera and Safari are pre-configured) use:
|
||||
To run the tests on other browsers (Chrome, ChromeCanary, Firefox and Safari are pre-configured) use:
|
||||
|
||||
```shell
|
||||
grunt test:unit --browsers=Opera,Firefox
|
||||
grunt test:unit --browsers=Chrome,Firefox
|
||||
```
|
||||
|
||||
Note there should be _no spaces between browsers_. `Opera, Firefox` is INVALID.
|
||||
Note there should be _no spaces between browsers_. `Chrome, Firefox` is INVALID.
|
||||
|
||||
During development, however, it's more productive to continuously run unit tests every time the source or test files
|
||||
change. To execute tests in this mode run:
|
||||
|
||||
+95
-47
@@ -22,39 +22,89 @@ So it's definitely not a plugin or some other native browser extension.
|
||||
|
||||
### What is the AngularJS versioning strategy?
|
||||
|
||||
In Angular 1 we do not allow intentional breaking changes to appear in versions where only the "patch"
|
||||
In AngularJS we do not allow intentional breaking changes to appear in versions where only the "patch"
|
||||
number changes. For example between 1.3.12 and 1.3.13 there can be no breaking changes. We do allow
|
||||
breaking changes happen between "minor" number changes. For example between 1.3.15 and 1.4.0 there
|
||||
will be a number of breaking changes. We also allow breaking changes between beta releases of Angular.
|
||||
are a number of breaking changes. That means AngularJS does not follow
|
||||
[semantic versioning (semver)](http://semver.org/) where breaking changes are only
|
||||
allowed when the "major" version changes.
|
||||
|
||||
We also allow breaking changes between beta releases of AngularJS.
|
||||
For example between 1.4.0-beta.4 and 1.4.0-beta.5 there may be breaking changes. We try hard to minimize
|
||||
these kinds of change only to those where there is a strong use case such as a strongly requested feature
|
||||
improvement, a considerable simplification of the code or a measurable performance improvement.
|
||||
improvement, a considerable simplification of the code, a measurable performance improvement, or a better
|
||||
developer experience (especially with regard to upgrading to Angular).
|
||||
|
||||
When adding new code to branches of Angular, have a very stringent commit policy:
|
||||
When we are making a release we generate updates to the changelog directly from the commits. This
|
||||
generated update contains a highlighted section that contains all the breaking changes that have been
|
||||
extracted from the commits. We can quickly see in the new changelog exactly what commits contain breaking
|
||||
changes and so can application developers when they are deciding whether to update to a new version of
|
||||
Angular.
|
||||
|
||||
- Every commit must contain tests and documentation updates alongside the code changes and that all the
|
||||
tests must pass;
|
||||
Features with non-breaking changes can also appear in the "patch" version, e.g. in version 1.6.3 there might
|
||||
be a feature that is not available in 1.6.2.
|
||||
|
||||
Finally, deprecation of features might also appear in "minor" version updates. That means the features
|
||||
will still work in this version, but sometimes must be activated specifically.
|
||||
|
||||
#### When are deprecated features removed from the library?
|
||||
|
||||
Most of the time we remove a deprecated feature in a next minor version bump. For example, the
|
||||
`preAssignBindingsEnabled` `$compileProvider` method was defined in AngularJS `1.5.10`, deprecated in `1.6` and
|
||||
will be removed in `1.7`.
|
||||
|
||||
In case of jqLite we apply a different strategy - we deprecate features that have an equivalent in jQuery that
|
||||
is also deprecated but we only remove the feature once it's removed from jQuery to improve compatibility between
|
||||
jqLite and jQuery. One such example is the `bind` method, deprecated in favor of `on` but unlikely to be removed
|
||||
from jqLite any time soon.
|
||||
|
||||
#### What is the version compatibility between AngularJS main and optional modules?
|
||||
|
||||
AngularJS code is separated into a main module ("angular"), and a few different optional modules
|
||||
("angular-animate", "angular-route" etc) that are dependant on the main module.
|
||||
When a new AngularJS version is released, all modules are updated to the new version.
|
||||
This means that the main module and the optional modules must always have the exact same version,
|
||||
down to the patch number, otherwise your application might break.
|
||||
|
||||
Therefore you must always explicitly lock down your dependencies, for example in the package.json,
|
||||
the following means that "angular" and "angular-animate" are always updated to the same version:
|
||||
|
||||
```
|
||||
{
|
||||
"angular": "~1.6.0",
|
||||
"angular-animate": "~1.6.0"
|
||||
}
|
||||
```
|
||||
|
||||
If you define exact versions, make sure core and optional modules are the same:
|
||||
|
||||
```
|
||||
{
|
||||
"angular": "1.6.3",
|
||||
"angular-animate": "1.6.3"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### How does AngularJS ensure code quality and guard against regressions?
|
||||
|
||||
When adding new code to AngularJS, we have a very stringent commit policy:
|
||||
|
||||
- Every commit must pass all existing tests, contain tests for code changes, and update the documentation
|
||||
- Commit messages must be written in a specific manner that allows us to parse them and extract the changes
|
||||
for release notes.
|
||||
for release notes ([see the contributing guidelines](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md))
|
||||
|
||||
The Angular code base has a very large set of unit tests (over 4000) and end to end tests, which are pretty
|
||||
comprehensive. This means that a breaking change will require one or more tests to be changed to allow the
|
||||
The AngularJS code base has a very large set of unit tests and end-to-end tests. This means that a breaking change will require one or more tests to be changed to allow the
|
||||
tests to pass. So when a commit includes tests that are being removed or modified, this is a flag that the
|
||||
code might include a breaking change. When reviewing the commit we can then decide whether there really is
|
||||
a breaking change and if it is appropriate for the branch to which it is being merged. If so, then we
|
||||
require that the commit message contains an appropriate breaking change message.
|
||||
|
||||
Additionally, when a commit lands in our master repository it is synced to Google where we test it against
|
||||
over 2000 applications using the test suites of these applications. This allows us to catch regressions
|
||||
Additionally, commits are periodically synced to Google where we test it against applications using
|
||||
the test suites of these applications. This allows us to catch regressions
|
||||
quickly before a release. We've had a pretty good experience with this setup. Only bugs that affect features
|
||||
not used at Google or without sufficient test coverage, have a chance of making it through.
|
||||
|
||||
Lastly, when we are making a release we generate updates to the changelog directly from the commits. This
|
||||
generated update contains a highlighted section that contains all the breaking changes that have been
|
||||
extracted from the commits. We can quickly see in the new changelog exactly what commits contain breaking
|
||||
changes and so can application developers when they are deciding whether to update to a new version of
|
||||
Angular.
|
||||
|
||||
|
||||
### Is AngularJS a templating system?
|
||||
|
||||
@@ -86,20 +136,18 @@ Yes. See instructions in {@link downloading}.
|
||||
|
||||
|
||||
|
||||
### What browsers does Angular work with?
|
||||
### What browsers does AngularJS work with?
|
||||
|
||||
We run our extensive test suite against the following browsers: the latest versions of Chrome,
|
||||
Firefox, Safari, and Safari for iOs, as well as Internet Explorer versions 9-11. See {@link guide/ie
|
||||
Internet Explorer Compatibility} for more details on supporting legacy IE browsers.
|
||||
Firefox, Safari, and Safari for iOS, as well as Internet Explorer versions 9-11. See
|
||||
{@link guide/ie Internet Explorer Compatibility} for more details on supporting legacy IE browsers.
|
||||
|
||||
If a browser is untested, it doesn't mean it won't work; for example, older Android (2.3.x)
|
||||
is supported in the sense that we avoid the dot notation for reserved words as property names,
|
||||
but we don't actively test changes against it. You can also expect browsers to work that share
|
||||
a large part of their codebase with a browser we test, such as Opera > version 12
|
||||
If a browser is untested, it doesn't mean it won't work. You can also expect browsers to work that
|
||||
share a large part of their codebase with a browser we test, such as Opera 15 or newer
|
||||
(uses the Blink engine), or the various Firefox derivatives.
|
||||
|
||||
|
||||
### What's Angular's performance like?
|
||||
### What's AngularJS's performance like?
|
||||
|
||||
The startup time heavily depends on your network connection, state of the cache, browser used and
|
||||
available hardware, but typically we measure bootstrap time in tens or hundreds of milliseconds.
|
||||
@@ -114,40 +162,40 @@ illustration, we typically build snappy apps with hundreds or thousands of activ
|
||||
The size of the file is ~50KB compressed and minified.
|
||||
|
||||
|
||||
### Can I use the open-source Closure Library with Angular?
|
||||
### Can I use the open-source Closure Library with AngularJS?
|
||||
|
||||
Yes, you can use widgets from the [Closure Library](https://developers.google.com/closure/library/)
|
||||
in Angular.
|
||||
in AngularJS.
|
||||
|
||||
|
||||
### Does Angular use the jQuery library?
|
||||
### Does AngularJS use the jQuery library?
|
||||
|
||||
Yes, Angular can use [jQuery](http://jquery.com/) if it's present in your app when the
|
||||
application is being bootstrapped. If jQuery is not present in your script path, Angular falls back
|
||||
Yes, AngularJS can use [jQuery](http://jquery.com/) if it's present in your app when the
|
||||
application is being bootstrapped. If jQuery is not present in your script path, AngularJS falls back
|
||||
to its own implementation of the subset of jQuery that we call {@link angular.element jQLite}.
|
||||
|
||||
Angular 1.3 only supports jQuery 2.1 or above. jQuery 1.7 and newer might work correctly with Angular
|
||||
AngularJS 1.3 only supports jQuery 2.1 or above. jQuery 1.7 and newer might work correctly with AngularJS
|
||||
but we don't guarantee that.
|
||||
|
||||
|
||||
### What is testability like in Angular?
|
||||
### What is testability like in AngularJS?
|
||||
|
||||
Very testable and designed this way from the ground up. It has an integrated dependency injection
|
||||
framework, provides mocks for many heavy dependencies (server-side communication). See
|
||||
{@link ngMock} for details.
|
||||
|
||||
|
||||
### How can I learn more about Angular?
|
||||
### How can I learn more about AngularJS?
|
||||
|
||||
Watch the July 17, 2012 talk
|
||||
"[AngularJS Intro + Dependency Injection](http://www.youtube.com/watch?v=1CpiB3Wk25U)".
|
||||
|
||||
|
||||
### How is Angular licensed?
|
||||
### How is AngularJS licensed?
|
||||
|
||||
The [MIT License](https://github.com/angular/angular.js/blob/master/LICENSE).
|
||||
|
||||
### Can I download and use the Angular logo artwork?
|
||||
### Can I download and use the AngularJS logo artwork?
|
||||
|
||||
Yes! You can find design files in our github repository, under "[angular.js/images/logo](https://github.com/angular/angular.js/tree/master/images/logo)"
|
||||
The logo design is licensed under a "[Creative Commons Attribution-ShareAlike 3.0 Unported License](http://creativecommons.org/licenses/by-sa/3.0/)". If you have some other use in mind, contact us.
|
||||
@@ -168,7 +216,7 @@ For a smaller order, or for other countries, we suggest downloading the logo art
|
||||
|
||||
## Common Pitfalls
|
||||
|
||||
The Angular support channel (#angularjs on Freenode) sees a number of recurring pitfalls that new users of Angular fall into.
|
||||
The AngularJS support channel (#angularjs on Freenode) sees a number of recurring pitfalls that new users of AngularJS fall into.
|
||||
This document aims to point them out before you discover them the hard way.
|
||||
|
||||
### DOM Manipulation
|
||||
@@ -179,13 +227,13 @@ Use built-in directives, or write your own where necessary, to do your DOM manip
|
||||
See below about duplicating functionality.
|
||||
|
||||
If you're struggling to break the habit, consider removing jQuery from your app.
|
||||
Really. Angular has the $http service and powerful directives that make it almost always unnecessary.
|
||||
Angular's bundled jQLite has a handful of the features most commonly used in writing Angular directives, especially binding to events.
|
||||
Really. AngularJS has the $http service and powerful directives that make it almost always unnecessary.
|
||||
AngularJS's bundled jQLite has a handful of the features most commonly used in writing AngularJS directives, especially binding to events.
|
||||
|
||||
### Trying to duplicate functionality that already exists
|
||||
|
||||
There's a good chance that your app isn't the first to require certain functionality.
|
||||
There are a few pieces of Angular that are particularly likely to be reimplemented out of old habits.
|
||||
There are a few pieces of AngularJS that are particularly likely to be reimplemented out of old habits.
|
||||
|
||||
**ng-repeat**
|
||||
|
||||
@@ -198,7 +246,7 @@ Store the data from the server in an array on your `$scope`, and bind it to the
|
||||
**ng-show**
|
||||
|
||||
`ng-show` gets this frequently too.
|
||||
Conditionally showing and hiding things using jQuery is a common pattern in other apps, but Angular has a better way.
|
||||
Conditionally showing and hiding things using jQuery is a common pattern in other apps, but AngularJS has a better way.
|
||||
`ng-show` (and `ng-hide`) conditionally show and hide elements based on boolean expressions.
|
||||
Describe the conditions for showing and hiding an element in terms of `$scope` variables:
|
||||
|
||||
@@ -211,7 +259,7 @@ Note especially the powerful `ng-switch` that should be used instead of several
|
||||
|
||||
`ng-class` is the last of the big three.
|
||||
Conditionally applying classes to elements is another thing commonly done manually using jQuery.
|
||||
Angular, of course, has a better way.
|
||||
AngularJS, of course, has a better way.
|
||||
You can give `ng-class` a whitespace-separated set of class names, and then it's identical to ordinary `class`.
|
||||
That's not very exciting, so there's a second syntax:
|
||||
|
||||
@@ -225,22 +273,22 @@ Note also the handy `ng-class-even` and `ng-class-odd`, and the related though s
|
||||
|
||||
### `$watch` and `$apply`
|
||||
|
||||
Angular's two-way data binding is the root of all awesome in Angular.
|
||||
AngularJS's two-way data binding is the root of all awesome in AngularJS.
|
||||
However, it's not magic, and there are some situations where you need to give it a nudge in the right direction.
|
||||
|
||||
When you bind a value to an element in Angular using `ng-model`, `ng-repeat`, etc., Angular creates a `$watch` on that value.
|
||||
When you bind a value to an element in AngularJS using `ng-model`, `ng-repeat`, etc., AngularJS creates a `$watch` on that value.
|
||||
Then whenever a value on a scope changes, all `$watch`es observing that element are executed, and everything updates.
|
||||
|
||||
Sometimes, usually when you're writing a custom directive, you will have to define your own `$watch` on a scope value to make the directive react to changes.
|
||||
|
||||
On the flip side, sometimes you change a scope value in some code, but the app doesn't react to it.
|
||||
Angular checks for scope variable changes after pieces of your code have finished running; for example, when `ng-click` calls a function on your scope, Angular will check for changes and react.
|
||||
However, some code is outside of Angular and you'll have to call `scope.$apply()` yourself to trigger the update.
|
||||
AngularJS checks for scope variable changes after pieces of your code have finished running; for example, when `ng-click` calls a function on your scope, AngularJS will check for changes and react.
|
||||
However, some code is outside of AngularJS and you'll have to call `scope.$apply()` yourself to trigger the update.
|
||||
This is most commonly seen in event handlers in custom directives.
|
||||
|
||||
### Combining `ng-repeat` with other directives
|
||||
|
||||
`ng-repeat` is extremely useful, one of the most powerful directives in Angular.
|
||||
`ng-repeat` is extremely useful, one of the most powerful directives in AngularJS.
|
||||
However the transformation it applies to the DOM is substantial.
|
||||
Therefore applying other directives (such as `ng-show`, `ng-controller` and others) to the same element as `ng-repeat` generally leads to problems.
|
||||
|
||||
@@ -249,7 +297,7 @@ If you want to apply a directive to each inner piece of the repeat, put it on a
|
||||
|
||||
### `$rootScope` exists, but it can be used for evil
|
||||
|
||||
Scopes in Angular form a hierarchy, prototypically inheriting from a root scope at the top of the tree.
|
||||
Scopes in AngularJS form a hierarchy, prototypically inheriting from a root scope at the top of the tree.
|
||||
Usually this can be ignored, since most views have a controller, and therefore a scope, of their own.
|
||||
|
||||
Occasionally there are pieces of data that you want to make global to the whole app.
|
||||
|
||||
@@ -32,7 +32,7 @@ tutorials.
|
||||
## Subscribe
|
||||
|
||||
* Subscribe to the [mailing list](http://groups.google.com/forum/?fromgroups#!forum/angular). Ask questions here!
|
||||
* Follow us on [Twitter](https://twitter.com/intent/follow?original_referer=http%3A%2F%2Fangularjs.org%2F®ion=follow_link&screen_name=angularjs&source=followbutton&variant=2.0)
|
||||
* Follow us on [Twitter](https://twitter.com/intent/follow?original_referer=http%3A%2F%2Fangularjs.org%2F®ion=follow_link&screen_name=angular&source=followbutton&variant=2.0)
|
||||
* Add us to your circles on [Google+](https://plus.google.com/110323587230527980117/posts)
|
||||
|
||||
## Read more
|
||||
|
||||
@@ -41,7 +41,7 @@ maintain. As we add more and more features, our files will get bigger and bigger
|
||||
difficult to navigate and find the code we are looking for.
|
||||
|
||||
Instead we should put each feature/entity in its own file. Each stand-alone controller will be
|
||||
defined in its own file, each component will be defined in each own file, etc.
|
||||
defined in its own file, each component will be defined in its own file, etc.
|
||||
|
||||
Luckily, we don't need to change anything with respect to that guideline in our code, since we have
|
||||
already defined our `phoneList` component in its own `phone-list.component.js` file. Good job!
|
||||
@@ -54,7 +54,7 @@ We will keep this in mind though, as we add more features.
|
||||
So, now that we learned we should put everything in its own file, our `app/` directory will soon be
|
||||
full with dozens of files and specs (remember we keep our unit test files next to the corresponding
|
||||
source code files). What's more important, logically related files will not be grouped together; it
|
||||
will be really difficult of locate all files related to a specific section of the application and
|
||||
will be really difficult to locate all files related to a specific section of the application and
|
||||
make a change or fix a bug.
|
||||
|
||||
So, what shall we do?
|
||||
|
||||
@@ -194,7 +194,7 @@ angular.module('phonecatApp', [
|
||||
```
|
||||
|
||||
Now, in addition to the core services and directives, we can also configure the `$route` service
|
||||
(using it's provider) for our application. In order to be able to quickly locate the configuration
|
||||
(using its provider) for our application. In order to be able to quickly locate the configuration
|
||||
code, we put it into a separate file and used the `.config` suffix.
|
||||
|
||||
<br />
|
||||
@@ -402,7 +402,7 @@ You can now rerun `npm run protractor` to see the tests run (and hopefully pass)
|
||||
|
||||
<div></div>
|
||||
|
||||
* Try to add a `{{$ctrl.phoneId}` binding in the template string for the phone details view:
|
||||
* Try to add a `{{$ctrl.phoneId}}` binding in the template string for the phone details view:
|
||||
|
||||
```js
|
||||
when('/phones/:phoneId', {
|
||||
|
||||
@@ -173,7 +173,10 @@ angular.module('phoneList', ['core.phone']);
|
||||
**`app/phone-detail/phone-detail.module.js`:**
|
||||
|
||||
```js
|
||||
angular.module('phoneDetail', ['core.phone']);
|
||||
angular.module('phoneDetail', [
|
||||
'ngRoute',
|
||||
'core.phone'
|
||||
]);
|
||||
```
|
||||
|
||||
<br />
|
||||
|
||||
@@ -46,14 +46,14 @@ Since we are using [Bower][bower] to install client-side dependencies, this step
|
||||
"angular-resource": "1.5.x",
|
||||
"angular-route": "1.5.x",
|
||||
"bootstrap": "3.3.x",
|
||||
"jquery": "2.2.x"
|
||||
"jquery": "3.2.x"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
* `"angular-animate": "1.5.x"` tells bower to install a version of the angular-animate module that
|
||||
is compatible with version 1.5.x of Angular.
|
||||
* `"jquery": "2.2.x"` tells bower to install the latest patch release of the 2.2 version of jQuery.
|
||||
* `"jquery": "3.2.x"` tells bower to install the latest patch release of the 3.2 version of jQuery.
|
||||
Note that this is not an Angular library; it is the standard jQuery library. We can use bower to
|
||||
install a wide range of 3rd party libraries.
|
||||
|
||||
|
||||
+15
-27
@@ -1,10 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
var gulp = require('gulp');
|
||||
var log = require('gulp-util').log;
|
||||
var concat = require('gulp-concat');
|
||||
var eslint = require('gulp-eslint');
|
||||
var bower = require('bower');
|
||||
var Dgeni = require('dgeni');
|
||||
var merge = require('event-stream').merge;
|
||||
var path = require('canonical-path');
|
||||
@@ -18,7 +16,6 @@ var rename = require('gulp-rename');
|
||||
// See clean and bower for async tasks, and see assets and doc-gen for dependent tasks below
|
||||
|
||||
var outputFolder = '../build/docs';
|
||||
var bowerFolder = 'bower_components';
|
||||
|
||||
var src = 'app/src/**/*.js';
|
||||
var ignoredFiles = '!src/angular.bind.js';
|
||||
@@ -55,29 +52,18 @@ var getMergedEslintConfig = function(filepath) {
|
||||
};
|
||||
};
|
||||
|
||||
var copyComponent = function(component, pattern, sourceFolder, packageFile) {
|
||||
var copyComponent = function(component, pattern, base, sourceFolder, packageFile) {
|
||||
pattern = pattern || '/**/*';
|
||||
sourceFolder = sourceFolder || bowerFolder;
|
||||
packageFile = packageFile || 'bower.json';
|
||||
base = base || '';
|
||||
sourceFolder = sourceFolder || '../node_modules';
|
||||
packageFile = packageFile || 'package.json';
|
||||
var version = require(path.resolve(sourceFolder, component, packageFile)).version;
|
||||
return gulp
|
||||
.src(sourceFolder + '/' + component + pattern)
|
||||
.src(sourceFolder + '/' + component + pattern, {base: sourceFolder + '/' + component + '/' + base})
|
||||
.pipe(gulp.dest(outputFolder + '/components/' + component + '-' + version));
|
||||
};
|
||||
|
||||
|
||||
gulp.task('bower', function() {
|
||||
var bowerTask = bower.commands.install();
|
||||
bowerTask.on('log', function(result) {
|
||||
log('bower:', result.id, result.data.endpoint.name);
|
||||
});
|
||||
bowerTask.on('error', function(error) {
|
||||
log(error);
|
||||
});
|
||||
return bowerTask;
|
||||
});
|
||||
|
||||
|
||||
gulp.task('build-app', function() {
|
||||
var file = 'docs.js';
|
||||
var minFile = 'docs.min.js';
|
||||
@@ -94,7 +80,7 @@ gulp.task('build-app', function() {
|
||||
});
|
||||
|
||||
|
||||
gulp.task('assets', ['bower'], function() {
|
||||
gulp.task('assets', function() {
|
||||
var JS_EXT = /\.js$/;
|
||||
return merge(
|
||||
gulp.src(['img/**/*']).pipe(gulp.dest(outputFolder + '/img')),
|
||||
@@ -111,17 +97,19 @@ gulp.task('assets', ['bower'], function() {
|
||||
.pipe(gulp.dest(outputFolder));
|
||||
}
|
||||
})),
|
||||
copyComponent('bootstrap', '/dist/**/*'),
|
||||
copyComponent('open-sans-fontface'),
|
||||
copyComponent('lunr.js', '/*.js'),
|
||||
copyComponent('google-code-prettify'),
|
||||
copyComponent('jquery', '/dist/*.js'),
|
||||
copyComponent('marked', '/**/*.js', '../node_modules', 'package.json')
|
||||
copyComponent('bootstrap', '/dist/css/bootstrap?(.min).css', 'dist'),
|
||||
copyComponent('bootstrap', '/dist/fonts/*', 'dist'),
|
||||
copyComponent('open-sans-fontface', '/fonts/{Regular,Semibold,Bold}/*'),
|
||||
copyComponent('lunr', '/lunr?(.min).js'),
|
||||
copyComponent('google-code-prettify', '/**/{lang-css,prettify}.js'),
|
||||
copyComponent('jquery', '/dist/jquery.js', 'dist'),
|
||||
copyComponent('marked', '/lib/marked.js'),
|
||||
copyComponent('marked', '/marked.min.js')
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
gulp.task('doc-gen', ['bower'], function() {
|
||||
gulp.task('doc-gen', function() {
|
||||
var dgeni = new Dgeni([require('./config')]);
|
||||
return dgeni.generate().catch(function() {
|
||||
process.exit(1);
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"hosting": {
|
||||
"public": "build/docs",
|
||||
"ignore": [
|
||||
"/index.html",
|
||||
"/index-debug.html",
|
||||
"/index-jquery.html"
|
||||
],
|
||||
"rewrites": [
|
||||
{
|
||||
"source": "/",
|
||||
"destination": "/index-production.html"
|
||||
},
|
||||
{
|
||||
"source": "/index.html",
|
||||
"destination": "/index-production.html"
|
||||
},
|
||||
{
|
||||
"source": "**/*!(.jpg|.jpeg|.gif|.png|.html|.js|.json|.css|.svg|.ttf|.woff|.woff2|.eot)",
|
||||
"destination": "/index-production.html"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -65,6 +65,21 @@ goog.i18n.currency.SPACE_FLAG_ = 0x20;
|
||||
goog.i18n.currency.tier2Enabled_ = false;
|
||||
|
||||
|
||||
/**
|
||||
* Tests if currency is available.
|
||||
*
|
||||
* Note: If the currency is not available it might be in the tier2 currency set:
|
||||
* {@link goog.i18n.currency.CurrencyInfoTier2}. If that is the case call
|
||||
* {@link goog.i18n.currency.addTier2Support} before calling any other function
|
||||
* in this namespace.
|
||||
*
|
||||
* @param {string} currencyCode Currency code to tested.
|
||||
* @return {boolean} If the currency is available.
|
||||
*/
|
||||
goog.i18n.currency.isAvailable = function(currencyCode) {
|
||||
return currencyCode in goog.i18n.currency.CurrencyInfo;
|
||||
};
|
||||
|
||||
/**
|
||||
* This function will add tier2 currency support. Be default, only tier1
|
||||
* (most popular currencies) are supported. If an application really needs
|
||||
@@ -84,6 +99,7 @@ goog.i18n.currency.addTier2Support = function() {
|
||||
|
||||
|
||||
/**
|
||||
* Deprecated.
|
||||
* Global currency pattern always uses ISO-4217 currency code as prefix. Local
|
||||
* currency sign is added if it is different from currency code. Each currency
|
||||
* is unique in this form. The negative side is that ISO code looks weird in
|
||||
@@ -92,6 +108,9 @@ goog.i18n.currency.addTier2Support = function() {
|
||||
*
|
||||
* @param {string} currencyCode ISO-4217 3-letter currency code.
|
||||
* @return {string} Global currency pattern string for given currency.
|
||||
* @deprecated Format numbers using {@link goog.i18n.NumberFormat} with
|
||||
* {@link goog.i18n.NumberFormat.Format.CURRENCY} and
|
||||
* {@link goog.i18n.NumberFormat.CurrencyStyle.GLOBAL}
|
||||
*/
|
||||
goog.i18n.currency.getGlobalCurrencyPattern = function(currencyCode) {
|
||||
var info = goog.i18n.currency.CurrencyInfo[currencyCode];
|
||||
@@ -119,12 +138,16 @@ goog.i18n.currency.getGlobalCurrencySign = function(currencyCode) {
|
||||
|
||||
|
||||
/**
|
||||
* Deprecated.
|
||||
* Local currency pattern is the most frequently used pattern in currency's
|
||||
* native region. It does not care about how it is distinguished from other
|
||||
* currencies.
|
||||
*
|
||||
* @param {string} currencyCode ISO-4217 3-letter currency code.
|
||||
* @return {string} Local currency pattern string for given currency.
|
||||
* @deprecated Format numbers using {@link goog.i18n.NumberFormat} with
|
||||
* {@link goog.i18n.NumberFormat.Format.CURRENCY} and
|
||||
* {@link goog.i18n.NumberFormat.CurrencyStyle.LOCAL}
|
||||
*/
|
||||
goog.i18n.currency.getLocalCurrencyPattern = function(currencyCode) {
|
||||
var info = goog.i18n.currency.CurrencyInfo[currencyCode];
|
||||
@@ -145,6 +168,7 @@ goog.i18n.currency.getLocalCurrencySign = function(currencyCode) {
|
||||
|
||||
|
||||
/**
|
||||
* Deprecated.
|
||||
* Portable currency pattern is a compromise between local and global. It is
|
||||
* not a mere blend or mid-way between the two. Currency sign is chosen so that
|
||||
* it looks familiar to native users. It also has enough information to
|
||||
@@ -154,6 +178,9 @@ goog.i18n.currency.getLocalCurrencySign = function(currencyCode) {
|
||||
*
|
||||
* @param {string} currencyCode ISO-4217 3-letter currency code.
|
||||
* @return {string} Portable currency pattern string for given currency.
|
||||
* @deprecated Format numbers using {@link goog.i18n.NumberFormat} with
|
||||
* {@link goog.i18n.NumberFormat.Format.CURRENCY} and
|
||||
* {@link goog.i18n.NumberFormat.CurrencyStyle.PORTABLE}
|
||||
*/
|
||||
goog.i18n.currency.getPortableCurrencyPattern = function(currencyCode) {
|
||||
var info = goog.i18n.currency.CurrencyInfo[currencyCode];
|
||||
@@ -174,12 +201,17 @@ goog.i18n.currency.getPortableCurrencySign = function(currencyCode) {
|
||||
|
||||
|
||||
/**
|
||||
* This function returns the default currency sign position. Some applications
|
||||
* This function returns the default currency sign's position. Some applications
|
||||
* may want to handle currency sign and currency amount separately. This
|
||||
* function can be used in such situations to correctly position the currency
|
||||
* sign relative to the amount.
|
||||
*
|
||||
* To match the behavior of ICU, position is not determined by display locale.
|
||||
* Use {@link goog.i18n.NumberFormat#isCurrencyCodeBeforeValue} for a locale
|
||||
* aware version of this API (recommended). isPrefixSignPosition() returns the
|
||||
* default currency sign's position in the currency's default locale (e.g. 'en'
|
||||
* for 'USD'), but most commonly the position is needed for the locale in which
|
||||
* the number is going to be displayed. For example, in 'fr' 10.10 USD would be
|
||||
* displayed as '10,10 $'.
|
||||
*
|
||||
* @param {string} currencyCode ISO-4217 3-letter currency code.
|
||||
* @return {boolean} true if currency should be positioned before amount field.
|
||||
@@ -267,6 +299,10 @@ goog.i18n.currency.adjustPrecision = function(pattern, currencyCode) {
|
||||
* 18: two decimals precision (2), currency sign last (16), no space (0)
|
||||
* 50: two decimals precision (2), currency sign last (16), space (32)
|
||||
*
|
||||
* It's not recommended to read this data directly. Format numbers using
|
||||
* {@link goog.i18n.NumberFormat} with
|
||||
* {@link goog.i18n.NumberFormat.Format.CURRENCY} instead.
|
||||
*
|
||||
* @const {!Object<!Array<?>>}
|
||||
*/
|
||||
goog.i18n.currency.CurrencyInfo = {
|
||||
@@ -310,7 +346,7 @@ goog.i18n.currency.CurrencyInfo = {
|
||||
'NOK': [50, 'kr', 'NOkr'],
|
||||
'PAB': [2, 'B/.', 'B/.'],
|
||||
'PEN': [2, 'S/.', 'S/.'],
|
||||
'PHP': [2, '\u20B1', 'Php'],
|
||||
'PHP': [2, '\u20B1', 'PHP'],
|
||||
'PKR': [0, 'Rs', 'PKRs.'],
|
||||
'PLN': [50, 'z\u0142', 'z\u0142'],
|
||||
'RON': [2, 'RON', 'RON'],
|
||||
@@ -334,6 +370,11 @@ goog.i18n.currency.CurrencyInfo = {
|
||||
|
||||
/**
|
||||
* Tier 2 currency information.
|
||||
*
|
||||
* It's not recommended to read this data directly. Format numbers using
|
||||
* {@link goog.i18n.NumberFormat} with
|
||||
* {@link goog.i18n.NumberFormat.Format.CURRENCY} instead.
|
||||
*
|
||||
* @const {!Object<!Array<?>>}
|
||||
*/
|
||||
goog.i18n.currency.CurrencyInfoTier2 = {
|
||||
@@ -431,7 +472,7 @@ goog.i18n.currency.CurrencyInfoTier2 = {
|
||||
'XAF': [0, 'FCFA', 'FCFA'],
|
||||
'XCD': [2, '$', 'EC$'],
|
||||
'XOF': [0, 'CFA', 'CFA'],
|
||||
'XPF': [0, 'FCFP', 'FCFP'],
|
||||
'XPF': [48, 'FCFP', 'FCFP'],
|
||||
'ZMW': [0, 'ZMW', 'ZMW'],
|
||||
'ZWD': [0, '$', 'Z$']
|
||||
};
|
||||
|
||||
+1609
-2622
File diff suppressed because it is too large
Load Diff
+4146
-12018
File diff suppressed because it is too large
Load Diff
+494
-1936
File diff suppressed because it is too large
Load Diff
+4384
-2027
File diff suppressed because it is too large
Load Diff
+21
-33
@@ -17,7 +17,7 @@
|
||||
*
|
||||
* This file is autogenerated by script:
|
||||
* http://go/generate_pluralrules.py
|
||||
* File generated from CLDR ver. 29
|
||||
* File generated from CLDR ver. 31.0.1
|
||||
*
|
||||
* Before check in, this file could have been manually edited. This is to
|
||||
* incorporate changes before we could fix CLDR. All manual modification must be
|
||||
@@ -128,22 +128,6 @@ goog.i18n.pluralRules.filSelect_ = function(n, opt_precision) {
|
||||
return goog.i18n.pluralRules.Keyword.OTHER;
|
||||
};
|
||||
|
||||
/**
|
||||
* Plural select rules for pt_PT locale
|
||||
*
|
||||
* @param {number} n The count of items.
|
||||
* @param {number=} opt_precision Precision for number formatting, if not default.
|
||||
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
|
||||
* @private
|
||||
*/
|
||||
goog.i18n.pluralRules.pt_PTSelect_ = function(n, opt_precision) {
|
||||
var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision);
|
||||
if (n == 1 && vf.v == 0) {
|
||||
return goog.i18n.pluralRules.Keyword.ONE;
|
||||
}
|
||||
return goog.i18n.pluralRules.Keyword.OTHER;
|
||||
};
|
||||
|
||||
/**
|
||||
* Plural select rules for br locale
|
||||
*
|
||||
@@ -240,6 +224,22 @@ goog.i18n.pluralRules.frSelect_ = function(n, opt_precision) {
|
||||
return goog.i18n.pluralRules.Keyword.OTHER;
|
||||
};
|
||||
|
||||
/**
|
||||
* Plural select rules for pt locale
|
||||
*
|
||||
* @param {number} n The count of items.
|
||||
* @param {number=} opt_precision Precision for number formatting, if not default.
|
||||
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
|
||||
* @private
|
||||
*/
|
||||
goog.i18n.pluralRules.ptSelect_ = function(n, opt_precision) {
|
||||
var i = n | 0;
|
||||
if (i >= 0 && i <= 1) {
|
||||
return goog.i18n.pluralRules.Keyword.ONE;
|
||||
}
|
||||
return goog.i18n.pluralRules.Keyword.OTHER;
|
||||
};
|
||||
|
||||
/**
|
||||
* Plural select rules for cs locale
|
||||
*
|
||||
@@ -559,21 +559,6 @@ goog.i18n.pluralRules.gaSelect_ = function(n, opt_precision) {
|
||||
return goog.i18n.pluralRules.Keyword.OTHER;
|
||||
};
|
||||
|
||||
/**
|
||||
* Plural select rules for pt locale
|
||||
*
|
||||
* @param {number} n The count of items.
|
||||
* @param {number=} opt_precision Precision for number formatting, if not default.
|
||||
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
|
||||
* @private
|
||||
*/
|
||||
goog.i18n.pluralRules.ptSelect_ = function(n, opt_precision) {
|
||||
if (n >= 0 && n <= 2 && n != 2) {
|
||||
return goog.i18n.pluralRules.Keyword.ONE;
|
||||
}
|
||||
return goog.i18n.pluralRules.Keyword.OTHER;
|
||||
};
|
||||
|
||||
/**
|
||||
* Plural select rules for es locale
|
||||
*
|
||||
@@ -820,6 +805,9 @@ if (goog.LOCALE == 'am') {
|
||||
if (goog.LOCALE == 'ar') {
|
||||
goog.i18n.pluralRules.select = goog.i18n.pluralRules.arSelect_;
|
||||
}
|
||||
if (goog.LOCALE == 'ar_DZ' || goog.LOCALE == 'ar-DZ') {
|
||||
goog.i18n.pluralRules.select = goog.i18n.pluralRules.arSelect_;
|
||||
}
|
||||
if (goog.LOCALE == 'az') {
|
||||
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
|
||||
}
|
||||
@@ -1061,7 +1049,7 @@ if (goog.LOCALE == 'pt_BR' || goog.LOCALE == 'pt-BR') {
|
||||
goog.i18n.pluralRules.select = goog.i18n.pluralRules.ptSelect_;
|
||||
}
|
||||
if (goog.LOCALE == 'pt_PT' || goog.LOCALE == 'pt-PT') {
|
||||
goog.i18n.pluralRules.select = goog.i18n.pluralRules.pt_PTSelect_;
|
||||
goog.i18n.pluralRules.select = goog.i18n.pluralRules.ptSelect_;
|
||||
}
|
||||
if (goog.LOCALE == 'ro') {
|
||||
goog.i18n.pluralRules.select = goog.i18n.pluralRules.roSelect_;
|
||||
|
||||
@@ -75,7 +75,6 @@ describe('findLocaleId', function() {
|
||||
it('should not find localeId if data is missing', function() {
|
||||
expect(findLocaleId('', 'num')).toBeUndefined();
|
||||
expect(findLocaleId('aa', 'datetime')).toBeUndefined();
|
||||
expect(findLocaleId('aa', 'randomType')).toBeUndefined();
|
||||
expect(findLocaleId('NumberFormatSymbols_en', 'datetime')).toBeUndefined();
|
||||
expect(findLocaleId('DateTimeSymbols_en', 'num')).toBeUndefined();
|
||||
});
|
||||
|
||||
+49
-1
@@ -1,6 +1,43 @@
|
||||
'use strict';
|
||||
|
||||
var parsePattern = require('../src/parser.js').parsePattern;
|
||||
var parser = require('../src/parser');
|
||||
var ensureDecimalSep = parser.ensureDecimalSep;
|
||||
var parsePattern = parser.parsePattern;
|
||||
|
||||
describe('ensureDecimalSep', function() {
|
||||
it('should leave patterns with DECIMAL_SEP untouched', function() {
|
||||
[
|
||||
'#,##0.00',
|
||||
'$#,##0.00',
|
||||
'#,##0.00$',
|
||||
'$0.00',
|
||||
'0.00$',
|
||||
'0.0',
|
||||
'#,##0.',
|
||||
'0.'
|
||||
].forEach(function(pattern) {
|
||||
expect(ensureDecimalSep(pattern)).toBe(pattern);
|
||||
});
|
||||
});
|
||||
|
||||
it('should add a DECIMAL_SEP in patterns that don\'t have one (after the last ZERO)', function() {
|
||||
var patterns = {
|
||||
'#,##000': '#,##000.',
|
||||
'$#,#0#00': '$#,#0#00.',
|
||||
'#,##000$': '#,##000.$',
|
||||
'$000': '$000.',
|
||||
'000$': '000.$',
|
||||
'00': '00.',
|
||||
'#,##0': '#,##0.',
|
||||
'0': '0.'
|
||||
};
|
||||
|
||||
Object.keys(patterns).forEach(function(input) {
|
||||
var output = patterns[input];
|
||||
expect(ensureDecimalSep(input)).toBe(output);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('parsePattern', function() {
|
||||
function parseAndExpect(pattern, pp, np, ps, ns, mii, mif, maf, g, lg) {
|
||||
@@ -28,6 +65,11 @@ describe('parsePattern', function() {
|
||||
'', '\u202A-', '', '\u202C', 1, 0, 3, 3, 3);
|
||||
parseAndExpect('#0.###;#0.###-', '', '', '', '-', 1, 0, 3, 0, 0);
|
||||
|
||||
// Even patterns without a DECIMAL_SEP
|
||||
parseAndExpect('#,##0', '', '-', '', '', 1, 0, 0, 3, 3);
|
||||
parseAndExpect('+#,##0', '+', '-+', '', '', 1, 0, 0, 3, 3);
|
||||
parseAndExpect('#,#0;+#,#0', '', '+', '', '', 1, 0, 0, 2, 2);
|
||||
parseAndExpect('#,##,##0+;(#,##,##0)', '', '(', '+', ')', 1, 0, 0, 2, 3);
|
||||
});
|
||||
|
||||
it('should parse CURRENCY patterns', function() {
|
||||
@@ -51,5 +93,11 @@ describe('parsePattern', function() {
|
||||
parseAndExpect('\u00A4 #,##0.00;\u00A4 #,##0.00-',
|
||||
'\u00A4 ', '\u00A4 ', '', '-', 1, 2, 2, 3, 3);
|
||||
parseAndExpect('\u00A4 #,##,##0.00', '\u00A4 ', '-\u00A4 ', '', '', 1, 2, 2, 2, 3);
|
||||
|
||||
// Even patterns without a DECIMAL_SEP
|
||||
parseAndExpect('#,##0 \u00A4', '', '-', ' \u00A4', ' \u00A4', 1, 0, 0, 3, 3);
|
||||
parseAndExpect('\u00A4 #,##0', '\u00A4 ', '-\u00A4 ', '', '', 1, 0, 0, 3, 3);
|
||||
parseAndExpect('#,#0 \u00A4;+#,#0\u00A4', '', '+', ' \u00A4', '\u00A4', 1, 0, 0, 2, 2);
|
||||
parseAndExpect('\u00A4 #,##,##0;(\u00A4 #,##,##0)', '\u00A4 ', '(\u00A4 ', '', ')', 1, 0, 0, 2, 3);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@ var Q = require('q'),
|
||||
localeInfo = {};
|
||||
|
||||
|
||||
var NG_LOCALE_DIR = '../src/ngLocale/';
|
||||
var NG_LOCALE_DIR = __dirname + '/../../src/ngLocale/';
|
||||
|
||||
|
||||
function readSymbols() {
|
||||
|
||||
+28
-6
@@ -4,13 +4,26 @@
|
||||
* A simple parser to parse a number format into a pattern object
|
||||
*/
|
||||
|
||||
exports.ensureDecimalSep = ensureDecimalSep;
|
||||
exports.parsePattern = parsePattern;
|
||||
|
||||
var PATTERN_SEP = ';',
|
||||
DECIMAL_SEP = '.',
|
||||
GROUP_SEP = ',',
|
||||
ZERO = '0',
|
||||
DIGIT = '#';
|
||||
var PATTERN_SEP = ';',
|
||||
DECIMAL_SEP = '.',
|
||||
GROUP_SEP = ',',
|
||||
DIGIT = '#',
|
||||
ZERO = '0',
|
||||
LAST_ZERO_RE = /^(.*0)(?!0)(.*)$/;
|
||||
|
||||
/**
|
||||
* Helper function for parser.
|
||||
* Ensures that `pattern` (e.g #,##0.###) contains a DECIMAL_SEP, which is necessary for further
|
||||
* parsing. If a pattern does not include one, it is added after the last ZERO (which is the last
|
||||
* thing before the `posSuf` - if any).
|
||||
*/
|
||||
function ensureDecimalSep(pattern) {
|
||||
return (pattern.indexOf(DECIMAL_SEP) !== -1)
|
||||
? pattern : pattern.replace(LAST_ZERO_RE, '$1' + DECIMAL_SEP + '$2');
|
||||
}
|
||||
|
||||
/**
|
||||
* main function for parser
|
||||
@@ -33,7 +46,16 @@ function parsePattern(pattern) {
|
||||
positive = patternParts[0],
|
||||
negative = patternParts[1];
|
||||
|
||||
var positiveParts = positive.split(DECIMAL_SEP),
|
||||
// The parsing logic further below assumes that there will always be a DECIMAL_SEP in the pattern.
|
||||
// However, some locales (e.g. agq_CM) do not have one, thus we add one after the last ZERO
|
||||
// (which is the last thing before the `posSuf` - if any). Since there will be no ZEROs or DIGITs
|
||||
// after DECIMAL_SEP, `min/maxFrac` will remain 0 (which is accurate - no fraction digits) and
|
||||
// `posSuf` will be processed correctly.
|
||||
// For example `#,##0$` would be converted to `#,##0.$`, which would (correctly) result in:
|
||||
// `minFrac: 0`, `maxFrac: 0`, `posSuf: '$'`
|
||||
// Note: We shouldn't modify `positive` directly, because it is used to parse the negative part.)
|
||||
var positiveWithDecimalSep = ensureDecimalSep(positive),
|
||||
positiveParts = positiveWithDecimalSep.split(DECIMAL_SEP),
|
||||
integer = positiveParts[0],
|
||||
fraction = positiveParts[1];
|
||||
|
||||
|
||||
@@ -9,18 +9,18 @@ var propertiesToExtract = {'IDS': 'Y', 'IDC': 'Y'};
|
||||
|
||||
function main() {
|
||||
extractValues(
|
||||
fs.createReadStream('./ucd/src/ucd.all.flat.xml.gz').pipe(zlib.createGunzip()),
|
||||
fs.createReadStream(__dirname + '/ucd.all.flat.xml.gz').pipe(zlib.createGunzip()),
|
||||
propertiesToExtract,
|
||||
writeFile);
|
||||
|
||||
function writeFile(validRanges) {
|
||||
var code = generateCode(validRanges);
|
||||
try {
|
||||
fs.lstatSync('../src/ngParseExt');
|
||||
fs.lstatSync(__dirname + '/../../../src/ngParseExt');
|
||||
} catch (e) {
|
||||
fs.mkdirSync('../src/ngParseExt');
|
||||
fs.mkdirSync(__dirname + '/../../../src/ngParseExt');
|
||||
}
|
||||
fs.writeFile('../src/ngParseExt/ucd.js', code);
|
||||
fs.writeFile(__dirname + '/../../../src/ngParseExt/ucd.js', code);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+27
-6
@@ -10,8 +10,16 @@ module.exports = function(config, specificOptions) {
|
||||
browserDisconnectTimeout: 10000,
|
||||
browserDisconnectTolerance: 2,
|
||||
browserNoActivityTimeout: 30000,
|
||||
|
||||
|
||||
reporters: ['dots'],
|
||||
specReporter: {
|
||||
maxLogLines: 5, // limit number of lines logged per test
|
||||
suppressErrorSummary: true, // do not print error summary
|
||||
suppressFailed: false, // do not print information about failed tests
|
||||
suppressPassed: true, // do not print information about passed tests
|
||||
suppressSkipped: false, // do not print information about skipped tests
|
||||
showSpecTiming: false, // print the time elapsed for each spec
|
||||
failFast: false // test would finish with error when a first fail occurs.
|
||||
},
|
||||
// SauceLabs config for local development.
|
||||
sauceLabs: {
|
||||
testName: specificOptions.testName || 'AngularJS',
|
||||
@@ -37,12 +45,12 @@ module.exports = function(config, specificOptions) {
|
||||
'SL_Chrome': {
|
||||
base: 'SauceLabs',
|
||||
browserName: 'chrome',
|
||||
version: '51'
|
||||
version: '59'
|
||||
},
|
||||
'SL_Firefox': {
|
||||
base: 'SauceLabs',
|
||||
browserName: 'firefox',
|
||||
version: '47'
|
||||
version: '54'
|
||||
},
|
||||
'SL_Safari_8': {
|
||||
base: 'SauceLabs',
|
||||
@@ -74,6 +82,12 @@ module.exports = function(config, specificOptions) {
|
||||
platform: 'Windows 8.1',
|
||||
version: '11'
|
||||
},
|
||||
'SL_EDGE': {
|
||||
base: 'SauceLabs',
|
||||
browserName: 'microsoftedge',
|
||||
platform: 'Windows 10',
|
||||
version: '14'
|
||||
},
|
||||
'SL_iOS': {
|
||||
base: 'SauceLabs',
|
||||
browserName: 'iphone',
|
||||
@@ -120,11 +134,18 @@ module.exports = function(config, specificOptions) {
|
||||
os: 'Windows',
|
||||
os_version: '8.1'
|
||||
},
|
||||
'BS_EDGE': {
|
||||
base: 'BrowserStack',
|
||||
browser: 'edge',
|
||||
browser_version: '14',
|
||||
os: 'Windows',
|
||||
os_version: '10'
|
||||
},
|
||||
'BS_iOS': {
|
||||
base: 'BrowserStack',
|
||||
device: 'iPhone 6',
|
||||
device: 'iPhone 6S',
|
||||
os: 'ios',
|
||||
os_version: '8.0'
|
||||
os_version: '9.3'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -25,7 +25,7 @@ PORTS.forEach(function(port) {
|
||||
|
||||
var tunnel = new BrowserStackTunnel({
|
||||
key: ACCESS_KEY,
|
||||
tunnelIdentifier: TUNNEL_IDENTIFIER,
|
||||
localIdentifier: TUNNEL_IDENTIFIER,
|
||||
hosts: hosts
|
||||
});
|
||||
|
||||
|
||||
+26
-15
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "angularjs",
|
||||
"license": "MIT",
|
||||
"branchVersion": "^1.5.8",
|
||||
"branchVersion": "^1.6.0",
|
||||
"branchPattern": "1.6.*",
|
||||
"distTag": "latest",
|
||||
"repository": {
|
||||
@@ -10,7 +10,7 @@
|
||||
},
|
||||
"engines": {
|
||||
"node": "^6.9.1",
|
||||
"yarn": "^0.17.9",
|
||||
"yarn": ">=0.21.3",
|
||||
"grunt": "^1.2.0"
|
||||
},
|
||||
"scripts": {
|
||||
@@ -22,19 +22,22 @@
|
||||
"devDependencies": {
|
||||
"angular-benchpress": "0.x.x",
|
||||
"benchmark": "1.x.x",
|
||||
"bootstrap": "3.1.1",
|
||||
"bower": "~1.3.9",
|
||||
"browserstacktunnel-wrapper": "^1.4.2",
|
||||
"browserstacktunnel-wrapper": "2.0.0",
|
||||
"canonical-path": "0.0.2",
|
||||
"changez": "^2.1.1",
|
||||
"changez-angular": "^2.1.0",
|
||||
"changez-angular": "^2.1.2",
|
||||
"cheerio": "^0.17.0",
|
||||
"commitizen": "^2.3.0",
|
||||
"commitplease": "^2.7.10",
|
||||
"cross-spawn": "^4.0.0",
|
||||
"cz-conventional-changelog": "1.1.4",
|
||||
"dgeni": "^0.4.0",
|
||||
"dgeni-packages": "^0.16.0",
|
||||
"dgeni-packages": "^0.16.4",
|
||||
"event-stream": "~3.1.0",
|
||||
"glob": "^6.0.1",
|
||||
"google-code-prettify": "1.0.1",
|
||||
"grunt": "^1.0.1",
|
||||
"grunt-bump": "^0.8.0",
|
||||
"grunt-cli": "^1.2.0",
|
||||
@@ -54,26 +57,30 @@
|
||||
"gulp-sourcemaps": "^1.2.2",
|
||||
"gulp-uglify": "^1.0.1",
|
||||
"gulp-util": "^3.0.1",
|
||||
"jasmine-core": "^2.4.0",
|
||||
"jasmine-core": "2.5.2",
|
||||
"jasmine-node": "^2.0.0",
|
||||
"jasmine-reporters": "^2.2.0",
|
||||
"karma": "^1.1.2",
|
||||
"karma-browserstack-launcher": "^1.0.1",
|
||||
"karma-chrome-launcher": "^1.0.1",
|
||||
"karma-firefox-launcher": "^1.0.0",
|
||||
"karma-jasmine": "^1.0.2",
|
||||
"karma-junit-reporter": "^1.1.0",
|
||||
"jquery": "^3.2.1",
|
||||
"karma": "^1.7.0",
|
||||
"karma-browserstack-launcher": "^1.2.0",
|
||||
"karma-chrome-launcher": "^2.1.1",
|
||||
"karma-firefox-launcher": "^1.0.1",
|
||||
"karma-jasmine": "^1.1.0",
|
||||
"karma-junit-reporter": "^1.2.0",
|
||||
"karma-ng-scenario": "^1.0.0",
|
||||
"karma-sauce-launcher": "^1.0.0",
|
||||
"karma-sauce-launcher": "^1.1.0",
|
||||
"karma-script-launcher": "^1.0.0",
|
||||
"karma-spec-reporter": "^0.0.31",
|
||||
"load-grunt-tasks": "^3.5.0",
|
||||
"lodash": "~2.4.1",
|
||||
"log4js": "^0.6.27",
|
||||
"lunr": "^0.7.2",
|
||||
"marked": "~0.3.0",
|
||||
"node-html-encoder": "0.0.2",
|
||||
"npm-run": "^4.1.0",
|
||||
"open-sans-fontface": "^1.4.0",
|
||||
"promises-aplus-tests": "~2.1.0",
|
||||
"protractor": "^4.0.10",
|
||||
"protractor": "^5.1.2",
|
||||
"q": "~1.0.0",
|
||||
"q-io": "^1.10.9",
|
||||
"qq": "^0.3.5",
|
||||
@@ -89,9 +96,13 @@
|
||||
"stringmap": "^0.2.2"
|
||||
},
|
||||
"dependencies": {},
|
||||
"commitplease": {
|
||||
"style": "angular",
|
||||
"nohook": true
|
||||
},
|
||||
"config": {
|
||||
"commitizen": {
|
||||
"path": "node_modules/cz-conventional-changelog"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
Firebase for docs.angularjs.org
|
||||
===============================
|
||||
|
||||
The docs are deployed to Google Firebase hosting via Travis deployment config, which expects
|
||||
firebase.json and .firebaserc in the repository root.
|
||||
|
||||
See travis.yml for the complete deployment config.
|
||||
|
||||
See /scripts/code.angularjs.org-firebase/readme.firebase.code.md for the firebase deployment to
|
||||
code.angularjs.org
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"env": {
|
||||
"es6": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"projects": {
|
||||
"default": "code-angularjs-org-338b8"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"hosting": {
|
||||
"public": "public",
|
||||
"redirects": [
|
||||
{
|
||||
"source": "/:version/docs",
|
||||
"destination": "/:version/docs/index.html",
|
||||
"type": 301
|
||||
}
|
||||
],
|
||||
"rewrites": [
|
||||
{
|
||||
"source": "/**",
|
||||
"function": "sendStoredFile"
|
||||
}
|
||||
]
|
||||
},
|
||||
"storage": {
|
||||
"rules": "storage.rules"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
'use strict';
|
||||
|
||||
const functions = require('firebase-functions');
|
||||
const gcs = require('@google-cloud/storage')();
|
||||
const path = require('path');
|
||||
|
||||
const gcsBucketId = `${process.env.GCLOUD_PROJECT}.appspot.com`;
|
||||
|
||||
const BROWSER_CACHE_DURATION = 300;
|
||||
const CDN_CACHE_DURATION = 600;
|
||||
|
||||
function sendStoredFile(request, response) {
|
||||
let filePathSegments = request.path.split('/').filter((segment) => {
|
||||
// Remove empty leading or trailing path parts
|
||||
return segment !== '';
|
||||
});
|
||||
|
||||
const version = filePathSegments[0];
|
||||
const isDocsPath = filePathSegments[1] === 'docs';
|
||||
const lastSegment = filePathSegments[filePathSegments.length - 1];
|
||||
const bucket = gcs.bucket(gcsBucketId);
|
||||
|
||||
let downloadSource;
|
||||
let fileName;
|
||||
|
||||
if (isDocsPath && filePathSegments.length === 2) {
|
||||
fileName = 'index.html';
|
||||
filePathSegments = [version, 'docs', fileName];
|
||||
} else {
|
||||
fileName = lastSegment;
|
||||
}
|
||||
|
||||
if (!fileName) {
|
||||
//Root
|
||||
return getDirectoryListing('/').catch(sendErrorResponse);
|
||||
}
|
||||
|
||||
downloadSource = path.join.apply(null, filePathSegments);
|
||||
|
||||
downloadAndSend(downloadSource).catch(error => {
|
||||
if (isDocsPath && error.code === 404) {
|
||||
fileName = 'index.html';
|
||||
filePathSegments = [version, 'docs', fileName];
|
||||
downloadSource = path.join.apply(null, filePathSegments);
|
||||
|
||||
return downloadAndSend(downloadSource);
|
||||
}
|
||||
|
||||
return Promise.reject(error);
|
||||
}).catch(error => {
|
||||
|
||||
// If file not found, try the path as a directory
|
||||
return error.code === 404 ? getDirectoryListing(request.path.slice(1)) : Promise.reject(error);
|
||||
}).catch(sendErrorResponse);
|
||||
|
||||
function downloadAndSend(downloadSource) {
|
||||
|
||||
const file = bucket.file(downloadSource);
|
||||
|
||||
return file.getMetadata().then(data => {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
const readStream = file.createReadStream()
|
||||
.on('error', error => {
|
||||
reject(error);
|
||||
})
|
||||
.on('response', () => {
|
||||
resolve(response);
|
||||
});
|
||||
|
||||
response
|
||||
.status(200)
|
||||
.set({
|
||||
'Content-Type': data[0].contentType,
|
||||
'Cache-Control': `public, max-age=${BROWSER_CACHE_DURATION}, s-maxage=${CDN_CACHE_DURATION}`
|
||||
});
|
||||
|
||||
readStream.pipe(response);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function sendErrorResponse(error) {
|
||||
let code = 500;
|
||||
let message = `General error. Please try again later.
|
||||
If the error persists, please create an issue in the
|
||||
<a href="https://github.com/angular/angular.js/issues">AngularJS Github repository</a>`;
|
||||
|
||||
if (error.code === 404) {
|
||||
message = 'File or directory not found';
|
||||
code = 404;
|
||||
}
|
||||
|
||||
return response.status(code).send(message);
|
||||
}
|
||||
|
||||
function getDirectoryListing(path) {
|
||||
if (!path.endsWith('/')) path += '/';
|
||||
|
||||
const getFilesOptions = {
|
||||
delimiter: '/',
|
||||
autoPaginate: false
|
||||
};
|
||||
|
||||
if (path !== '/') getFilesOptions.prefix = path;
|
||||
|
||||
let fileList = [];
|
||||
let directoryList = [];
|
||||
|
||||
return getContent(getFilesOptions).then(() => {
|
||||
let contentList = '';
|
||||
|
||||
directoryList.forEach(directoryPath => {
|
||||
const dirName = directoryPath.split('/').reverse()[1];
|
||||
contentList += `<a href="${dirName}/">${dirName}/</a><br>`;
|
||||
});
|
||||
|
||||
fileList.forEach(file => {
|
||||
const fileName = file.metadata.name.split('/').pop();
|
||||
contentList += `<a href="${fileName}">${fileName}</a><br>`;
|
||||
});
|
||||
|
||||
// A trailing slash in the base creates correct relative links when the url is accessed
|
||||
// without trailing slash
|
||||
const base = request.originalUrl.endsWith('/') ? request.originalUrl : request.originalUrl + '/';
|
||||
|
||||
let directoryListing = `
|
||||
<base href="${base}">
|
||||
<h1>Index of ${path}</h1>
|
||||
<hr>
|
||||
<pre>${contentList}</pre>`;
|
||||
|
||||
return response
|
||||
.status(200)
|
||||
.set({
|
||||
'Cache-Control': `public, max-age=${BROWSER_CACHE_DURATION}, s-maxage=${CDN_CACHE_DURATION}`
|
||||
})
|
||||
.send(directoryListing);
|
||||
});
|
||||
|
||||
function getContent(options) {
|
||||
return bucket.getFiles(options).then(data => {
|
||||
const files = data[0];
|
||||
const nextQuery = data[1];
|
||||
const apiResponse = data[2];
|
||||
|
||||
if (!files.length && (!apiResponse || !apiResponse.prefixes)) {
|
||||
return Promise.reject({
|
||||
code: 404
|
||||
});
|
||||
}
|
||||
|
||||
fileList = fileList.concat(files);
|
||||
|
||||
if (apiResponse && apiResponse.prefixes) {
|
||||
directoryList = directoryList.concat(apiResponse.prefixes);
|
||||
}
|
||||
|
||||
if (nextQuery) {
|
||||
// If the results are paged, get the next page
|
||||
return getContent(nextQuery);
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function deleteOldSnapshotZip(event) {
|
||||
const object = event.data;
|
||||
|
||||
const bucketId = object.bucket;
|
||||
const filePath = object.name;
|
||||
const contentType = object.contentType;
|
||||
const resourceState = object.resourceState;
|
||||
|
||||
const bucket = gcs.bucket(bucketId);
|
||||
|
||||
if (contentType !== 'application/zip' ||
|
||||
!filePath.startsWith('snapshot/') ||
|
||||
resourceState === 'not_exists' // Deletion event
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
bucket.getFiles({
|
||||
prefix: 'snapshot/',
|
||||
delimiter: '/',
|
||||
autoPaginate: false
|
||||
}).then(function(data) {
|
||||
const files = data[0];
|
||||
|
||||
const oldZipFiles = files.filter(file => {
|
||||
return file.metadata.name !== filePath && file.metadata.contentType === 'application/zip';
|
||||
});
|
||||
|
||||
oldZipFiles.forEach(function(file) {
|
||||
file.delete();
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
exports.sendStoredFile = functions.https.onRequest(sendStoredFile);
|
||||
exports.deleteOldSnapshotZip = functions.storage.object().onChange(deleteOldSnapshotZip);
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "functions-firebase-code.angularjs.org",
|
||||
"description": "Cloud Functions to serve files from gcs to code.angularjs.org",
|
||||
"dependencies": {
|
||||
"@google-cloud/storage": "^1.1.1",
|
||||
"firebase-admin": "^4.2.1",
|
||||
"firebase-functions": "^0.5.9"
|
||||
},
|
||||
"private": true
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1 @@
|
||||
google-site-verification: googleb96cceae5888d79f.html
|
||||
@@ -0,0 +1,5 @@
|
||||
User-agent: *
|
||||
|
||||
Disallow: /*docs/
|
||||
Disallow: /*i18n/
|
||||
Disallow: /*.zip$
|
||||
@@ -0,0 +1,12 @@
|
||||
Firebase for code.angularjs.org
|
||||
===============================
|
||||
|
||||
This folder contains the Google Firebase scripts for the code.angularjs.org setup.
|
||||
|
||||
firebase.json contains the rewrite rules that route every subdirectory request to the cloud function
|
||||
in functions/index.js that serves the docs from the Firebase Google Cloud Storage bucket.
|
||||
|
||||
The deployment to the Google Cloud Storage bucket happens automatically via Travis. See the travis.yml
|
||||
file in the repository root.
|
||||
|
||||
See /readme.firebase.docs.md for the firebase deployment to docs.angularjs.org
|
||||
@@ -0,0 +1,7 @@
|
||||
service firebase.storage {
|
||||
match /b/{bucket}/o {
|
||||
match /{allPaths=**} {
|
||||
allow read, write: if request.auth!=null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,19 +59,12 @@ function _update_code() {
|
||||
|
||||
echo "-- Pushing code.angularjs.org"
|
||||
git push origin master
|
||||
|
||||
for backend in "$@" ; do
|
||||
echo "-- Refreshing code.angularjs.org: backend=$backend"
|
||||
curl http://$backend:8003/gitFetchSite.php
|
||||
done
|
||||
}
|
||||
|
||||
function publish {
|
||||
# The TXT record for backends.angularjs.org is a CSV of the IP addresses for
|
||||
# the currently serving Compute Engine backends.
|
||||
# code.angularjs.org is served out of port 8003 on these backends.
|
||||
backends=("$(dig backends.angularjs.org +short TXT | python -c 'print raw_input()[1:-1].replace(",", "\n")')")
|
||||
_update_code ${backends[@]}
|
||||
# publish updates the code.angularjs.org Github repository
|
||||
# the deployment to Firebase happens via Travis
|
||||
_update_code
|
||||
}
|
||||
|
||||
source $(dirname $0)/../utils.inc
|
||||
|
||||
@@ -12,7 +12,7 @@ set -xe
|
||||
# This is the default set of browsers to use on the CI server unless overridden via env variable
|
||||
if [[ -z "$BROWSERS" ]]
|
||||
then
|
||||
BROWSERS="Chrome,Firefox,Opera,/Users/jenkins/bin/safari.sh"
|
||||
BROWSERS="Chrome,Firefox,/Users/jenkins/bin/safari.sh"
|
||||
fi
|
||||
|
||||
# CLEAN #
|
||||
|
||||
@@ -8,7 +8,7 @@ nvm install
|
||||
|
||||
# clean out and install yarn
|
||||
rm -rf ~/.yarn
|
||||
curl -o- -L https://raw.githubusercontent.com/yarnpkg/yarn/2a0afc73210c7a82082585283e518eeb88ca19ae/scripts/install-latest.sh | bash -s -- --version 0.17.9
|
||||
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 0.21.3
|
||||
export PATH="$HOME/.yarn/bin:$PATH"
|
||||
|
||||
# Ensure that we have the local dependencies installed
|
||||
|
||||
@@ -4,15 +4,28 @@ set -e
|
||||
|
||||
yarn global add grunt-cli@1.2.0
|
||||
|
||||
mkdir -p $LOGS_DIR
|
||||
mkdir -p "$LOGS_DIR"
|
||||
|
||||
if [ $JOB != "ci-checks" ]; then
|
||||
if [ "$JOB" != "ci-checks" ]; then
|
||||
echo "start_browser_provider"
|
||||
./scripts/travis/start_browser_provider.sh
|
||||
fi
|
||||
|
||||
if [ $JOB != "ci-checks" ]; then
|
||||
# ci-checks and unit tests do not run against the packaged code
|
||||
if [ "$JOB" != "ci-checks" ] && [ "$JOB" != "unit" ]; then
|
||||
grunt package
|
||||
fi
|
||||
|
||||
# unit runs the docs tests too which need a built version of the code
|
||||
if [ "$JOB" = "unit" ]; then
|
||||
grunt bower
|
||||
grunt validate-angular-files
|
||||
grunt build
|
||||
fi
|
||||
|
||||
# check this after the package, because at this point the browser_provider
|
||||
# has probably arrived
|
||||
if [ "$JOB" != "ci-checks" ]; then
|
||||
echo "wait_for_browser_provider"
|
||||
./scripts/travis/wait_for_browser_provider.sh
|
||||
fi
|
||||
fi
|
||||
+50
-26
@@ -5,32 +5,56 @@ set -e
|
||||
export BROWSER_STACK_ACCESS_KEY=`echo $BROWSER_STACK_ACCESS_KEY | rev`
|
||||
export SAUCE_ACCESS_KEY=`echo $SAUCE_ACCESS_KEY | rev`
|
||||
|
||||
if [ "$JOB" == "ci-checks" ]; then
|
||||
grunt ci-checks
|
||||
elif [ "$JOB" == "unit" ]; then
|
||||
if [ "$BROWSER_PROVIDER" == "browserstack" ]; then
|
||||
BROWSERS="BS_Chrome,BS_Safari,BS_Firefox,BS_IE_9,BS_IE_10,BS_IE_11,BS_iOS"
|
||||
else
|
||||
BROWSERS="SL_Chrome,SL_Firefox,SL_Safari_8,SL_Safari_9,SL_IE_9,SL_IE_10,SL_IE_11,SL_iOS"
|
||||
fi
|
||||
case "$JOB" in
|
||||
"ci-checks")
|
||||
grunt ci-checks
|
||||
|
||||
grunt test:promises-aplus
|
||||
grunt test:unit --browsers="$BROWSERS" --reporters=dots
|
||||
grunt tests:docs --browsers="$BROWSERS" --reporters=dots
|
||||
elif [ "$JOB" == "docs-e2e" ]; then
|
||||
grunt test:travis-protractor --specs="docs/app/e2e/**/*.scenario.js"
|
||||
elif [ "$JOB" == "e2e" ]; then
|
||||
if [[ $TEST_TARGET == jquery* ]]; then
|
||||
export USE_JQUERY=1
|
||||
fi
|
||||
if [[ $TRAVIS_PULL_REQUEST != 'false' ]]; then
|
||||
# validate commit messages of all commits in the PR
|
||||
# convert commit range to 2 dots, as commitplease uses `git log`.
|
||||
# See https://github.com/travis-ci/travis-ci/issues/4596 for more info
|
||||
echo "Validate commit messages in PR:"
|
||||
yarn run commitplease -- "${TRAVIS_COMMIT_RANGE/.../..}"
|
||||
fi
|
||||
;;
|
||||
"unit")
|
||||
if [ "$BROWSER_PROVIDER" == "browserstack" ]; then
|
||||
BROWSERS="BS_Chrome,BS_Safari,BS_Firefox,BS_IE_9,BS_IE_10,BS_IE_11,BS_EDGE,BS_iOS"
|
||||
else
|
||||
BROWSERS="SL_Chrome,SL_Firefox,SL_Safari_8,SL_Safari_9,SL_IE_9,SL_IE_10,SL_IE_11,SL_EDGE,SL_iOS"
|
||||
fi
|
||||
|
||||
export TARGET_SPECS="build/docs/ptore2e/**/default_test.js"
|
||||
if [[ "$TEST_TARGET" == jquery* ]]; then
|
||||
TARGET_SPECS="build/docs/ptore2e/**/jquery_test.js"
|
||||
fi
|
||||
grunt test:promises-aplus
|
||||
grunt test:unit --browsers="$BROWSERS" --reporters=spec
|
||||
grunt tests:docs --browsers="$BROWSERS" --reporters=spec
|
||||
;;
|
||||
"docs-e2e")
|
||||
grunt test:travis-protractor --specs="docs/app/e2e/**/*.scenario.js"
|
||||
;;
|
||||
"e2e")
|
||||
if [[ $TEST_TARGET == jquery* ]]; then
|
||||
export USE_JQUERY=1
|
||||
fi
|
||||
|
||||
export TARGET_SPECS="test/e2e/tests/**/*.js,$TARGET_SPECS"
|
||||
grunt test:travis-protractor --specs="$TARGET_SPECS"
|
||||
else
|
||||
echo "Unknown job type. Please set JOB=ci-checks, JOB=unit or JOB=e2e-*."
|
||||
fi
|
||||
export TARGET_SPECS="build/docs/ptore2e/**/default_test.js"
|
||||
|
||||
if [[ "$TEST_TARGET" == jquery* ]]; then
|
||||
TARGET_SPECS="build/docs/ptore2e/**/jquery_test.js"
|
||||
fi
|
||||
|
||||
export TARGET_SPECS="test/e2e/tests/**/*.js,$TARGET_SPECS"
|
||||
grunt test:travis-protractor --specs="$TARGET_SPECS"
|
||||
;;
|
||||
"deploy")
|
||||
# we never deploy on Pull requests, so it's safe to skip the build here
|
||||
if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then
|
||||
grunt package
|
||||
grunt compress:firebaseCodeDeploy
|
||||
else
|
||||
echo "Skipping build because Travis has been triggered by Pull Request"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Unknown job type. Please set JOB=ci-checks, JOB=unit, JOB=deploy or JOB=e2e-*."
|
||||
;;
|
||||
esac
|
||||
+9
-1
@@ -15,6 +15,9 @@
|
||||
"splice": false,
|
||||
"push": false,
|
||||
"toString": false,
|
||||
"minErrConfig": false,
|
||||
"errorHandlingConfig": false,
|
||||
"isValidObjectMaxDepth": false,
|
||||
"ngMinErr": false,
|
||||
"_angular": false,
|
||||
"angularModule": false,
|
||||
@@ -47,6 +50,7 @@
|
||||
"isNumber": false,
|
||||
"isNumberNaN": false,
|
||||
"isDate": false,
|
||||
"isError": false,
|
||||
"isArray": false,
|
||||
"isFunction": false,
|
||||
"isRegExp": false,
|
||||
@@ -66,6 +70,7 @@
|
||||
"arrayRemove": false,
|
||||
"copy": false,
|
||||
"shallowCopy": false,
|
||||
"simpleCompare": false,
|
||||
"equals": false,
|
||||
"csp": false,
|
||||
"concat": false,
|
||||
@@ -150,7 +155,7 @@
|
||||
|
||||
/* apis.js */
|
||||
"hashKey": false,
|
||||
"HashMap": false,
|
||||
"NgMap": false,
|
||||
|
||||
/* urlUtils.js */
|
||||
"urlResolve": false,
|
||||
@@ -162,6 +167,9 @@
|
||||
/* ng/compile.js */
|
||||
"directiveNormalize": false,
|
||||
|
||||
/* ng/q.js */
|
||||
"markQExceptionHandled": false,
|
||||
|
||||
/* ng/directive/directives.js */
|
||||
"ngDirective": false,
|
||||
|
||||
|
||||
+101
-38
@@ -10,6 +10,9 @@
|
||||
splice,
|
||||
push,
|
||||
toString,
|
||||
minErrConfig,
|
||||
errorHandlingConfig,
|
||||
isValidObjectMaxDepth,
|
||||
ngMinErr,
|
||||
angularModule,
|
||||
uid,
|
||||
@@ -42,6 +45,7 @@
|
||||
isNumber,
|
||||
isNumberNaN,
|
||||
isDate,
|
||||
isError,
|
||||
isArray,
|
||||
isFunction,
|
||||
isRegExp,
|
||||
@@ -59,6 +63,7 @@
|
||||
includes,
|
||||
arrayRemove,
|
||||
copy,
|
||||
simpleCompare,
|
||||
equals,
|
||||
csp,
|
||||
jq,
|
||||
@@ -432,6 +437,20 @@ function extend(dst) {
|
||||
* Unlike {@link angular.extend extend()}, `merge()` recursively descends into object properties of source
|
||||
* objects, performing a deep copy.
|
||||
*
|
||||
* @deprecated
|
||||
* 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.
|
||||
*
|
||||
* @knownIssue
|
||||
* This is a list of (known) object types that are not handled correctly by this function:
|
||||
* - [`Blob`](https://developer.mozilla.org/docs/Web/API/Blob)
|
||||
* - [`MediaStream`](https://developer.mozilla.org/docs/Web/API/MediaStream)
|
||||
* - [`CanvasGradient`](https://developer.mozilla.org/docs/Web/API/CanvasGradient)
|
||||
* - AngularJS {@link $rootScope.Scope scopes};
|
||||
*
|
||||
* @param {Object} dst Destination object.
|
||||
* @param {...Object} src Source object(s).
|
||||
* @returns {Object} Reference to `dst`.
|
||||
@@ -641,6 +660,24 @@ function isDate(value) {
|
||||
*/
|
||||
var isArray = Array.isArray;
|
||||
|
||||
/**
|
||||
* @description
|
||||
* Determines if a reference is an `Error`.
|
||||
* Loosely based on https://www.npmjs.com/package/iserror
|
||||
*
|
||||
* @param {*} value Reference to check.
|
||||
* @returns {boolean} True if `value` is an `Error`.
|
||||
*/
|
||||
function isError(value) {
|
||||
var tag = toString.call(value);
|
||||
switch (tag) {
|
||||
case '[object Error]': return true;
|
||||
case '[object Exception]': return true;
|
||||
case '[object DOMException]': return true;
|
||||
default: return value instanceof Error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.isFunction
|
||||
@@ -847,9 +884,10 @@ function arrayRemove(array, value) {
|
||||
</file>
|
||||
</example>
|
||||
*/
|
||||
function copy(source, destination) {
|
||||
function copy(source, destination, maxDepth) {
|
||||
var stackSource = [];
|
||||
var stackDest = [];
|
||||
maxDepth = isValidObjectMaxDepth(maxDepth) ? maxDepth : NaN;
|
||||
|
||||
if (destination) {
|
||||
if (isTypedArray(destination) || isArrayBuffer(destination)) {
|
||||
@@ -872,35 +910,39 @@ function copy(source, destination) {
|
||||
|
||||
stackSource.push(source);
|
||||
stackDest.push(destination);
|
||||
return copyRecurse(source, destination);
|
||||
return copyRecurse(source, destination, maxDepth);
|
||||
}
|
||||
|
||||
return copyElement(source);
|
||||
return copyElement(source, maxDepth);
|
||||
|
||||
function copyRecurse(source, destination) {
|
||||
function copyRecurse(source, destination, maxDepth) {
|
||||
maxDepth--;
|
||||
if (maxDepth < 0) {
|
||||
return '...';
|
||||
}
|
||||
var h = destination.$$hashKey;
|
||||
var key;
|
||||
if (isArray(source)) {
|
||||
for (var i = 0, ii = source.length; i < ii; i++) {
|
||||
destination.push(copyElement(source[i]));
|
||||
destination.push(copyElement(source[i], maxDepth));
|
||||
}
|
||||
} else if (isBlankObject(source)) {
|
||||
// createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
|
||||
for (key in source) {
|
||||
destination[key] = copyElement(source[key]);
|
||||
destination[key] = copyElement(source[key], maxDepth);
|
||||
}
|
||||
} else if (source && typeof source.hasOwnProperty === 'function') {
|
||||
// Slow path, which must rely on hasOwnProperty
|
||||
for (key in source) {
|
||||
if (source.hasOwnProperty(key)) {
|
||||
destination[key] = copyElement(source[key]);
|
||||
destination[key] = copyElement(source[key], maxDepth);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Slowest path --- hasOwnProperty can't be called as a method
|
||||
for (key in source) {
|
||||
if (hasOwnProperty.call(source, key)) {
|
||||
destination[key] = copyElement(source[key]);
|
||||
destination[key] = copyElement(source[key], maxDepth);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -908,7 +950,7 @@ function copy(source, destination) {
|
||||
return destination;
|
||||
}
|
||||
|
||||
function copyElement(source) {
|
||||
function copyElement(source, maxDepth) {
|
||||
// Simple values
|
||||
if (!isObject(source)) {
|
||||
return source;
|
||||
@@ -937,7 +979,7 @@ function copy(source, destination) {
|
||||
stackDest.push(destination);
|
||||
|
||||
return needsRecurse
|
||||
? copyRecurse(source, destination)
|
||||
? copyRecurse(source, destination, maxDepth)
|
||||
: destination;
|
||||
}
|
||||
|
||||
@@ -988,6 +1030,10 @@ function copy(source, destination) {
|
||||
}
|
||||
|
||||
|
||||
// eslint-disable-next-line no-self-compare
|
||||
function simpleCompare(a, b) { return a === b || (a !== a && b !== b); }
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.equals
|
||||
@@ -1068,7 +1114,7 @@ function equals(o1, o2) {
|
||||
}
|
||||
} else if (isDate(o1)) {
|
||||
if (!isDate(o2)) return false;
|
||||
return equals(o1.getTime(), o2.getTime());
|
||||
return simpleCompare(o1.getTime(), o2.getTime());
|
||||
} else if (isRegExp(o1)) {
|
||||
if (!isRegExp(o2)) return false;
|
||||
return o1.toString() === o2.toString();
|
||||
@@ -1312,7 +1358,7 @@ function fromJson(json) {
|
||||
|
||||
var ALL_COLONS = /:/g;
|
||||
function timezoneToOffset(timezone, fallback) {
|
||||
// Support: IE 9-11 only, Edge 13-14+
|
||||
// Support: IE 9-11 only, Edge 13-15+
|
||||
// IE/Edge do not "understand" colon (`:`) in timezone
|
||||
timezone = timezone.replace(ALL_COLONS, '');
|
||||
var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
|
||||
@@ -1339,12 +1385,7 @@ function convertTimezoneToLocal(date, timezone, reverse) {
|
||||
* @returns {string} Returns the string representation of the element.
|
||||
*/
|
||||
function startingTag(element) {
|
||||
element = jqLite(element).clone();
|
||||
try {
|
||||
// turns out IE does not let you set .html() on elements which
|
||||
// are not allowed to have children. So we just ignore it.
|
||||
element.empty();
|
||||
} catch (e) { /* empty */ }
|
||||
element = jqLite(element).clone().empty();
|
||||
var elemHtml = jqLite('<div>').append(element).html();
|
||||
try {
|
||||
return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) :
|
||||
@@ -1479,30 +1520,52 @@ function getNgAttribute(element, ngAttr) {
|
||||
}
|
||||
|
||||
function allowAutoBootstrap(document) {
|
||||
if (!document.currentScript) {
|
||||
var script = document.currentScript;
|
||||
|
||||
if (!script) {
|
||||
// Support: IE 9-11 only
|
||||
// IE does not have `document.currentScript`
|
||||
return true;
|
||||
}
|
||||
var src = document.currentScript.getAttribute('src');
|
||||
var link = document.createElement('a');
|
||||
link.href = src;
|
||||
if (document.location.origin === link.origin) {
|
||||
// Same-origin resources are always allowed, even for non-whitelisted schemes.
|
||||
return true;
|
||||
|
||||
// If the `currentScript` property has been clobbered just return false, since this indicates a probable attack
|
||||
if (!(script instanceof window.HTMLScriptElement || script instanceof window.SVGScriptElement)) {
|
||||
return false;
|
||||
}
|
||||
// Disabled bootstrapping unless angular.js was loaded from a known scheme used on the web.
|
||||
// This is to prevent angular.js bundled with browser extensions from being used to bypass the
|
||||
// content security policy in web pages and other browser extensions.
|
||||
switch (link.protocol) {
|
||||
case 'http:':
|
||||
case 'https:':
|
||||
case 'ftp:':
|
||||
case 'blob:':
|
||||
case 'file:':
|
||||
case 'data:':
|
||||
|
||||
var attributes = script.attributes;
|
||||
var srcs = [attributes.getNamedItem('src'), attributes.getNamedItem('href'), attributes.getNamedItem('xlink:href')];
|
||||
|
||||
return srcs.every(function(src) {
|
||||
if (!src) {
|
||||
return true;
|
||||
default:
|
||||
}
|
||||
if (!src.value) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
var link = document.createElement('a');
|
||||
link.href = src.value;
|
||||
|
||||
if (document.location.origin === link.origin) {
|
||||
// Same-origin resources are always allowed, even for non-whitelisted schemes.
|
||||
return true;
|
||||
}
|
||||
// Disabled bootstrapping unless angular.js was loaded from a known scheme used on the web.
|
||||
// This is to prevent angular.js bundled with browser extensions from being used to bypass the
|
||||
// content security policy in web pages and other browser extensions.
|
||||
switch (link.protocol) {
|
||||
case 'http:':
|
||||
case 'https:':
|
||||
case 'ftp:':
|
||||
case 'blob:':
|
||||
case 'file:':
|
||||
case 'data:':
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Cached as it has to run during loading so that document.currentScript is available.
|
||||
@@ -1866,7 +1929,7 @@ function bindJQuery() {
|
||||
extend(jQuery.fn, {
|
||||
scope: JQLitePrototype.scope,
|
||||
isolateScope: JQLitePrototype.isolateScope,
|
||||
controller: JQLitePrototype.controller,
|
||||
controller: /** @type {?} */ (JQLitePrototype).controller,
|
||||
injector: JQLitePrototype.injector,
|
||||
inheritedData: JQLitePrototype.inheritedData
|
||||
});
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user