When using `$parse` with a stateful interceptor and the expression
is `undefined`, then return the result from the interceptor
NOTE from Igor: this is not the best solution. We need to refactor
this and one-time + $interpolate code to properly fix this. @caitp
is on it. See discussion in the PR.
Closes#9821Closes#9825
By including the `ngAria` module, `ngMessages` will automatically include the aria-live
attribute with an assertive voice, allowing validation messages to be spoken throuhg a
screenreader.
Closes#9834
The `$compile` public API documentation indicates that
a transclude function may be passed as a second parameter, but
it was not clear that this is **not** the same function that is given
to directive link functions as the `transcludeFn` parameter.
We would like to be able to pass in a transclude function the public
linking function that is returned from `$compile` if we wish to, for
example, use lazy compilation inside a directive.
Doing so, however, highlighted two bugs:
* First, the transclude function would get rebound, incorrectly, changing
its scope from its original binding.
* Second, the `containingScope` would not be updated and the wrong
`$parent` would be assigned to the `transcludedScope` resulting in a
memory leak.
This patch fixes both of these issues.
It also converts various private optional positional parameters on `publicLinkFn`
into an `options` parameter, which is an object hash. The new `options`
parameter is documented as part of the public API.
Thanks to @lgalfaso, @tbosch, and @petebacondarwin.
Closes#9413
When writing tests it's often useful to check the number of child scopes
or watchers within the current current scope subtree. Common use-case for advanced
directives is to test that the directive is properly cleaning up after itself. These
new methods simplify writing assertions that verify that child scopes were properly
destroyed or that watchers were deregistered.
Closes#9926Closes#9871
Changes:
- add rule requireSpaceBeforeBlockStatements (require space before brace when opening block statement)
- add operators to rule disallowSpaceAfterPrefixUnaryOperators (no space after prefix inc/dec ops)
- add rule disallowSpaceBeforePostfixUnaryOperators (no space before postfix inc/dec ops)
- add rule disallowSpacesInsideArrayBrackets (array literals no longer padded with spaces)
- add rule requireCommaBeforeLineBreak (line can't start with comma token)
- add rule validateLineBreaks (require LF linebreaks)
Closes#9792
Fixes a regression where the option/select values would always be set to
the key or index of a value within the corresponding collection. Prior to
some 1.3.0 refactoring, the result of the track expression would be bound
to the value, but this behavior was not documented or explicitly tested. A
cache was added in order to improve performance getting the associated
value for a given track expression.
This commit adds one explicit test for this behavior, and changes several
other trackBy tests to reflect the desired behavior as well.
Closes#9718Fixes#9592
Currently, `undefined` is returned. However, the desired behavior is to
return `null` when the controller is optional and not found.
(If this breaks your app, it really shouldn't .v.)
Closes#9404Closes#9392
The directive property `require` allows optional requirement via
the `?` before or after the `^` operator. Add tests to ensure this
functionality is not lost inadvertently.
Closes#9391Closes#9392
Check if the attribute is undefined before manually applying the function because if not an
undefined property is added to the scope of the form controller when the input control does not
have a name.
Closes#9707Closes#9720
Included:
- A sample test fixture
- A sample test
- Server middleware to serve the E2E harness
- Convenient test helpers to simplify loading the right fixture
Closes#9557Closes#9527
If a response or expectation contained a date object then `$httpBackend.expect`
was not matching correctly.
This commit encodes then decodes the object being matched to ensure consistency.
Closes#5127
Check that listener is still present in $$listeners before decrease
$$listenerCount. It fixes problem with incorrect $$listenerCount after
call deregistering function multiple times.
Closes#9666Closes#9667
Normally, if there is a Content-Type header with the string "application/json", or else the content
looks sort of JSON-y, $http will attempt to deserialize the JSON into an object. $templateRequest
is intended to request markup, and as such should never attempt to parse JSON, regardless of the
headers or shape of the content.
Closes#5756Closes#9619
Previously, the test-case verified that calling `toJson()`, would remove
the `$promise` and `$resolved`, but not that other `$`-prefixed properties
would not be removed.
Closes#9628
Objects created with `Object.create(null);` do not have a `valueOf` method unless
they supply one themselves. To accomodate these, Object.prototype.valueOf is
used when the type of the value is "object", and the `valueOf` property is not
a function (E.G. it's not in the object at all).
Closes#9568
$animate now supports an optional parameter which provides CSS styling
which will be provided into the CSS-based animations as well as any
custom animation functions. Once the animation is complete then the
styles will be applied directly to the element. If no animation is
detected or the `ngAnimate` module is not active then the styles
will be applied immediately.
BREAKING CHANGE: staggering animations that use transitions will now
always block the transition from starting (via `transition: 0s none`)
up until the stagger step kicks in. The former behaviour was that the
block was removed as soon as the pending class was added. This fix
allows for styles to be applied in the pending class without causing
an animation to trigger prematurely.
Check that pushState is not invoked if $browser.url() and $browser.state()
is passed to $browser.url setter.
Also, a minor refactor in $browser.url code and $browser specs.
Refs #9587
IE 10-11+ deserialize history.state on every read, causing simple comparisons
against history.state always return false. Account for that caching
`history.state` on every hashchange or popstate event.
Also:
1. Prevent firing onUrlChange callbacks twice if both popstate and hashchange
event were fired.
2. Fix the issue of routes sometimes not firing the URL change in all browsers.
Closes#9587Fixes#9545
Add support for a configurable vertical scroll offset to `$anchorScroll`.
The offset can be defined by a specific number of pixels, a callback function
that returns the number of pixels on demand or a jqLite/JQuery wrapped DOM
element whose height and position are used if it has fixed position.
The offset algorithm takes into account items that are near the bottom of
the page preventing over-zealous offset correction.
Closes#9368Closes#2070Closes#9360