This reverts commit 5e28b6ea8c.
Reverting while investigating security implications of 5e28b6e without #15597
(which is possibly a breaking change, thus not suitable for this branch).
Previously, when using an alias for an isolate scope or `bindings` property
(e.g. `alias: '<attrName'` instead of `attrName: '<'`), a `$compile:iscp` error
was thrown if the attribute name contained a "$".
This commit removes the error by changing the regex to allow "$" characters in
the attribute name when using a property alias.
Fixes: #15586Closes#15594
Page authors can use the `<base>` tag in HTML to specify URL to use as a base
when resovling relative URLs. This can cause SCE to reject relative URLs on the
page, because they fail the same-origin test.
To improve compatibility with the `<base>` tag, this commit changes the logic
for matching URLs to the 'self' policy to allow URLs that match the protocol and
domain of the base URL in addition to URLs that match the loading origin.
**Security Note:**
If an attacker can inject a `<base>` tag into the page, they can circumvent SCE
protections. However, injecting a `<base>` tag typically requires the ability to
inject arbitrary HTML into the page, which is a more serious vulnerabilty than
bypassing SCE.
Fixes#15144Closes#15145
Some browsers (e.g. Safari 9.x, PhantomJS) do not set `link.origin/protocol`
correctly, when setting `link.href` to `null`, which prevented auto-bootstraping
Angular from scripts without a `src` attribute (i.e. inline scripts).
Inline scripts are on the same origin as the loading page, so auto-bootstraping
should be allowed.
Fixes#15567Closes#15571
In certain cases (e.g. on LG webOS using the `file:` protocol), access to
`document.cookie` may not be allowed and throw an error. This could break
`$http` which relies on `$$cookieReader()` for retrieving the XSRF token.
This commit fixes it by treating `document.cookie` as empty, when access to it
is fordibben.
Fixes #15523Closes#15532
Previously, adding a watcher during a `$digest` (i.e. from within a watcher),
would result in the next watcher getting skipped. Similarly, removing a watcher
during a `$digest` could result in the current watcher being run twice (if the
removed watcher had not run yet in the current `$digest`).
This commit fixes both cases by keeping track of the current watcher index
during a digest and properly updating it when adding/removing watchers.
Fixes#15422Closes#15424
Previously, the element was always assumed to have a parent and an error was
thrown when that was not the case.
This commit makes jqLite consistent with jQuery, which silently ignores a call
on elements that do not have a parent.
Fixes#15331Closes#15367Closes#15475
Support for IPv6 addresses (in b643f0d) was too aggressive and broke support for params in the
`hostname` part of a URL.
This commit restores support for params in the `hostname`, as long as it is not an IPv6 address.
Fixes#14542Closes#14906
Currently, ngdoc `@method` ignores `@example` tags and does not output them.
This is usually not a problem, as examples are mostly defined directly
in the `@description` via code blocks or `<example>`
elements. However, some methods still have `@example` tags (possibly
from a previous docs version).
While not absolutely necessary, having special markup for Examples
makes them a) easier to find visually in the docs, and b) easier
to link to as they will have a unique id.
Closes#14722Closes#15448
When the "empty option" element contains a transclusion directive, the result of the compilation always includes a comment node. Since we are adding / removing the "selected" attribute on the empty option, we need to make sure it's an actual element.
To solve this, we take advantage of the fact the each option element has an option directive that tries to register the option with the selectController. With ngOptions, this registerOption function is normally noop'd since it's not possible to add dynamic options. Now if the result of the empty option compilation is a comment, we re-define the function so that it catches empty options when they are actually linked / rendered.
Closes#15454Closes#15456
Since Chrome 53-57+, the reported size of `<foreignObject>` elements and their
descendants is affected by global display settings (e.g. font size) and browser
settings (e.g. default zoom level). This could cause tests incorrectly failing
due to such settings.
In order to avoid false negatives, we now compare against the size of the
equivalent, hand-written SVG instead of fixed widths/heights.
Fixes#15333Closes#15458
ngIf, ngInclude, ngSwitch, and ngView now use the `done` callback functions on animation runners returned
by leave/enter animations to do internal cleanup (and $anchorScroll for ngInclude and ngView).
Previously, they were using promise callbacks (`then`), which caused an unnessecary digest.
Background:
In https://github.com/angular/angular.js/commit/bf0f5502b1bbfddc5cdd2f138efd9188b8c652a9, animation
promises where introduced instead of animation callbacks. These promises were however not tied to
the digest cycle, so you had to manually call `$apply` inside them.
This was changed in https://github.com/angular/angular.js/commit/c8700f04fb6fb5dc21ac24de8665c0476d6db5ef,
so animation promise callbacks would always trigger a `$digest`. This meant that several built-in
directives would now trigger additional digests on leave (ngIf, ngSwitch) or enter/leave (ngInclude,
ngView). The `done` callback, which receives a single argument indicating success / failure was
introduced to allow digest-less responses, but wasn't applied to these directives.
Note that this applies to all calls to $animate.enter/leave, even if ngAnimate isn't included, and
no actual animations are running, because the animation runner code is in the core ng module.
Fixes#15322Closes#15345
"Shadows" should better convey the meaning of "overwriting the value of the property in the child
scope, while leaving the parent scope intact".
"Hides" could give the impression that it makes the property unavailable in the child scope and
leaving "overrides" only, could give the impression that the parent scope would be affected too,
especially to people not familiar with JavaScript's prototypal inheritance.
Closes#15375
Previously, the index would show the version of Angular that runs on
the page, not the version for which the docs are. This meant that in
that snapshot docs the stable version was displayed.
The `$scope.docsVersion` value was used in the plnkr opening code, but
has not been used since https://github.com/angular/angular.js/commit/bdec35cebc89e0d80a04eeffbd71ad999fc7e61a.
Closes#15265
Add an example on how to set default values on `$cookiesProvider`. Many similar services support
overriding the `defaults` object with a new one, but this service only supports changing individual
properties.
Closes#15362
In some cases IE11/Edge calls to `element.value` are very slow when the
`element.value` has not been set. Normally, these calls are usualy 0-3 ms
but in these cases it can take 200-300 ms. This can easily add 3 or more
seconds to the load time on a view that has 10 or more select tags using
`ngOptions`.
The line this pull request is changing not only suffers from the performance
issue described above but it also appears to be broken. The code is checking
that `option.value` does not equal `element.value` but then sets `element.value`
to `option.selectValue`.
I don't believe `option.value` is actually defined anywhere and likely it
was always intended to be `option.selectValue`. This means that check would
always be true and since this code has been this way for quite a while and
is causing a performance issue I've just removed the check. This way a call
to `element.value` is never made prior to it's value being set.
Closes#15344
By setting the current partial content to hidden, the current height
of the window is maintained until the new content is loaded.
This prevents flickering caused by the scrollbar (dis)appearing and
the footer coming into view.
This was introduced during the switch to ESLint (b1bc251#diff-c244afd8def7f268b16ee91a0341c4b2R1691),
but it is a breaking change. In master, we made an exception
for this comparison when we introduced jshint eqeqeq (which was not
backported to 1.5.x).
PR (#15289)
Protractor's by.binding selector selects the whole element in which the binding
is contained as otherwise it can't know which bit of text has been interpolated.
It's safer to wrap the binding in a span so that we're sure what the e2e tests
are exactly testing.
The parser always threw an error in the case of an invalid left-value
assignment but it was an unhelpful:
```
Cannot set property 'undefined' of undefined
```
This commit provides a more meaningful error message, so it is not a
breaking change.
Closes#15234
Refactor ngModelSpec to use internal helper function `valueFn`.
Use instead of multiple-defining a function called `curry`.
PR (#15231)
Addresses a quick change mentioned in PR 15208 from Issue #14734
The bind/unbind aliases to on/off were being assinged in every iteration
of the function assigning traversal methods to the prototype. Now it happens
only once.
Previoulsy, when the value of an `ngAttrXyz` attribute did not contain any interpolation, then the
`xyz` attribute was never set.
BTW, this commit adds a negligible overhead (since we have to set up a one-time watcher for
example), but it is justifiable for someone that is using `ngAttrXyz` (instead of `xyz` directly).
(There is also some irrelevant refactoring to remove unnecessary dependencies from tests.)
Fixes#15133Closes#15149
Improve the explanation of what a "pure function" is in simple words. The previous explanation
could be confusing, especially since the term "idempotent" (here used in it's broader
"Computer Science" meaning) is overloaded and has much stricter semantics in Mathematics or pure
Functional Programming.
Closes#15173
`Resource.bind()`, which creates an new Resource class with the same propertiesexcept for the
additional bound default parameters, was not passing the original Resource class' `options`,
resulting in different behavior.
This commit fixes it by passing the `options` when creating the new Resource class.
Update the description of CSP, mainly regarding `unsafe-eval` and `unsafe-inline`. The way it was
presented previously was slightly misleading as it indicated that these were rules forbidding
certain things, when in fact it's a keyword in the CSP that disables the very rule that was
described. The updated text clarifies this better.
Closes#15142
- Remove internal `makePromise()` helper.
- Remove unnecessary wrapper functions.
- Remove unnecessary check for promises resolving multiple times.
(By following the Promises/A+ spec, we know this will never happen.)
- Switch from function expressions to (named) function declarations.
Closes#15065
Update Internet Explorer-only helper function stripCustomNsAttrs to be less
recursive. Reduce stack height of function causing out of stack space error.
Closes#14928Closes#15030
A new option to enable/disable whether directive controllers are assigned bindings before
calling the controller's constructor.
If enabled (true), the compiler assigns the value of each of the bindings to the
properties of the controller object before the constructor of this object is called.
If disabled (false), the compiler calls the constructor first before assigning bindings.
The default value is enabled (true) in Angular 1.5.x but will switch to false in Angular 1.6.x.
See #14580Closes#15095
This allows the removal of try/catch from addDirective to avoid V8 deopt.
Previously the directive.restrict property was not validated. This would
potentially cause exceptions on each compilation of the directive
requiring a try/catch and potentially causing repeated errors.
New validation when directive.restrict is specified:
* must be a string
* must contain at least one valid character (E, A, C, M)
Cases which previously silently failed (now throw an error):
* values with an indexOf method (such as strings, arrays) which returned
returned -1 for all valid restrict characters
Cases which previously worked unintentionally (now throw an error):
* arrays with single-character strings of valid restrict characters
PR (#13263)
In HTML5 mode, links can now be selectively rewritten, by setting `mode.rewriteLinks` to a string
(denoting an attribute name). Anchor elements that have the specified attribute will be rewritten,
while other links will remain untouched.
This can be useful in situations where it is desirable to use HTML5 mode without a `<base>` tag, but
still support rewriting specific links only. See #14959 for more details on a possible usecase.
Closes#14976
The example seems to also be filtering by age. It threw me off a bit because I was getting results when I entered numbers in the input field.
PR (#15037)
Previously, it would throw the ng:areq error, which is less
specific and just informs that the requested controller is not defined.
Given how commonly controllers are used
in Angular, it makes sense to have a specific error.
The ng:areq error is still thrown when the registered controller
is not a function.
Closes#14980
PR (#15015)
This commit re-applies the related (previously reverted) commits. A follow-up
commit will make the support opt-in in order to avoid a breaking change.
Included commits:
- 296da4b - `feat(input): add support for binding to input[type=range]`
(previously reverted with 6a167e8)
- b78539b - `fix(input[range]): correctly handle min/max; remove ngMin/ngMax support`
(previously reverted with aa60491)
- 90c08b8 - `feat(input[range]): support step`
(previously reverted with 5b633d8)
window.isNaN(‘lol’); //=> true
Number.isNaN(‘lol’); //=> false
isNaN converts it’s arguments into a Number before checking if it’s NaN.
In various places in the code base, we are checking if a variable is a Number and
NaN (or not), so this can be simplified with this new method (which is not exported on the
global Angular object).
Closes#11242
input[number] will now set the step error if the input value
(ngModel $viewValue) does not fit the step constraint set in the step / ngStep attribute.
Fixes#10597
Step support works like min / max, but with the following caveat.
Currently, only Firefox fully implements the spec. Other browsers
(Chrome, Safari, Edge) have issues when the step value changes
after the input has been changed. They do not adjust the input value
to a valid value, but instead set the stepMismatch validity state.
Angular will take this validity state, and forward it as the ngModel
"step" error. Adjusting the error ourselves would add too much code,
as the logic is quite involved.
This commit fixes the handling of min/max, and removes support for ngMin/ngMax:
min/max:
Previously, interpolated min/max values on input range were not set when the first $render happens,
because the interpolation directive only sets the actual element attribute value after
a digest passes. That means that the browser would not adjust
the input value according to min/max and the range input and model would
not be initialzed as expected.
With this change, input range will set the actual element attribute value during its own
linking phase, as it is already available on the attrs argument passed to the link fn.
ngMin/ngMax
Since ng prefixed attributes do not set their corresponding element attribute, the range input would always have min = 0, and max = 100 (in supported browsers), regardless of the value
in ngMin/ngMax. This is confusing and not very useful, so it's better to not support these attributes at all.
The commit also fixes a test which used an interpolation inside an attribute that expects an expression.
Fixes#14982
PR (#14996)
During the `build` task, the version placeholders will be replaced with the actual values using a
RegExp, which expects the placeholders to be surrounded by double quotes. By replacing the quotes
from double to single in #15011, the RegExp was not able to match the placeholders.
(For reference, the RegExps that match and replace the version placeholders are in
[lib/grunt/utils.js][1].)
[1]: https://github.com/angular/angular.js/blob/859348c7f61ff5f93b9f81eb7f46842bd018d8e3/lib/grunt/utils.js#L125-L130Closes#15016
The quotes rule had to be disabled for e2e tests generated from ngdoc
because dgeni templates use double quotes as string delimiters.
Since we can't have guarantees that dgeni template wrappers will follow
the same JS code style the Angular 1 repo uses, we should find a way
to enforce our ESLint setup only for the parts in this repo, perhaps
via prepending a generated `/* eslint-enable OUR_RULES */` pragma.
(partially cherry-picked from 9360aa2d27)
Closes#15011
Many browsers have some extension URL scheme. It is unclear how many of
those have the security issue of allowing parser-inserted loads of
extension URLs.
To be conservative, this code whitelists the URL schemes that are known
to be subject to CSP, i.e. the ones that are expected and safe.
Previously `$location` was rewriting such paths to remove not only the
double slashes but also the first segment of the path, leading to an invalid
path.
In this change, we deem leading double (back)slashes an invalid path and
now throw a `$location:badpath` error if that occurs.
Closes#15365
Extension URIs (`resource://...`) bypass Content-Security-Policy in Chrome and
Firefox and can always be loaded. Now if a site already has a XSS bug, and uses
CSP to protect itself, but the user has an extension installed that uses
Angular, an attacked can load Angular from the extension, and Angular's
auto-bootstrapping can be used to bypass the victim site's CSP protection.
Notes:
- `isAutoBootstrapAllowed` must be initialized on load, so that `currentScript`
is set correctly.
- The tests are a bit indirect as reproducing the actual scenario is too
complicated to reproduce (requires signing an extension etc). I have confirmed
this to be working manually.
Closes#15346
Due to the nature of some browser's PageCache/BFCache, returning to an Angular
app sometimes causes `input[hidden]` elements to retain the last value
that was stored before the page was navigated away from previously.
This is particularly problematic if the input has an interpolated value.
E.g. `<input type="hidden" value="{{ 1 + 2 }}">` since when the browser
returns, instead of the original interpolation template, the HTML contains
the previous value `<input type="hidden" value="3">`.
This commit instructs the browser not to attempt to reinstate the previous
value when navigating back in history by setting `autocomplete="off"` on
the hidden input element element.
While sandboxed Chrome Packaged Apps (CPAs) have the same restrictions wrt
accessing `history.pushState` as "normal" CPAs, they can't be detected in the
same way, as they do not have access to the same APIs.
Previously, due to their differences from normal CPAs, `$sniffer` would fail to
detect sandboxed CPAs and incorrectly assume `history.pushState` is available
(which resulted in an error being thrown).
This commit fixes the detection of sandboxed CPAs in `$sniffer`.
See #11932 and #13945 for previous work.
Closes#15021
Previously, video, audio, source, and track sources were $sce.RESOURCE_URL. This is not justified as
no attacks (script execution) are possible through these attributes as far as we can tell.
Angular2 also uses the same categorization.
This change is not breaking, and uses of $sce.trustAsResourceUrl before assigning to src or ng-src
attributes will just be silently ignored.
This has also been given a LGTM by @mprobst via email.
Commit 485320129d on the master branch contains the same changes, but
is missing this commit description.
This commit does not backport the BC introduced in 04cad41d26.
PR (#15039)
Closes#14019
Previously, requests were flushed in the order in which they were made.
With this change, it is possible to flush requests in any order. This is useful for simulating more
realistic scenarios, where parallel requests may be completed in any order.
Partially addresses #13717.
Closes#14967
When using the [timeout attribute](https://xhr.spec.whatwg.org/#the-timeout-attribute) and an XHR
request times out, browsers trigger the `timeout` event (and execute the XHR's `ontimeout`
callback). Additionally, Safari 9 handles timed-out requests in the same way, even if no `timeout`
has been explicitly set on the XHR.
In the above cases, `$httpBackend` would fail to capture the XHR's completing (with an error), so
the corresponding `$http` promise would never get fulfilled.
Note that using `$http`'s `timeout` configuration option does **not** rely on the XHR's `timeout`
property (or its `ontimeout` callback).
Fixes#14969Closes#14972
Related to #14952. Fixed the following warnings/errors:
1. **Warning**: Closure Compiler complained about `/* @this */` (annotations in non-JSDoc comments).
Fixed by changing `/* @this */` to `/** @this */`.
2. **Warning**: Dgeni complained about `/** @this */` (invalid tags found).
Fixed by adding an empty `this` tag definition in `docs/config/tag-defs/`.
3. **Error**: ESLint complained about CRLF linebreaks in `build/docs/examples/`. These are generated
by dgeni and (apparently) use the system's default linebreak (e.g. CRLF on Windows).
Fixed by disabling the `linebreak-style` rule for `build/docs/examples/`.
Closes#14997
There was a ~5% improvement in the added `parsed-expressions-bp/assignment` benchmark (which only
contains assignment expressions). In real-world applications, the time spent in assignment
expressions will be a tiny fragment of the overall processing time, though.
Closes#14957
The e2e tests were set up to be run twice; once with the latest supported
jQuery and once with jQuery 2.1. However, the latest jQuery was used in both
cases. The initial plan was to just run integration tests with the latest
jQuery and leave regression testing for jQuery 2.1 to unit tests as they're
way faster. This commit removes the jQuery 2.1 e2e tests entry.
This commit has been landed on master a few months ago but I forgot to
backport it to v1.5.x.
(cherry-picked from 038d990bc1)
Since the style directive is defined as a non-terminal element directive
with no behavior on link, we may as well not define anything at all.
PR (#14983)
When the functions `cssClassDirectivesEnabled()` / `commentDirectivesEnabled()` on the `$compileProvider` are called with `false`, then the compiler won't look for directives on css classes / comment elements.
This can result in a compilation speed-up of around 10%.
PR (#14850)
The Jenkins build.sh script has to be updated as the previous way of
specifying parameters to the code run in Grunt tasks stopped working
with the newest Grunt. This has been previously fixed for the Travis
build.sh but wasn't done for the Jenkins one.
Also, the contribute docs were updated to account for the new format.
(cherry-picked from 5fc993361f)
If one uses nvm to manage Node.js versions, the .nvmrc file makes `nvm use`
switch to the version specified in .nvmrc. There are scripts that invoke
it automatically when cd'ing to directories containing .nvmrc so that you
never run build commands using a wrong Node version, see:
https://github.com/creationix/nvm/blob/v0.31.2/README.markdown#zsh
The Travis build.sh script has to be updated as the previous way of
specifying parameters to the code run in Grunt tasks stopped working
with the newest Grunt.
Thanks to @cironunes for the initial implementation in https://github.com/angular/angular.js/pull/9715
Adds support for binding to input[range] with the following behavior / features:
- Like input[number], it requires the model to be a Number, and will set the model to a Number
- it supports setting the min/max values via the min/max and ngMin/ngMax attributes
- it follows the browser behavior of never allowing an invalid value. That means, when the browser
converts an invalid value (empty: null, undefined, false ..., out of bounds: greater than max, less than min)
to a valid value, the input will in turn set the model to this new valid value via $setViewValue.
-- this means a range input will never be required and never have a non-Number model value, once the
ngModel directive is initialized.
-- this behavior is supported when the model changes and when the min/max attributes change in a way
that prompts the browser to update the input value.
-- ngMin / ngMax do not prompt the browser to update the values, as they don't set the attribute values.
Instead, they will set the min / max errors when appropriate
- browsers that do not support input[range] (IE9) handle the input like a number input (with validation etc.)
Closes#5892Closes#9715Close#14870
The docs for `$compile` were updated in e235f20 to include information about the recently
implemented `$doCheck` lifecycle hook for component controllers. The lifecycle hook documentation is
mirrored in the Component guide, and this change mirrors the update made to the `$compile` docs, to
the component guide docs.
Closes#14946
When the select model changes, we add the "selected" attribute to the selected option, so that
screen readers know which option is selected.
Previously, we failed to remove the attribute from the selected / empty option when the model changed
to match a different option, or the unknown / empty option.
When using "track by", the behavior would also show when a user selected an option, and then the
model was changed, because track by watches the tracked expression, and calls the $render function
on change.
This fix reads the current select value, finds the matching option and removes the "selected"
attribute.
IE9 had to be special cased, as it will report option.hasAttribute('selected') === true even
if the option's property and attribute have been unset (even the dev tools show not selected attribute).
I've added a custom matcher that accounts for this behavior. In all other browsers, property and
attribute should always be in the same state. Since few people will use screen readers with IE9, I
hope this is a satisfactory solution to the problem.
Fixes#14892Fixes#14419
Related #12731
PR (#14894)
The test currently fail on master, but should pass on 1.5.x.
A subsequent commit will fix the regressions on master.
(This commit should be backportable to 1.5.x.)
Related to #14837.
Add a section inside of the ngAnimate documentation to point to $animate.pin().
It was not clear in the documentation why animations were being disabled inside of
modals and popup menus. This documentation explains in what situations elements may
be dynamically placed outside of the application DOM and points to the API documentation
on how to enable animations for these types of elements.
Related #14907Closes#14918
Prior to this point, the docs do not mention returning a postLink function, and all the examples use
the definition object form. So, this message is confusing to new readers who may misinterpret
"returning a function" as returning the factory function mentioned in the previous section.
Since this page is only a "gentle introduction" to directives, and using the definition object is a
best practice, it is best to just remove the message altogether.
Closes#14871
Previously, it would return a copy of the whole original typed array, not its slice.
Now, the `byteOffset` and `length` are also preserved.
Fixes#14842Closes#14845
This also improves the example a bit:
- better code formatting
- initialization of `form` to an empty object
- avoid using `email`, which doesn't get coppied when invalid (and might confuse users)
Fixes#14853
The official and external resources have been split into two different guide sections. Official stays at the index, external gets its own page.
The external resources have also been reorganized and updated, but
I haven't checked if all material is still relevant.
Change `ErrorAddingDeclarationLocationStack`'s prototype so test frameworks (such as Jasmine 2.x)
are able to recognize it as `Error`.
Fixes#13821Closes#14344
Also affects the reverse case, adding a class that is scheduled to be removed with rAF.
The following case can happen when ngClass updates an element's classes in very quick order in the following way:
- First animation adds class "a"
- A digest passes, but "a" is not yet added to the element
- Second animation adds class "b"
- No digest passes, and "a" is still not added to the element,
because requestAnimationFrame hasn't been flushed yet
- Third animation removes class "a"
- the third animation gets merged into the second animation
Before this change:
- Because the element doesn't have class "a" yet, ngAnimate
resolves that it cannot remove class "a". However,
the first animation is still running, and finally adds "a"
After this change:
- ngAnimate reacts to the temporary class "add-a", which indicates
that "a" is about to be added and decides that "a" can be removed
after all.
This is a very rare case where setting the element's class
is not fast enough, and subsequent animations operate on incorrect assumptions.
"In the wild", this is caused by rapidly updating ngClass,
which uses inidvidual addClass and removeClass calls when both operations happen in a single digest.
Fixes#14582
PR (#14760)
You can now override this service if you have specific requirements about
the behaviour and formatting of the JSON_CALLBACK that is sent to the server
for `$http.jsonp` requests.
Closes#14795
If a $timeout handler calls $timeout itself, this new $timeout should be
added to the mock deferred queue with a "now" time based on when the original
handler was triggered.
Previously it was being added with a now time of when the `$timeout.flush`
method was originally called.
Closes#5420Closes#14686
Some modules used to assume that the angular helpers would always be available when their script was
executed. This could be a problem when using `angular-loader` and the module file happened to get
loaded before the core `angular.js` file.
This commit fixes the issue by delaying the access to angular helpers, until they are guaranteed to
be available.
Affected modules:
- `ngAnimate`
- `ngMessageFormat`
- `ngMessages`
- `ngRoute`
- `ngSanitize`
Fixes#9140Closes#14794
If the instance of the directive does provide transcluded content, then the fallback
content should not be compiled and linked as it will never be used.
If the instance of the directive does not provide transcluded content, then the
transcluded scope that was created for this non-existent content is never used,
so it should be destroy in order to clean up unwanted memory use and digests.
Fixes#14768Fixes#14765Closes#14775
Implement $q.race. $q.race takes in an array or hash of promises and
returns a promise that resolves or rejects as soon as one of those promises
resolves or rejects, with the value or reason from that promise.
Closes#12929Closes#14757
Since we cannot write to dev/null on Windows, don't write to a file at all, but simply use stdout and extract the output from --write-out from the process response. Credit to @petebacondarwin for the idea.
The commit also avoids a premature error when no cdnVersion could be found online, and improves the log wrt the origin of the versions.
PR (#14780)
Previously, the special property name that would match against any
property was hard-coded to `$`.
With this commit, the user can specify an arbitrary property name,
by passing a 4th argument to `filterFilter()`. E.g.:
```js
var items = [{foo: 'bar'}, {baz: 'qux'}];
var expr = {'%': 'bar'};
console.log(filterFilter(items, expr, null, '%')); // [{foo: 'bar'}]
```
Fixes#13313
PR (#13356)
Previously it was slow and problematic to run builds if you were not connected
to the internet because the build scripts make requests to github and the
Google CDN to find out version information.
You can now disable these requests by setting the NG1_BUILD_NO_REMOTE_VERSION_REQUESTS
environment variable to a non-empty value
Closes#14769
We have had issues where the docs application has gone down because
our build included invalid URLs to the production angular libraries.
This change runs a subset of the docs e2e tests directly against these
production libraries to ensure that they are accessible. If not then these
tests will fail and the CI build will abort, preventing the docs app from
being updated.
Closes#14769
- Add note about using the value attribute for the progress tag with IE in the IE compat / interpolation guide
- Add note about placeholder attribute in textarea to the ie compat guide
Closes#7218
PR (#14753)
Some modules (ngMessageFormat, ngParseExt) don't have their own api surface
because they integrate with core services ($interpolate and $parse respectively).
Closes#14770
When the internet is not accessible build scripts are unnecessarily slow
because of failed attempts to download git tag and CDN version information
from remote servers.
This commit does a synchronous check of internet connectivity before attempting
any remote requests.
Closes#14759
Previously, ngMessage elements used the same scope as ngMessages. When ngMessage
has interpolation in the textContent, then removing the message would not remove
the watcher from the scope - it would only be removed when the whole ngMessages
element was removed.
This commit changes the ngMessage transclude function to create a new child scope
instead, which can be destroyed safely when the message element is removed and
the message is detached
Fixes#14307
PR (#14308)
Deep-copying route definition objects can break specific custom implementations of `$sce` (used to
trust a `templateUrl` as RESOURCE_URL). The purpose of copying route definition objects was to guard
against the user's modifying the route definition object after route registration, while still
capturing inherited properties.
As suggested by @IgorMinar in https://github.com/angular/angular.js/pull/14699#discussion_r66480539,
we can achieve both _and_ support custom `$sce` implementations, by shallow-copying instead.
This is an alternative implementation for #14699, which avoids the breaking change.
Fixes#14478Closes#14699Closes#14750
**Limit size of local-part and total path size in eMail addresses**
RFC 5321 §4.5.3.1.1 ⇒ local-part can have up to 64 octets
RFC 5321 §4.5.3.1.3 ⇒ path “including the punctuation and
element separators” can have up to 256 octets
RFC 5321 §4.1.2 specifies path as ‘<’ + mailbox¹ + ‘>’ in
the best case, leaving us 254 octets
The limitation of the total path size to 254 octets leaves
at most 252 octets (one local-part, one ‘@’) for the domain,
which means we don’t need to explicitly check the domain
size any more (removing the assertion after the ‘@’).
① RFC 821/5321 “mailbox” is the same as RFC 822 “addr-spec”
**Optimise eMail address regex for speed**
There is no need to make it case-insensitive; the local-part
already catches the entire range, and the host part is easily
done. Furthermore, this makes the regex locale-independent,
avoiding issues with e.g. turkish case conversions.
cf. http://www.mirbsd.org/cvs.cgi/contrib/hosted/tg/mailfrom.php?rev=HEAD
**Limit eMail address total host part length**
RFC 1035 §2.3.4 imposes a maximum length for any DNS object;
RFC 5321 §2.3.5 references this (and requires FQDNs, but there
have been cases where a TLD had an MX RR and thus eMail addresses
like “localpart@tld” are valid).
Credits: Natureshadow <d.george@tarent.de>
**Limit eMail address individual host part length**
A “label” (each of the things between the dots (‘.’) after the ‘@’ in
the eMail address) MUST NOT be longer than 63 characters.
cf. http://www.mirbsd.org/cvs.cgi/contrib/hosted/tg/mailfrom.php?rev=HEAD
and RFC 1035 §2.3.4
**Fix eMail address local-part validation**
A period (‘.’) may not begin or end a local-part
cf. http://www.mirbsd.org/cvs.cgi/contrib/hosted/tg/mailfrom.php?rev=HEAD
and RFC 822 / 5321
Closes#14719
In replace directives, attribute values from the template are added twice
to the replaced element when both the replaced element and the template
element have the attribute. This does not affect the DOM, as it normalizes
duplicate values. The values are however duplicated in the $attrs object
that is available to directive link functions.
Fixes#8159Closes#14737
The decorated version of `$controller` is able to assign bindings to a controller instance prior to
instantiation, emulating the behavior of `$compile` with directive controllers.
There are cases, that the actual controller instance is different than the pre-populated one (e.g.
when the controller constructor function returns a value or when the controller is an ES2015 Class).
While `$compile` accounts for such situation, by re-asigning the bindings after the controller has
been instantiated, `ngMock`'s `$controller` didn't.
This commit fixes it, by re-applying the bindings if the actual controller instance is different
than the original one (similar to how `$compile` would do it).
Fixes#14437Closes#14439
Add an optional, 4th argument (`comparator`) for specifying a custom comparator function, used to
compare the values returned by the predicates. Omitting the argument, falls back to the default,
built-in comparator. The 3rd argument (`reverse`) can still be used for controlling the sorting
order (i.e. ascending/descending).
Additionally, the documentation has been expanded to cover the algorithm used by the built-in
comparator and a few more unit and e2e tests (unrelated to the change) have been added.
Helps with #12572 (maybe this is as close as we want to get).
Fixes#13238Fixes#14455Closes#5123Closes#8112Closes#10368Closes#14468
Initialize `$$absUrl` to an empty string, in order to avoid exception, when base href
and current location have different domains.
Fixes#11091Fixes#13565Closes#14488
In some browsers, events don't bubble when they are dispatched on node inside
a detached tree. When this is the case, the bubbling is made manually.
This may be convenient when unit testing directives, for example.
Closes#5178
Allow $httpBackend.passThrough() to work normally when ngMock is loaded
concurrently with ngMockE2E, as is typically the case when writing tests with
angular.mock.module()
Fixes#1434Closes#13124
The previous example overwrote the `$exceptionHandler` in order to re-throw the error. This is not
recommended, since it would leave the application in an inconsistent state and prevent proper
clean-up.
The new example simulates logging the error both to the backend and the console.
Fixes#14704
Previously, it was just `undefined` and had the same behavior (since we only check for falsy-ness).
Just making it explicit, that this property is also available on `defaults` and is "not true" by
default.
Closes#14711
If a $timeout handler calls $timeout itself, this new $timeout should be
added to the mock deferred queue with a "now" time based on when the original
handler was triggered.
Previously it was being added with a now time of when the `$timeout.flush`
method was originally called.
Closes#5420Closes#14686
Previously, if one of these hooks threw an error, then the compilation
was terminated unceremoniously. In particular any other `$onChanges`
hooks that had been scheduled were not executed, nor was the queue cleaned
up properly.
Closes#14444Closes#14463
ngMessageFormat test files were missing from angularTest
ngMessages and ngAnimate were missing from karmaModules.
This change highlighted a number of problems in the tests and code,
which are now fixed.
Closes#14314Closes#14669
Corrected formatting errors on lines 258, 695, 696, 1096, 1219, 1451, and 1536 by adding periods at the end of single line comments that were missing them in order to be consistent with the formatting found in the file.
Capitalized the first letter in the first word of the comments on lines 695, 696, 1096, to be consistent with the formatting of the rest of the file.
Added a space after the // in the comment on line 1536 to be consistent with the formatting of the file.
By using a pointer to the current start of the queue and only clearing
up the queue storage later, we save lots of time that was spent manipulating
arrays with `slice`
Closes#14545
Thanks to @spamdaemon for the original PR to make this improvement.
In naive tests on Chrome I got the following results:
```
Matches Misses
indexOf 33ms 1494ms
lastIndexOf 11ms 11ms
```
Closes#3711
This is a major re-structuring of the tutorial app's codebase, aiming at applying established best
practices (in terms of file naming/layout and code organization) and utilizing several new features
and enhancements (most notably components) introduced in recent versions of Angular (especially
v1.5).
Apart from the overall changes, two new chapters were introduced: one on components and one on code
organization.
--
In the process, several other things were (incidentally) taken care of, including:
* Dependencies were upgraded to latest versions.
* Animations were polished.
* Outdated links were updated.
* The app's base URL was changed to `/` (instead of `/app/`).
BTW, this has been tested with the following versions of Node (on Windows 10) and everything worked
fine:
* 0.11.16
* 4.2.6
* 4.4.2
* 5.10.0
* 6.2.0
--
This was inspired by (and loosely based on) #13834.
Again, mad props to @teropa for leading the way :)
--
**Note:**
The old version of the tutorial, that is compatible with Angular version 1.4 or older, has been
saved on the `pre-v1.5.0-snapshot` branch of
[angular-phonecat](https://github.com/angular/angular-phonecat). The `v1.4.x` version of the
tutorial should be pointed to that branch instead of `master`.
--
Related to angular/angular-phonecat#326.
Related to angular/angular-seed#341.
Closes#14416
Messages imported with `ngMessagesInclude` are loaded asynchronously and
they can arrive after the ngMessages element has already been removed from DOM.
Previously we tried to compile these messages and that caused a `$compile:ctreq`
error. Now they are silently ignored if `ngMessagesInclude`'s scope has already
been destroyed.
Closes#12695Closes#14640
If the `from` element of an animation does not actually have an animation
then there will be no animation runner on that element. This is possible
if the element has the `ng-animate-ref` attribute but does not have any
CSS animations or transitions defined.
In this case, it is not necessary to try to update the host of the
non-existent runner.
Fixes#14641Closes#14645
While $location expects that $browser stores the URL unchanged, "some browsers" transform the URL
when setting or defer the acutal update. To work around this, $browser.url() kept the unchanged
URL in pendingLocation.
However, it failed to update pendingLocation in all code paths, causing
$browser.url() to sometimes incorrectly report previous URLs, which horribly confused $location.
This fix ensures that pendingLocation is always updated if set, causing url() to report the
current url.
Fixes#14427Closes#14499
This reverts commit b377d6b043.
This commit introduces dependency on $document during the injector
bootstrap. This is usually fine, except for cases when $document is
mocked out in existing test suites. Since we don't provide an out
of box mock, people have created their owns that don't sufficiently
mock all apis. In these environments this change results in errors
like $document.on is not a function, etc.
Previously `stripCommentsFromElement()` would return an empty Array (instead of a jqLite collection)
which would cause an exception to be thrown: "element.parent not a function".
This commit fixes it, by ensuring that the returned value is always a jqLite collection.
Closes#14558Closes#14559
The watch handler was triggering on its first invocation, even though
its change had already been dealt with when setting up the binding.
Closes#14546Closes#14580
Accessing the document for the hidden state is costly for
platforms like Electron. Instead, listen for visibilitychange
and store the state.
Closes#14568
+ explain decorators and how they are implemented in angular
+ explain how different types of services can be selected
+ explain `$delegate` objects and how they differ between services
+ warn of the risks/caveats of `$delegate` modification
+ note the exposure of `decorator` through the module api
+ show an example of decorating a core service
+ show an example of decorating a core directive
+ show an example of decorating a core filter
Closes#12163Closes#14372
Custom `$sce` implementations might not provide a `toString()` method on the wrapped object, or it
might be compiled away in non-debug mode. Watching the unwrapped value (retrieved using
`$sce.valueOf()`) fixes the problem.
The performance of this should be equivalent - `toString()` on objects usually touches all fields,
plus we will also avoid the (potentially big) string allocation.
Fixes#14526Closes#14527
Previously, calling `Attributes#$set('srcset', value)` on an `<img>` element would throw if `value`
were undefined, as it assumed `value` is always a string.
This commit fixes the issue, by skipping the unnecessary string manipulation when `value` is not
defined.
Closes#14470Closes#14493
Add explanation for error status codes in `$http` and mention negative codes normalization.
This alleviates confusion about which status codes will trigger the error callback and what values
to expect in such callbacks.
Fixes#11945Closes#14459
Remove 'Breaking Changes' label where there are no breaking changes.
Only for '1.4.0-rc.2', breaking changes have different styling (bold without bulleted list). Change to be consistent with others
(#14482)
The useCapture parameter defaults to false even in oldest of our supported
browsers; this is no longer needed so jQuery has removed it in 2.2.
In Angular 1.6 we apply the same refactoring, here in 1.5 we're just making
tests work with jQuery 2.2.
- Add support for computed property names
- Add support for short notation in properties definitions
Eg. The expressions `{x}` and `{[x + 'foo']: 1}` are now valid.
Closes: #14407
This changes the way option elements are generated when the ngOption collection changes.
Previously, we would re-use option elements when possible (updating their text and
label). Now, we first remove all currently displayed options and the create new options for the
collection. The new options are first appended to a documentFragment, which is in the end appended
to the selectElement.
Using documentFragment improves render performance in IE with large option collections
(> 100 elements) considerably.
Creating new options from scratch fixes issues in IE where the select would become unresponsive
to user input.
Fixes#13607Fixes#13239Fixes#12076
This reverts commit 5e37b2a7fd.
Eagerly loading `$route`, could break tests, because it might request the root or default route
template (something `$httpBackend` would know nothing about).
It will be re-applied for `v1.6.x`, with a breaking change notice and possibly a way to disable
the feature is tests.
Fixes#14337
Currently, custom annotations are copied from the CDO onto the controller constructor.
Using `noop()` when no controller has been specified, pollutes it with custom annotations and
makes one component's annotations available to all other components that have `noop()` as their
controller.
Fixes#14391Closes#14402
Add support for collecting current stack trace information in browsers
(e.g. IE10+, PhantomJS) that do not automatically store the current stack trace
information in a newly created `Error` object's `stack` property, but
only add it there once the `Error` gets thrown.
The original implementation works fine in Firefox & Chrome, but fails on IE10+
and PhantomJS where it, for example, breaks Karma's error reporting in cases
when an exception is thrown in a test like the following:
```
it('the holy crusade', inject(function() {
var x = {};
x.holyGrail();
}));
```
In this case, the ngMock `inject()` implementation would incorrectly add the
word `undefined` at the end of the collected error stack trace information,
thus causing the main error description to be reported back to Karma as
`undefined`.
The added test makes sure this functionality:
- works as expected in browsers supporting JavaScript stack trace
collection, e.g. Chrome, Firefox, IE10+, Opera & PhantomJS
- does not add any bogus stack track information in browsers that do
not support JavaScript stack trace collection, e.g. IE9
Fixes#13591Closes#13592Closes#13593
Jasmine 2.4 (maybe earlier) does not support returning an array containing both the "normal" and the
negative error messages. It will always concatenate them.
Closes#14275
The fix for removing the event callbacks on destroy introduced in
ce7f400011 removed the events too early, so that the event callbacks
for the "close" phase in "leave" animations were not called.
This commit fixes the behavior so that the event callbacks are only removed during on('$destroy')
when no animation is currently active on the element. When an animation is active, the event callbacks
will be removed after all callbacks have run, and if the element has no parent (has been removed from
the DOM).
Closes#14321
Since commit a3a7afd3aa, animations are not run
when the document is hidden (only their structural or class change effects are executed).
However, some libraries rely on the $animate.on() callbacks to be called even when no actual animation
runs.
This commit restores the behavior for the ngAnimate.$animate functions.
Note that callbacks still won't be called if animations are disabled, because this would be be a potential
breaking change, as some applications might rely on this implementation.
Fixes#14120
Add additional line from example which demonstrates using the snake cased attribute binding in
parent component template.
Add note clarifying camelCase to snake-case requirement to use the Output binding callback feature.
Closes#14365
Updated docs to reflect that response data can either be an array, object _or_ a string
Technically, response data can be anything that can be handled by angular.copy,
but since string and JSON data is most commonly mocked, the main types are sufficient.
Closes#14346
Due to the way that we instantiate controllers, the `$onChanges` hook
was not always available at the time we were trying to trigger the initial
call to this hook. For instance, if the hook was actually defined inside
the constructor function.
This commit fixes that but also fixes the fact that the initial call was
being made in the postDigest anyway, which was incorrect because the
it should have been made before the `$onInit` call.
Closes#14355Closes#14359
When ngModel is set to a value that matches a disabled option, ngOptions will now select the option
in the select element, which will set select.val() to the option hash value and visually
show the option value / label as selected in the select box. Previously, disabled
options forced the unknown value.
The previous behavior is inconsistent with both default HTML behavior and select with
ngModel but without ngOptions. Both allow disabled values to be selected programmatically.
A common use case for this behavior is an option that was previously valid, but has
been disabled, and cannot be selected again.
This commit removes a duplicate test, and all other tests that previously checked that disabled
options are not set have been adjusted to the ensure the opposite.
Fixes#12756
This change adds in the following new lifecycle hooks, which map in some
way to those in Angular 2:
* `$onChanges(changesObj)` - Called whenever one-way bindings are updated. The `changesObj` is a hash whose keys
are the names of the bound properties that have changed, and the values are an object of the form
`{ currentValue: ..., previousValue: ... }`. Use this hook to trigger updates within a component such as
cloning the bound value to prevent accidental mutation of the outer value.
* `$onDestroy` - Called on a controller when its containing scope is destroyed. Use this hook for releasing
external resources, watches and event handlers.
* `$postLink` - Called after this controller's element and its children been linked. Similar to the post-link
function this hook can be used to set up DOM event handlers and do direct DOM manipulation.
Note that child elements that contain `templateUrl` directives will not have been compiled and linked since
they are waiting for their template to load asynchronously and their own compilation and linking has been
suspended until that occurs.
Closes#14127Closes#14030Closes#14020Closes#13991Closes#14302
When multiple animations on the same element are queued before a $digest passes,
the animator tries to create as few actual animations as possible by joining / canceling
redundant animations. Class-based animations for example are cancelled when the classes that
are added and removed are the same, and the result is no class-change. This however must only
happen if there's no structural animation currently queued.
Fixes#14249
Under specific circumstances, ngMessages would go into an infinite loop and crash the
browser / page:
- At least two ngMessage elements are wrapped inside another element (e.g. ngTransclude)
- The first message is currently visible
- The first message is removed (e.g. when the whole ngMessages element is removed by an ngIf)
When a message is removed, it looks for a previous message - in this specific case it would misidentify
the second message for a previous message, which would then cause the first message to be marked as the
second message's next message, resulting in an infinite loop, and crash.
This fix ensures that when searching for previous messages, ngMessage walks the DOM in a way so
that messages that come after the current message are never identified as previous messages.
This commit also detaches and destroys all child ngMessage elements when the ngMessages element is
destroyed, which should improve performance slightly.
Fixes#14183Closes#14242
In the version of V8 used in Chrome < 50, the parent of template nodes for
`transclude: "element"` directives would be improperly garbage collected
despite still having been referenced via `parentNode`.
This bug surfaced due to the introduction of lazy transclusion (652b83e),
and appears under certain circumstances when using directive start and end elements.
It should be removed some time after Chrome 50 has been released.
Fixes#14041Closes#14286
Although `window.history` is present in the context of Chrome Packaged Apps, it is not allowed to
access `window.history.pushState` or `window.history.state`, resulting in errors when trying to
"sniff" history support.
This commit fixes it by detecting a Chrome Packaged App (through the presence of
`window.chrome.app.runtime`). Note that `window.chrome.app` is present in the context of "normal"
webpages as well, but it doesn't have the `runtime` property, which is only available to packaged
apps (e.g. see https://developer.chrome.com/apps/api_index).
(It also also contains some style changes for making the structure and layout of `$sniffer` tests
more consistent.)
Fixes#11932Closes#13945
By using `>=` when comparing the number length to `lgSize`, we'll provide the correct value, when
formatting numbers with different `lgSize` than `gSize`.
Fixes#14289Closes#14290
Probably due to implementation differences in browsers for pre-DST period (see
https://github.com/angular/angular.js/issues/5017 and especially
https://github.com/angular/angular.js/issues/5017#issuecomment-90775226 for context), some
`TzDate` tests had different behavior on different Timezones/Regions (e.g. failed in Australia,
which started to observe DST in 1971).
Since the used year (`1970`) didn't have any particular significance, this commit fixes the issue
by using a year that is more consistently handled by browsers (`2000`).
Fixes#14272Closes#14285
Moved the `v1.5.1` section above the `v1.4.10` one, so that it is right below the `v1.5.2` section
for easier reference. Also removed an empty "Breaking Changes" sub-section.
Closes#14283
The test for this didn't actually test the listener removal. The addClass animation after
the element removal didn't start because the enter animation was still in progress.
This commit reverts 7617c08da6 which was accidentally
merged into 1.5.x (by @petebacondarwin in a moment of rebase madness) despite
it containing a breaking change.
Highlights:
New mechanism to run async tests as Jasmine 2 removed `runs`, `waits` and `waitsFor`
The functions `iit`, `ddescribe` and `tthey` were renamed `fit`, `fdescribe` and
`fthey` as the originals came from Karma, Karma no longer bundles Jasmine and the
new function name comes from Jasmine.
Closes#14226
IF YOU DON'T FILL OUT THE FOLLOWING INFORMATION WE MIGHT CLOSE YOUR ISSUE WITHOUT INVESTIGATION
-->
***Note*: for support questions, please use one of these channels: https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#question. This repository's issues are reserved for feature requests and bug reports.**
- Before submitting, please **SEARCH GITHUB** for a similar issue or PR. -->
**Do you want to request a *feature* or report a *bug*?**
**I'm submitting a ...**
<!-- (check one with "x") -->
- [ ] bug report
- [ ] feature request
- [ ] other <!--(Please do not submit support requests here - see above)-->
**Current behavior:**
<!-- Describe how the bug manifests / how the current features are insufficient. -->
**Expected / new behavior:**
<!-- Describe what the behavior would be without the bug / how the feature would improve AngularJS -->
**What is the current behavior?**
**Minimal reproduction of the problem with instructions:**
<!--
If the current behavior is a bug or you can illustrate your feature request better with an example,
please provide the *STEPS TO REPRODUCE* and if possible a *MINIMAL DEMO* of the problem via
https://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:yBpEi4).
-->
**AngularJS version:** 1.x.y
<!-- Check whether this is still an issue in the most recent stable or in the snapshot AngularJS
version (https://code.angularjs.org/snapshot/) -->
**Browser:** [all | Chrome XX | Firefox XX | Edge XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
<!-- All browsers where this could be reproduced (and Operating System if relevant) -->
**If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (template: http://plnkr.co/edit/tpl:yBpEi4).**
**Anything else:**
<!-- e.g. stacktraces, related issues, suggestions how to fix -->
**What is the expected behavior?**
**What is the motivation / use case for changing the behavior?**
**Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.**
**Other information (e.g. stacktraces, related issues, suggestions how to fix)**
The AngularJS project follows the Code of Conduct defined in [the angular/code-of-conduct repository](https://github.com/angular/code-of-conduct/blob/master/CODE_OF_CONDUCT.md). Please read it.
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']);
@@ -8,42 +8,43 @@ 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 deferred objects,
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 deferreds,
and it makes client-side navigation and deeplinking with hashbang urls or HTML5 pushState a
piece of cake. Best of all? It makes development fun!
--------------------
##### AngularJS will be moving to Long Term Support (LTS) mode on July 1st 2018: [Find out more](https://docs.angularjs.org/misc/version-support-status)
##### Looking for the new Angular? Go here: https://github.com/angular/angular
**AngularJS will be moving to Long Term Support (LTS) mode on July 1st 2018.**: [Find out more](misc/version-support-status).
</div>
## Welcome to the AngularJS API docs page.
These pages contain the AngularJS reference materials for version <strong ng-bind="version"></strong>.
Welcome to the AngularJS API docs page. These pages contain the AngularJS reference materials for version <strong ng-bind="version"></strong>.
The documentation is organized into **{@link guide/module modules}** which contain various components of an AngularJS application.
These components are {@link guide/directive directives}, {@link guide/services services}, {@link guide/filter filters}, {@link guide/providers providers}, {@link guide/templates templates}, global APIs, and testing mocks.
@@ -19,14 +11,14 @@ These components are {@link guide/directive directives}, {@link guide/services s
There is also a {@link guide/index guide} with articles on various topics, and a list of external resources.
<div class="alert alert-info">
**AngularJS Prefixes `$` and `$$`**:
**Angular Prefixes `$` and `$$`**:
To prevent accidental name collisions with your code,
AngularJS prefixes names of public objects with `$` and names of private objects with `$$`.
Angular prefixes names of public objects with `$` and names of private objects with `$$`.
Please do not use the `$` or `$$` prefix in your code.
</div>
## AngularJS Modules
## Angular Modules
## {@link ng ng (core module)}
@@ -91,7 +83,7 @@ This module is provided by default and contains the core components of AngularJS
</td>
<td>
<p>
The core global API functions are attached to the `angular` object. These core functions are useful for low level JavaScript operations within your application.
The core global API functions are attached to the angular object. These core functions are useful for low level JavaScript operations within your application.
</p>
<p>
Some examples include:
@@ -138,7 +130,7 @@ Use ngRoute to enable URL routing to your application. The ngRoute module suppor
## {@link ngAnimate ngAnimate}
Use ngAnimate to enable animation features within your application. Various core AngularJS directives will provide
Use ngAnimate to enable animation features within your application. Various core ng directives will provide
animation hooks into your application when ngAnimate is included. Animations are defined by using CSS transitions/animations
or JavaScript callbacks.
@@ -222,7 +214,11 @@ Use the ngCookies module to handle cookie management within your application.
{@link ngCookies#service Services / Factories}
</td>
<td>
The {@link ngCookies.$cookies $cookies} service is a convenient wrapper to store simple data within browser cookies.
The following services are used for cookie management:
<ul>
<li>The {@link ngCookies.$cookies $cookie} service is a convenient wrapper to store simple data within browser cookies.</li>
<li>{@link ngCookies.$cookieStore $cookieStore} is used to store more complex data using serialization.</li>
This error may occur only when {@link $compileProvider#strictComponentBindingsEnabled `$compileProvider.strictComponentBindingsEnabled`} is set to `true`.
If that is the case, then all {@link $compileProvider#component component} controller bindings and
{@link $compileProvider#directive directive} scope / controller bindings that are non-optional,
must be provided when the directive is instantiated.
To make a binding optional, add '?' to the definition.
## Example:
```js
app.component('myTest', {
bindings: {
first: '=?', // optional
second: '='
},
controller: function() {
...
},
template: '...'
});
```
This component will throw `missingattr` for the `second` binding when used as follows:
This error occurs when {@link ng.$compile `$compile`} attempts to fetch a template from some URL, and the request fails.
To resolve this error, ensure that the URL of the template is spelled correctly and resolves to correct absolute URL.
The [Chrome Developer Tools](https://developers.google.com/chrome-developer-tools/docs/network#network_panel_overview) might also be helpful in determining why the request failed.
If you are using {@link ng.$templateCache} to pre-load templates, ensure that the cache was populated with the template.
This error occurs when the request configuration parameter passed to the {@link ng.$http `$http`} service is not a valid object.
`$http` expects a single parameter, the request configuration object, but received a parameter that was not an object or did not contain valid properties.
The error message should provide additional context such as the actual value of the parameter that was received.
If you passed a string parameter, perhaps you meant to call one of the shorthand methods on `$http` such as `$http.get(…)`, etc.
This error occurs when the request configuration parameter passed to the {@link ng.$http `$http`} service is not an object. `$http` expects a single parameter, the request configuration object, but received a parameter that was not an object. The error message should provide additional context such as the actual value of the parameter that was received. If you passed a string parameter, perhaps you meant to call one of the shorthand methods on `$http` such as `$http.get(…)`, etc.
To resolve this error, make sure you pass a valid request configuration object to `$http`.
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.