- Refactor: move fixtures to corresponding directories - Delete unused fixtures Resolves: #3328
840 KiB
1.6.9 fiery-basilisk (2018-02-02)
Bug Fixes
- input: add
drop
event support for IE (5dc076) - ngMessages: prevent memory leak from messages that are never attached (9d058d, #16389, #16404, #16406)
- ngTransclude: remove terminal: true (1d826e, #16411, #16412)
- $sanitize: sanitize
xml:base
attributes (b9ef65)
New Features
1.6.8 beneficial-tincture (2017-12-18)
Bug Fixes
New Features
1.6.7 imperial-backstroke (2017-11-24)
Bug Fixes
- $compile: sanitize special chars in directive name (c4003f, #16314, #16278)
- $location: do not decode forward slashes in the path in HTML5 mode (e06ebf, #16312)
- sanitizeUri: sanitize URIs that contain IDEOGRAPHIC SPACE chars (ddeb1d, #16288)
- $rootScope: fix potential memory leak when removing scope listeners (358a69, #16135, #16161)
- http: do not allow encoded callback params in jsonp requests (569e90)
- ngMock: pass unexpected request failures in
$httpBackend
to the error handler (1555a4, #16150, #15855) - ngAnimate: don't close transitions when child transitions close (1391e9, #16210)
- ngMock.browserTrigger: add 'bubbles' to Transition/Animation Event (7a5f06)
New Features
- $sanitize, $compileProvider, linky: add support for the "sftp" protocol in links (a675ea, #16102)
- ngModel.NgModelController: expose $processModelValue to run model -> view pipeline (145194, #3407, #10764, #16237)
- $injector: ability to load new modules after bootstrapping (6e78fe)
Performance Improvements
- jqLite:
1.6.6 interdimensional-cable (2017-08-18)
Bug Fixes
- $httpParamSerializer: ignore functions (b51ded, #16133)
- $resource: do not throw when calling old
$cancelRequest()
(009ebe, #16037) - $parse:
- $http: do not throw error if
Content-Type
is notapplication/json
but response is JSON-like (2e1163, #16027, #16075)
New Features
- $compile: add
strictComponentBindingsEnabled()
method (3ec181, #16129) - $resource: add resource to response for error interceptors (9256db, #16109)
- $http: allow differentiation between XHR completion, error, abort, timeout (5e2bc5, #15924, #15847)
1.6.5 toffee-salinization (2017-07-03)
Bug Fixes
- core:
- ngOptions:
- orderBy: guarantee stable sort (e50ed4, #14881, #15914)
- $parse:
- do not shallow-watch inputs to one-time intercepted expressions (6e3b5a)
- standardize one-time literal vs non-literal and interceptors (f003d9)
- do not shallow-watch inputs when wrapped in an interceptor fn (aac562, #15905)
- always re-evaluate filters within literals when an input is an object (ec9768, #15964, #15990)
- $sanitize: use appropriate inert document strategy for Firefox and Safari (8f31f1)
- $timeout/$interval: do not trigger a digest on cancel
(a222d0,
#16057,
#16064)
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, #15952, #15953)
- angular-loader: do not depend on "closure" globals that may not be available (a3226d, #15880, #15881)
New Features
- select: expose info about selection state in controller (0b962d, #13172, #10127)
- $animate: add support for
customFilter
(ab114a, #14891) - $compile: overload
.component()
to accept object map of components (210112, #14579, #16062) - $log: log all parameters in IE 9, not just the first two. (3671a4)
- ngMock: describe unflushed http requests (d9128e, #10596, #15928)
Performance Improvements
1.6.4 phenomenal-footnote (2017-03-31)
Bug Fixes
- $parse:
- ngModel: prevent internal scope reference from being copied (e1f8a6, #15833)
- jqLite: make jqLite invoke jqLite.cleanData as a method (9cde98, #15846)
- $http: throw more informative error on invalid JSON response (df8887, #15695, #15724)
- dateFilter: correctly handle newlines in
format
string (982271, #15794, #15792)
New Features
1.6.3 scriptalicious-bootstrapping (2017-03-08)
Bug Fixes
- AngularJS:
- $log: don't parse error stacks manually outside of IE/Edge (64e5af, #15590, #15767)
- $sanitize: prevent clobbered elements from freezing the browser (3bb1dd, #15699)
- $animate:
- filterFilter: don't throw if
key.charAt
is not a function (f27d19, #15644, #15660) - select:
- $jsonpCallbacks: allow
$window
to be mocked in unit tests (5ca0de, #15685, #15686)
New Features
- info: add
angularVersion
info to each module (1e582e) - $injector: add new
modules
property (742123) - Module: add
info()
method (09ba69, #15225) - errorHandlingConfig: make the depth for object stringification in errors configurable (4a5eaf, #15402, #15433)
1.6.2 llamacorn-lovehug (2017-02-07)
Bug Fixes
- $compile:
- $location: correctly handle external URL change during
$digest
(b60761, #11075, #12571, #15556, #15561) - $browser: detect external changes in
history.state
(fa50fb) - $resource:
- $animate: correctly animate transcluded clones with
templateUrl
(f01212, #15510, #15514) - $route: make asynchronous tasks count as pending requests (eb968c, #14159)
- $parse: make sure ES6 object computed properties are watched (5e418b, #15678)
- $sniffer: allow
history
for NW.js apps (4a593d, #15474, #15633) - input: fix
step
validation forinput[type=number/range]
(c95a67, #15504, #15506) - select: keep
ngModel
when selected option is recreated byngRepeat
(131af8, #15630, #15632) - ngValue: correctly update the
value
property whenvalue
is undefined (05aab6 #15603, #15605) - angularInit: allow auto-bootstrapping from inline script (bb464d, #15567, #15571)
- ngMockE2E: ensure that mocked
$httpBackend
uses correct$browser
(bd63b2, #15593)
New Features
- ngModel: add
$overrideModelOptions
support (2546c2, #15415) - $parse: allow watching array/object literals with non-primitive values (25f008, #15301)
1.5.11 princely-quest (2017-01-13)
Bug Fixes
- $compile: allow the usage of "$" in isolate scope property alias (e75fbc, #15586, #15594)
- angularInit: allow auto-bootstrapping from inline script (41aa91, #15567, #15571)
- $resource: delete
$cancelRequest()
intoJSON()
(4f3858, #15244) - $$cookieReader: correctly handle forbidden access to
document.cookie
(6933cf, #15523, #15532)
1.6.1 promise-rectification (2016-12-23)
Bug Fixes
- $q: Add traceback to unhandled promise rejections (174cb4, #14631)
- $$cookieReader: correctly handle forbidden access to
document.cookie
(33f769, #15523) - ngOptions: do not unset the
selected
property unless necessary (bc4844, #15477) - ngModelOptions: work correctly when on the template of
replace
directives (5f8ed6, #15492) - ngClassOdd/Even: add/remove the correct classes when expression/
$index
change simultaneously (d52864) - jqLite: silently ignore
after()
if element has no parent (3d68b9, #15331, #15475) - $rootScope: when adding/removing watchers during $digest (163aca, #15422)
Performance Improvements
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, #15108)
- clean up
@
-binding observers when re-assigning bindings (f3cb6e, #15268) - set attribute value even if
ngAttr*
contains no interpolation (229799, #15133) bindToController
should work withoutcontrollerAs
(944989, #15088)- do not overwrite values set in
$onInit()
for<
-bound literals (07e1ba, #15118) - avoid calling
$onChanges()
twice forNaN
initial values (0cf5be)
- $location: prevent infinite digest with IDN urls in Edge (4bf892, #15217)
- $rootScope: correctly handle adding/removing watchers during
$digest
(a9708d, #15422) - $sce: fix
adjustMatcher
to replace multiple*
and**
(78eecb) - jqLite: silently ignore
after()
if element has no parent (77ed85, #15331) - input[radio]: use non-strict comparison for checkedness (593a50)
- select, ngOptions:
- ngClassOdd/Even: add/remove the correct classes when expression/
$index
change simultaneously (e3d020) - $sanitize: reduce stack height in IE <= 11 (862dc2, #14928)
- ngMock/$controller: respect
$compileProvider.preAssignBindingsEnabled()
(75c83f)
New Features
- bootstrap: do not bootstrap from unknown schemes with a different origin (bdeb33, #15428)
- $anchorScroll: convert numeric hash targets to string (a52640, #14680)
- $compile:
- $controller: throw when requested controller is not registered (9ae793, #14980)
- $location: add support for selectively rewriting links based on attribute (a4a222)
- $resource: pass
status
/statusText
to success callbacks (a8da25, #8341, #8841) - ngSwitch: allow multiple case matches via optional attribute
ngSwitchWhenSeparator
(0e1651, #3410, #3516)
Performance Improvements
- all: don't trigger digests after enter/leave of structural directives (c57779, #15322)
- $compile: validate
directive.restrict
property on directive init (31d464) - ngOptions: avoid calls to
element.value
(e269ad) - jqLite: move bind/unbind definitions out of the loop (7717b9)
1.6.0 rainbow-tsunami (2016-12-08)
Here are the full changes for the release of 1.6.0 that are not already released in the 1.5.x branch, consolidating all the changes shown in the previous 1.6.0 release candidates.
New Features
- ngModelOptions: allow options to be inherited from ancestor
ngModelOptions
(296cfc, #10922) - $compile:
- jqLite:
- implement
jqLite(f)
as an alias tojqLite(document).ready(f)
(369fb7) - don't throw for elements with missing
getAttribute
(4e6c14) - don't get/set properties when getting/setting boolean attributes (7ceb5f, #14126)
- don't remove a boolean attribute for
.attr(attrName, '')
(3faf45) - remove the attribute for
.attr(attribute, null)
(4e3624) - return
[]
for.val()
on<select multiple>
with no selection (d882fd) - camelCase keys in
jqLite#data
(fc0c11, #15126) - align jqLite camelCasing logic with JQuery (73050c, #7744)
- implement
- $http:
- $anchorScroll: convert numeric hash targets to string (9062ba #14680)
- select: support values of any type added with
ngValue
(f02b70, #9842) - input:
- ngSwitch: allow multiple case matches via optional attribute
ngSwitchWhenSeparator
(0b221 #3410 #3516) - $interpolate: use custom
toString()
function if present (a5fd2e, #7317, #11406) - ngRoute:
- $q: report promises with non rejection callback (c9dffd, #13653, #7992)
- $resource: pass
status
/statusText
to success callbacks (e3a378 #8341 #8841) - $location:
- $controller: throw when requested controller is not registered (eacfe4 #14980)
Security Related
- Please read the Sandbox Removal Blog Post.
- bootstrap:
- $compile:
Bug Fixes
- $sce: fix
adjustMatcher
to replace multiple*
and**
(991a2b) - ngModelOptions: handle debounce of
updateOn
triggers that are not in debounce list (789790) - ngMock/$controller: respect
$compileProvider.preAssignBindingsEnabled()
(7d9a79) - $location:
- core: do not auto-bootstrap when loaded from an extension. (0ff10e)
- input[radio]: use strict comparison when evaluating checked-ness (5ac7da, #15288)
- input: fix
step
validation forinput[type=number]
/input[type=range]
(081d06, #15257) - $parse:
- ngModel: treat synchronous validators as boolean always (7bc71a, #14734)
- $q: treat thrown errors as regular rejections (e13eea, #3174, #15213)
- ngTransclude: use fallback content if only whitespace is provided (32aa7e, #15077)
- $compile:
- don't throw tplrt error when there is a whitespace around a top-level comment (76d3da, #15108)
- clean up
@
-binding observers when re-assigning bindings (586e2a #15268) - set attribute value even if
ngAttr*
contains no interpolation (3fe3da #15133) bindToController
should work withoutcontrollerAs
(16dcce #15088)- do not overwrite values set in
$onInit()
for<
-bound literals (a1bdff #15118) - avoid calling
$onChanges()
twice forNaN
initial values (7d7efb) - disallow linking the same element more than once (1e1fbc)
- correctly merge consecutive text nodes on IE11 (13c252, #14924)
- don't add leading white-space in attributes for a specific merge case (305ba1)
- don't trim white-space in attributes (97bbf8, #5513, #5597)
- move check for interpolation of on-event attributes to compile time (b89c21, #13267)
- select, ngOptions, ngValue:
- don't add comment nodes as empty options (245b27, #15454)
- do not throw when removing the element (e.g. via
ngIf
) (7a667c) - add/remove selected attribute for selected/unselected options (c75698)
- don't register options when select has no ngModel (e8c2e1)
- handle model updates when options are manipulated (47c15f)
- remove workaround for a Chrome bug (87eff2)
- make the handling of unknown / empty options consistent (2785ad)
- set the element's value property in addition to the value attribute (e6afca, #14031)
- $resource:
- $http:
- ngMock: trigger digest in
$httpBackend.verifyNoOutstandingRequest()
(267ee9, #13506) - ngAria:
- ngBind: use same string representation as
$interpolate
(fa80a6) - ngMock/$httpBackend: fail if a url is provided but is
undefined
(7551b8, #8442, #10934) - $route: don't process route change controllers and templates for
redirectTo
routes (7f4b35, #3332) - loader:
module.decorator
order of operations is now irrelevant (6a2ebd, #12382) - $sanitize: reduce stack height in IE <= 11 (45129c #14928)
- ngAnimate: make svg elements work with
classNameFilter
(81bf7e)
Performance Improvements
- all: don't trigger digests after enter/leave of structural directives (f4fb6e, #15322)
- form, ngModel: change controllers to use prototype methods (9e24e7)
- select: don't prepend unknown option if already prepended (ba36bd)
- ngOptions: avoid calls to
element.value
(3b7f29) - $animate: listen for document visibility changes (d71dc2)
- injector: cache the results of the native class detection check (5ceb5d)
- $compile:
- $parse:
Breaking Changes
- feat($compile): set preAssignBindingsEnabled to false by default (bcd0d4):
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:
Before:
angular.module('myApp', [])
.component('myComponent', {
bindings: {value: '<'},
controller: function() {
this.doubleValue = this.value * 2;
}
});
After:
angular.module('myApp', [])
.component('myComponent', {
bindings: {value: '<'},
controller: function() {
this.$onInit = function() {
this.doubleValue = this.value * 2;
};
}
});
If you don't have time to migrate the code at the moment, you can flip the setting back to true:
angular.module('myApp', [])
.config(function($compileProvider) {
$compileProvider.preAssignBindingsEnabled(true);
})
.component('myComponent', {
bindings: {value: '<'},
controller: function() {
this.doubleValue = this.value * 2;
}
});
Don't do this if you're writing a library, though, as you shouldn't change global configuration then.
- fix(input[radio]): use strict comparison when evaluating checked-ness (5ac7da):
When using input[radio], the checked status is now determined by doing a strict comparison between the value of the input and the ngModel.$viewValue. Previously, this was a non-strict comparison (==).
This means in the following examples the radio is no longer checked:
<!-- this.selected = 0 -->
<input type="radio" ng-model="$ctrl.selected" value="0" >
<!-- this.selected = 0; this.value = false; -->
<input type="radio" ng-model="$ctrl.selected" ng-value="$ctrl.value" >
The migration strategy is to convert values that matched with non-strict conversion so that they will match with strict conversion.
- feat(ngModelOptions): allow options to be inherited from ancestor
ngModelOptions
(296cfc):
The programmatic API for ngModelOptions
has changed. You must now read options
via the ngModelController.$options.getOption(name)
method, rather than accessing the
option directly as a property of the ngModelContoller.$options
object. This does not
affect the usage in templates and only affects custom directives that might have been
reading options for their own purposes.
One benefit of these changes, though, is that the ngModelControler.$options
property
is now guaranteed to be defined so there is no need to check before accessing.
So, previously:
var myOption = ngModelController.$options && ngModelController.$options['my-option'];
and now:
var myOption = ngModelController.$options.getOption('my-option');
jqLite due to:
- fc0c11:
camelCase keys in
jqLite#data
Previously, keys passed to the data method were left untouched.
Now they are internally camelCased similarly to how jQuery handles it, i.e.
only single (!) hyphens followed by a lowercase letter get converted to an
uppercase letter. This means keys a-b
and aB
represent the same data piece;
writing to one of them will also be reflected if you ask for the other one.
If you use Angular with jQuery, it already behaved in this way so no changes are required on your part.
To migrate the code follow the examples below:
BEFORE:
/* 1 */
elem.data('my-key', 2);
elem.data('myKey', 3);
/* 2 */
elem.data('foo-bar', 42);
elem.data()['foo-bar']; // 42
elem.data()['fooBar']; // undefined
/* 3 */
elem.data()['foo-bar'] = 1;
elem.data()['fooBar'] = 2;
elem.data('foo-bar'); // 1
AFTER:
/* 1 */
// Rename one of the keys as they would now map to the same data slot.
elem.data('my-key', 2);
elem.data('my-key2', 3);
/* 2 */
elem.data('foo-bar', 42);
elem.data()['foo-bar']; // undefined
elem.data()['fooBar']; // 42
/* 3 */
elem.data()['foo-bar'] = 1;
elem.data()['fooBar'] = 2;
elem.data('foo-bar'); // 2
- 73050c: align jqLite camelCasing logic with JQuery
Before, when Angular was used without jQuery, the key passed to the css method was more heavily camelCased; now only a single (!) hyphen followed by a lowercase letter is getting transformed. This also affects APIs that rely on the css method, like ngStyle.
If you use Angular with jQuery, it already behaved in this way so no changes are needed on your part.
To migrate the code follow the example below:
Before:
HTML:
// All five versions used to be equivalent.
<div ng-style={background_color: 'blue'}></div>
<div ng-style={'background:color': 'blue'}></div>
<div ng-style={'background-color': 'blue'}></div>
<div ng-style={'background--color': 'blue'}></div>
<div ng-style={backgroundColor: 'blue'}></div>
JS:
// All five versions used to be equivalent.
elem.css('background_color', 'blue');
elem.css('background:color', 'blue');
elem.css('background-color', 'blue');
elem.css('background--color', 'blue');
elem.css('backgroundColor', 'blue');
// All five versions used to be equivalent.
var bgColor = elem.css('background_color');
var bgColor = elem.css('background:color');
var bgColor = elem.css('background-color');
var bgColor = elem.css('background--color');
var bgColor = elem.css('backgroundColor');
After:
HTML:
// Previous five versions are no longer equivalent but these two still are.
<div ng-style={'background-color': 'blue'}></div>
<div ng-style={backgroundColor: 'blue'}></div>
JS:
// Previous five versions are no longer equivalent but these two still are.
elem.css('background-color', 'blue');
elem.css('backgroundColor', 'blue');
// Previous five versions are no longer equivalent but these two still are.
var bgColor = elem.css('background-color');
var bgColor = elem.css('backgroundColor');
- 7ceb5f: 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:
input[checked="checked"] { ... }
JS:
elem1.attr('checked', 'checked');
elem2.attr('checked', false);
After:
CSS:
input:checked { ... }
JS:
elem1.prop('checked', true);
elem2.prop('checked', false);
- 3faf45:
don't remove a boolean attribute for
.attr(attrName, '')
Before, using the attr
method with an empty string as a value
would remove the boolean attribute. Now it sets it to its lowercase name as
was happening for every non-empty string so far. The only two values that remove
the boolean attribute are now null & false, just like in jQuery.
To migrate the code follow the example below:
Before:
elem.attr(booleanAttrName, '');
After:
elem.attr(booleanAttrName, false);
or:
elem.attr(booleanAttrName, null);
- 4e3624:
remove the attribute for
.attr(attribute, null)
Invoking elem.attr(attributeName, null)
would set the
attributeName
attribute value to a string "null"
, now it removes the
attribute instead.
To migrate the code follow the example below:
Before:
elem.attr(attributeName, null);
After:
elem.attr(attributeName, "null");
- d882fd:
return [] for .val() on
<select multiple>
with no selection
For the jqLite element representing a select element in the multiple variant with no options chosen the .val() getter used to return null and now returns an empty array.
To migrate the code follow the example below:
Before:
HTML:
<select multiple>
<option>value 1</option>
<option>value 2</option>
</select>
JavaScript:
var value = $element.val();
if (value) {
/* do something */
}
After:
HTML:
<select multiple>
<option>value 1</option>
<option>value 2</option>
</select>
JavaScript:
var value = $element.val();
if (value.length > 0) {
/* do something */
}
ngModel
due to:
- 7bc71a: treat synchronous validators as boolean always
Previously, only a literal false
return would resolve as the
synchronous validator failing. Now, all falsy JavaScript values
are treated as failing the validator, as one would naturally expect.
Specifically, the values 0
(the number zero), null
, NaN
and ''
(the
empty string) used to be considered valid (passing) and they are now considered
invalid (failing). The value undefined
was treated similarly to a pending
asynchronous validator, causing the validation to be pending. undefined
is
also now considered invalid.
To migrate, make sure your synchronous validators are returning either a
literal true
or a literal false
value. For most code, we expect this to
already be the case. Only a very small subset of projects will be affected.
Namely, anyone using undefined
or any falsy value as a return will now see
their validation failing, whereas previously falsy values other than undefined
would have been seen as passing and undefined
would have been seen as pending.
- 9e24e7: change controllers to use prototype methods
The use of prototype methods instead of new methods per instance removes the ability to pass NgModelController and FormController methods without context.
For example
$scope.$watch('something', myNgModelCtrl.$render)
will no longer work because the $render
method is passed without any context.
This must now be replaced with
$scope.$watch('something', function() {
myNgModelCtrl.$render();
})
or possibly by using Function.prototype.bind
or angular.bind
.
aria/ngModel
due to:
- 975a61:
do not overwrite the default
$isEmpty()
method for checkboxes
Custom checkbox
-shaped controls (e.g. checkboxes, menuitemcheckboxes), no longer have a custom
$isEmpty()
method on their NgModelController
that checks for value === false
. Unless
overwritten, the default $isEmpty()
method will be used, which treats undefined
, null
, NaN
and ''
as "empty".
Note: The $isEmpty()
method is used to determine if the checkbox is checked ("not empty" means
"checked") and thus it can indirectly affect other things, such as the control's validity
with respect to the required
validator (e.g. "empty" + "required" --> "invalid").
Before:
var template = '<my-checkbox role="checkbox" ng-model="value"></my-checkbox>';
var customCheckbox = $compile(template)(scope);
var ctrl = customCheckbox.controller('ngModel');
scope.$apply('value = false');
console.log(ctrl.$isEmpty()); //--> true
scope.$apply('value = true');
console.log(ctrl.$isEmpty()); //--> false
scope.$apply('value = undefined'/* or null or NaN or '' */);
console.log(ctrl.$isEmpty()); //--> false
After:
var template = '<my-checkbox role="checkbox" ng-model="value"></my-checkbox>';
var customCheckbox = $compile(template)(scope);
var ctrl = customCheckbox.controller('ngModel');
scope.$apply('value = false');
console.log(ctrl.$isEmpty()); //--> false
scope.$apply('value = true');
console.log(ctrl.$isEmpty()); //--> false
scope.$apply('value = undefined'/* or null or NaN or '' */);
console.log(ctrl.$isEmpty()); //--> true
--
If you want to have a custom $isEmpty()
method, you need to overwrite the default. For example:
.directive('myCheckbox', function myCheckboxDirective() {
return {
require: 'ngModel',
link: function myCheckboxPostLink(scope, elem, attrs, ngModelCtrl) {
ngModelCtrl.$isEmpty = function myCheckboxIsEmpty(value) {
return !value; // Any falsy value means "empty"
// Or to restore the previous behavior:
// return value === false;
};
}
};
})
$http
due to:
- b54a39:
remove deprecated callback methods:
success()/error()
$http
's deprecated custom callback methods - success()
and error()
- have been removed.
You can use the standard then()
/catch()
promise methods instead, but note that the method
signatures and return values are different.
success(fn)
can be replaced with then(fn)
, and error(fn)
can be replaced with either
then(null, fn)
or catch(fn)
.
Before:
$http(...).
success(function onSuccess(data, status, headers, config) {
// Handle success
...
}).
error(function onError(data, status, headers, config) {
// Handle error
...
});
After:
$http(...).
then(function onSuccess(response) {
// Handle success
var data = response.data;
var status = response.status;
var statusText = response.statusText;
var headers = response.headers;
var config = response.config;
...
}, function onError(response) {
// Handle error
var data = response.data;
var status = response.status;
var statusText = response.statusText;
var headers = response.headers;
var config = response.config;
...
});
// or
$http(...).
then(function onSuccess(response) {
// Handle success
var data = response.data;
var status = response.status;
var statusText = response.statusText;
var headers = response.headers;
var config = response.config;
...
}).
catch(function onError(response) {
// Handle error
var data = response.data;
var status = response.status;
var statusText = response.statusText;
var headers = response.headers;
var config = response.config;
...
});
Note:
There is a subtle difference between the variations showed above. When using
$http(...).success(onSuccess).error(onError)
or $http(...).then(onSuccess, onError)
, the
onError()
callback will only handle errors/rejections produced by the $http()
call. If the
onSuccess()
callback produces an error/rejection, it won't be handled by onError()
and might go
unnoticed. In contrast, when using $http(...).then(onSuccess).catch(onError)
, onError()
will
handle errors/rejections produced by both $http()
and onSuccess()
.
- fb6634:
JSONP callback must be specified by
jsonpCallbackParam
config
You can no longer use the JSON_CALLBACK
placeholder in your JSONP requests.
Instead you must provide the name of the query parameter that will pass the
callback via the jsonpCallbackParam
property of the config object, or app-wide via
the $http.defaults.jsonpCallbackParam
property, which is "callback"
by default.
Before this change:
$http.json('trusted/url?callback=JSON_CALLBACK');
$http.json('other/trusted/url', {params: {cb:'JSON_CALLBACK'}});
After this change:
$http.json('trusted/url');
$http.json('other/trusted/url', {jsonpCallbackParam:'cb'});
- 6476af: JSONP requests now require a trusted resource URL
All JSONP requests now require the URL to be trusted as resource URLs. There are two approaches to trust a URL:
Whitelisting with the $sceDelegateProvider.resourceUrlWhitelist()
method.
You configure this list in a module configuration block:
appModule.config(['$sceDelegateProvider', function($sceDelegateProvider) {
$sceDelegateProvider.resourceUrlWhitelist([
// Allow same origin resource loads.
'self',
// Allow JSONP calls that match this pattern
'https://some.dataserver.com/**.jsonp?**'
]);
}]);
Explicitly trusting the URL via the $sce.trustAsResourceUrl(url)
method.
You can pass a trusted object instead of a string as a URL to the $http
service:
var promise = $http.jsonp($sce.trustAsResourceUrl(url));
- 4f6f2b:
properly increment/decrement
$browser.outstandingRequestCount
HTTP requests now update the outstanding request count synchronously. Previously the request count would not have been updated until the request to the server is actually in flight. Now the request count is updated before the async interceptor is called.
The new behaviour is correct but it may change the expected behaviour in a small number of e2e test cases where an async request interceptor is being used.
$q
due to:
- e13eea: treat thrown errors as regular rejections
Previously, throwing an error from a promise's onFulfilled
or onRejection
handlers, would result
in passing the error to the $exceptionHandler()
(in addition to rejecting the promise with the
error as reason).
Now, a thrown error is treated exactly the same as a regular rejection. This applies to all
services/controllers/filters etc that rely on $q
(including built-in services, such as $http
and
$route
). For example, $http
's transformRequest/Response
functions or a route's redirectTo
function as well as functions specified in a route's resolve
object, will no longer result in a
call to $exceptionHandler()
if they throw an error. Other than that, everything will continue to
behave in the same way; i.e. the promises will be rejected, route transition will be cancelled,
$routeChangeError
events will be broadcasted etc.
- c9dffd: report promises with non rejection callback
Unhandled rejected promises will be logged to $exceptionHandler.
Tests that depend on specific order or number of messages in $exceptionHandler will need to handle rejected promises report.
ngTransclude
due to:
- 32aa7e: use fallback content if only whitespace is provided
Previously whitespace only transclusion would be treated as the transclusion being "not empty", which meant that fallback content was not used in that case.
Now if you only provide whitespace as the transclusion content, it will be assumed to be empty and the fallback content will be used instead.
If you really do want whitespace then you can force it to be used by adding a comment to the whitespace.
Previously this would not fallback to default content:
<some-component>
</some-component>
Now the whitespace between the opening and closing tags is treated as empty. To force the previous behaviour simply add a comment:
<some-component><!-- -->
</some-component>
$compile
due to:
- 13c252: correctly merge consecutive text nodes on IE11
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 unexpected side effects in the following cases:
-
Passing an array or jqLite/jQuery collection of parent-less text nodes to
$compile
directly:// Assuming: var textNodes = [ document.createTextNode('{{'), document.createTextNode('"foo:"'), document.createTextNode('}}') ]; var compiledNodes = $compile(textNodes)($rootScope); // Before: console.log(compiledNodes.length); // 3 console.log(compiledNodes.text()); // {{'foo'}} // After: console.log(compiledNodes.length); // 1 console.log(compiledNodes.text()); // foo // To get the old behavior, compile each node separately: var textNodes = [ document.createTextNode('{{'), document.createTextNode('"foo"'), document.createTextNode('}}') ]; var compiledNodes = angular.element(textNodes.map(function (node) { return $compile(node)($rootScope)[0]; }));
-
Using multi-slot transclusion with non-consecutive, default-content text nodes (that form interpolated expressions when merged):
// Assuming the following component: .component('someThing', { template: '<ng-transclude><!-- Default content goes here --></ng-transclude>' transclude: { ignored: 'veryImportantContent' } })
<!-- And assuming the following view: --> <some-thing> {{ <very-important-content>Nooot</very-important-content> 'foo'}} </some-thing> <!-- Before: --> <some-thing> <ng-transclude> {{ <-- Two separate 'foo'}} <-- text nodes </ng-transclude> </some-thing> <!-- After: --> <some-thing> <ng-transclude> foo <-- The text nodes were merged into `{{'foo'}}`, which was then interpolated </ng-transclude> </some-thing> <!-- To (visually) get the old behavior, wrap top-level text nodes on --> <!-- multi-slot transclusion directives into `<span>` elements; e.g.: --> <some-thing> <span>{{</span> <very-important-content>Nooot</very-important-content> <span>'foo'}}</span> </some-thing> <!-- Result: --> <some-thing> <ng-transclude> <span>{{</span> <-- Two separate <span>'foo'}}</span> <-- nodes </ng-transclude> </some-thing>
- b89c21:
move check for interpolation of
on-"event"
attributes to compile time
Using interpolation in any on* event attributes (e.g. <button onclick="{{myVar}}">
) will now throw
the "nodomevents" error at compile time.
Previously the nodomevents was thrown at link time. The new behavior makes it consistent with
the "selmulti" error.
The breaking change should be rare, as it relates to incorrect API use that should not make it to
production apps in the first place.
- 04cad4:
secure
link[href]
as aRESOURCE_URL
in$sce
link[href]
attributes are now protected via $sce
, which prevents interpolated
values that fail the RESOURCE_URL
context tests from being used in interpolation.
For example if the application is running at https://docs.angularjs.org
then the
following will fail:
<link href="{{ 'http://mydomain.org/unsafe.css' }}" rel="stylesheet">
By default, RESOURCE_URL
safe URLs are only allowed from the same domain and protocol
as the application document.
To use URLs from other domains and/or protocols, you may either whitelist them or
wrap it into a trusted value by calling $sce.trustAsResourceUrl(url)
.
- 97bbf8: don't trim white-space in attributes
White-space in attributes is no longer trimmed automatically. This includes leading and trailing white-space, and attributes that are purely white-space.
To migrate, attributes that require trimming must now be trimmed manually.
A common cases where stray white-space can cause problems is when attribute values are compared, for example in an $observer:
Before:
$attrs.$observe('myAttr', function(newVal) {
if (newVal === 'false') ...
});
To migrate, the attribute value should be trimmed manually:
$attrs.$observe('myAttr', function(newVal) {
if (newVal.trim() === 'false') ...
});
Note that $parse
trims expressions automatically, so attributes with expressions (e.g. directive
bindings) are unlikely to be affected by stray white-space.
ngRoute
due to:
- c13c66:
allow
ngView
to be included in an asynchronously loaded template
In cases where ngView
was loaded asynchronously, $route
(and its dependencies; e.g. $location
)
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 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 unexpected requests in tests), by using
$routeProvider.eagerInstantiationEnabled(false)
.
- 7f4b35:
don't process route change controllers and templates for
redirectTo
routes
The $route service no longer instantiates controllers nor calls resolves or template functions
for routes that have a redirectTo
unless the redirectTo
is a function that returns
undefined
.
- e98656:
implement
resolveRedirectTo
Previously, if redirectTo
was a function that threw an Error, execution was aborted without firing
a $routeChangeError
event.
Now, if a redirectTo
function throws an Error, a $routeChangeError
event will be fired.
ngMock
due to:
- 267ee9:
trigger digest in
$httpBackend.verifyNoOutstandingRequest()
Calling $httpBackend.verifyNoOutstandingRequest()
will trigger a digest. This will ensure that
requests fired asynchronously will also be detected (without the need to manually trigger a digest).
This is not expected to affect the majority of test-suites. Most of the time, a digest is (directly
or indirectly) triggered anyway, before calling verifyNoOutstandingRequest()
.
In the unlikely case that a test needs to verify the timing of a request with respect to the digest
cycle, you should rely on other means, such as mocking and/or spying.
- 7551b8:
fail if a url is provided but is
undefined
It is no longer valid to explicitly pass undefined
as the url
argument
to any of the $httpBackend.when...()
and $httpBackend.expect...()
methods.
While this argument is optional, it must have a defined value if it is provided.
Previously passing an explicit undefined
value was ignored but this
lead to invalid tests passing unexpectedly.
ngAria
due to:
- ad41ba:
bind to
keydown
instead ofkeypress
inngClick
If you were explicitly setting the value of the bindKeypress
flag, you need to change your code to
use bindKeydown
instead.
Before: $ariaProvider.config({bindKeypress: xyz})
After: $ariaProvider.config({bindKeydown: xyz})
Note:
If the element already has any of the ngKeydown
/ngKeyup
/ngKeypress
directives, ngAria
will
not bind to the keydown
event, since it assumes that the developer has already taken care of
keyboard interaction for that element.
Although it is not expected to affect many applications, it might be desirable to keep the previous
behavior of binding to the keypress
event instead of the keydown
. In that case, you need to
manually use the ngKeypress
directive (in addition to ngClick
).
Before:
<div ng-click="onClick()">
I respond to `click` and `keypress` (not `keydown`)
</div>
After:
<div ng-click="onClick()" ng-keypress="onClick()">
I respond to `click` and `keypress` (not `keydown`)
</div>
<!-- OR -->
<div ng-click="onClick()">
I respond to `click` and `keydown` (not `keypress`)
</div>
Finally, it is possible that this change affects your unit or end-to-end tests. If you are currently
expecting your custom buttons to automatically respond to the keypress
event (due to ngAria
),
you need to change the tests to trigger keydown
events instead.
- 9978de: don't add roles to native control elements
ngAria will no longer add the "role" attribute to native control elements (textarea, button, select, summary, details, a, and input). Previously, "role" was not added to input, but all others in the list.
This should not affect accessibility, because native inputs are accessible by default, but it might affect applications that relied on the "role" attribute being present (e.g. for styling or as directive attributes).
$resource
due to:
- acb545: pass all extra, owned properties as params
All owned properties of the params
object that are not used to replace URL params, will be passed
to $http
as config.params
(to be used as query parameters in the URL), even if
Object.prototype
has a property with the same name. E.g.:
Before:
var Foo = $resource('/foo/:id');
Foo.get({id: 42, bar: 'baz', toString: 'hmm'});
// URL: /foo/42?bar=baz
// Note that `toString` is _not_ included in the query,
// because `Object.prototype.toString` is defined :(
After:
var Foo = $resource('/foo/:id');
Foo.get({id: 42, bar: 'baz', toString: 'hmm'});
// URL: /foo/42?bar=baz&toString=hmm
// Note that `toString` _is_ included in the query, as expected :)
- 2456ab: add semicolon to whitelist of delimiters to unencode in URL params
Although it shouldn't matter in practice (since both the encoded and the unencoded ;
character would
be interpreted identically by the server), this change could break some tests: For example, where
$httpBackend
was set up to expect an encoded ;
character, but the request is made to the URL with an
unencoded ;
character.
select
due to:
- f02b70:
support values of any type added with
ngValue
<option>
elements added to <select ng-model>
via ngValue
now add their values in hash form, i.e.
<option ng-value="myString">
becomes <option ng-value="myString" value="string:myString">
.
This is done to support binding options with values of any type to selects.
This should rarely affect applications, as the values of options are usually not relevant to the application logic, but it's possible that option values are checked in tests.
- e8c2e1:
don't register options when select has no
ngModel
Option elements will no longer set their value attribute from their text value when their select element has no ngModel associated. Setting the value is only needed for the select directive to match model values and options. If no ngModel is present, the select directive doesn't need it.
This should not affect many applications as the behavior was undocumented and not part of a public API. It also has no effect on the usual HTML5 behavior that sets the select value to the option text if the option does not provide a value attribute.
ngBind
due to:
- fa80a6: use same string representation as $interpolate
ngBind
now uses the same logic as $interpolate (i.e. {{myString}}) when
binding, which means values other than strings are now transformed as following:
- null / undefined become empty string
- with an object's custom toString() function, except if the object is a Date, Array, or Number
- otherwise with JSON.stringify
Previously, ngBind would always use toString().
The following examples show the different output:
$scope.myPlainObject = {a: 1, b: 2};
$scope.myCustomObject = {a: 1, b: 2, toString: function() {return 'a+b';}};
Plain Object:
<!-- Before: -->
<span ng-bind="myPlainObject">[object Object]</span>
<!-- After: -->
<span ng-bind="myPlainObject">{'a':1,'b':2}</span>
Object with custom toString():
<!-- Before: -->
<span ng-bind="myCustomObject">[object Object]</span>
<!-- After: -->
<span ng-bind="myCustomObject">a+b</span>
If you want the output of toString()
, you can use it directly on the value in ngBind:
<span ng-bind="myObject.toString()">[object Object]</span>
$interpolate
due to:
- a5fd2e:
use custom
toString()
function if present
When converting values to strings, interpolation now uses a custom toString() function on objects
that are not Number, Array or Date (custom means that the toString
function is not the same as
Object.prototype.toString
). Otherwise, interpolation uses JSON.stringify() as usual.
Should you have a custom toString() function but still want the output of JSON.stringify(), migrate as shown in the following examples:
Before:
<span>{{myObject}}</span>
After - use the json
filter to stringify the object:
<span>{{myObject | json}}</span>
loader
due to:
- 6a2ebd: module.decorator order of operations is now irrelevant
module.decorator
declarations are now processed as part of the module.config
queue and may result in providers being decorated in a different order if
module.config
blocks are also used to decorate providers via
$provide.decorator
.
For example, consider the following declaration order in which 'theFactory' is
decorated by both a module.decorator
and a $provide.decorator
:
angular
.module('theApp', [])
.factory('theFactory', theFactoryFn)
.config(function($provide) {
$provide.decorator('theFactory', provideDecoratorFn);
})
.decorator('theFactory', moduleDecoratorFn);
Prior to this fix, 'theFactory' provider would be decorated in the following order:
- moduleDecoratorFn
- provideDecoratorFn
The result of this fix changes the order in which 'theFactory' is decorated
because now module.decorator
declarations are processed in the same order as
module.config
declarations:
- provideDecoratorFn
- moduleDecoratorFn
$location
due to:
- aa077e: default hashPrefix to '!'
The hash-prefix for $location
hash-bang URLs has changed from the empty
string "" to the bang "!". If your application does not use HTML5 mode
or is being run on browsers that do not support HTML5 mode, and you have
not specified your own hash-prefix then client side URLs will now contain
a "!" prefix. For example, rather than mydomain.com/#/a/b/c
will become
mydomain.com/#!/a/b/c
.
If you actually wanted to have no hash-prefix then you should configure this by adding a configuration block to you application:
appModule.config(['$locationProvider', function($locationProvider) {
$locationProvider.hashPrefix('');
}]);
input[type=range]
due to:
- 913016:
add support for binding to
input[type=range]
Due to the way that input[type=range]
elements behave this feature modifies the behavior of such elements
when bound to ngModel
:
- Like
input[type=number]
, it requires the model to be a Number, and will set the model to a Number - it supports setting the min/max values only via the min/max 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.
- browsers that do not support
input[type=range]
(IE9) handle the input like a number input (with validation etc.)
input[type=number]
due to:
- e1da4be:
add support for
step
toinput[type=number]
Number inputs that use ngModel
and specify a step
constraint (via step
/ngStep
attributes)
will now have a new validator (step
), which will verify that the current value is valid under the
step
constraint (according to the spec).
Previously, the step
constraint was ignored by ngModel
, treating values as valid even when there
was a step-mismatch.
If you want to restore the previous behavior (use the step
attribute while disabling step
validation), you can overwrite the built-in step
validator with a custom directive. For example:
// For all `input` elements...
.directive('input', function() {
return {
restrict: 'E',
require: '?ngModel',
link: function (scope, elem, attrs, ngModelCtrl) {
// ...that are of type "number" and have `ngModel`...
if ((attrs.type === 'number') && ngModelCtrl) {
// ...remove the `step` validator.
delete ngModelCtrl.$validators.step;
}
}
};
})
1.6.0-rc.2 safety-insurance (2016-11-24)
Security Fixes
- bootstrap: explicitly whitelist URL schemes for bootstrap. (#15427) (7f1b8b)
Bug Fixes
- $sce: fix
adjustMatcher
to replace multiple '*' and '**' (#7897) (991a2b)
Performance Improvements
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 AngularJS can pass the linter checks for Mozilla add-ons.
Security Fixes
- bootstrap:
- $location: throw if the path starts with double (back)slashes (353e3a)
- $sniffer: don't use
history.pushState
in sandboxed Chrome Packaged Apps (367da5) - $parse:
- $compile:
New Features
- input:
- ngMock/$httpBackend: flush requests in any order (098b6f)
Bug Fixes
- $httpBackend: complete the request on timeout (549edc #14969)
- ngOptions: remove selected attribute from unselected options (d31b3a #14892)
Performance Improvements
- $parse: improve performance of assignment expressions (f83c3d)
- $compile: add provider option to turn off compilation of css class and comment directives (775c24)
1.6.0-rc.1 proximity-warning (2016-11-21)
New Features
- ngModelOptions: allow options to be inherited from ancestor
ngModelOptions
(296cfc #10922) - $compile: set
preAssignBindingsEnabled
to false by default (bcd0d4 #15352)
Bug Fixes
- ngModelOptions: handle debounce of
updateOn
triggers that are not in debounce list (789790) - ngMock/$controller: respect
$compileProvider.preAssignBindingsEnabled()
(7d9a79) - $location: throw if the path starts with double (back)slashes (4aa953)
- core: do not auto-bootstrap when loaded from an extension. (0ff10e)
- input[radio]: use strict comparison when evaluating checked-ness (5ac7da #15288)
Reverts
- ngModelOptions: allow options to be inherited from ancestor ngModelOptions (fb0225)
Performance Improvements
- ngOptions: avoid calls to
element.value
(3b7f29)
Breaking Changes
- feat($compile): set preAssignBindingsEnabled to false by default (bcd0d4):
Previously, $compileProvider.preAssignBindingsEnabled
was
set to true by default. This means bindings were pre-assigned in component
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:
Before:
angular.module('myApp', [])
.component('myComponent', {
bindings: {value: '<'},
controller: function() {
this.doubleValue = this.value * 2;
}
});
After:
angular.module('myApp', [])
.component('myComponent', {
bindings: {value: '<'},
controller: function() {
this.$onInit = function() {
this.doubleValue = this.value * 2;
};
}
});
If you don't have time to migrate the code at the moment, you can flip the setting back to true:
angular.module('myApp', [])
.config(function($compileProvider) {
$compileProvider.preAssignBindingsEnabled(true);
})
.component('myComponent', {
bindings: {value: '<'},
controller: function() {
this.doubleValue = this.value * 2;
}
});
Don't do this if you're writing a library, though, as you shouldn't change global configuration then.
- fix(input[radio]): use strict comparison when evaluating checked-ness (5ac7da):
When using input[radio], the checked status is now determined by doing a strict comparison between the value of the input and the ngModel.$viewValue. Previously, this was a non-strict comparison (==).
This means in the following examples the radio is no longer checked:
<!-- this.selected = 0 -->
<input type="radio" ng-model="$ctrl.selected" value="0" >
<!-- this.selected = 0; this.value = false; -->
<input type="radio" ng-model="$ctrl.selected" ng-value="$ctrl.value" >
The migration strategy is to convert values that matched with non-strict conversion so that they will match with strict conversion.
- feat(ngModelOptions): allow options to be inherited from ancestor
ngModelOptions
(296cfc):
The programmatic API for ngModelOptions
has changed. You must now read options
via the ngModelController.$options.getOption(name)
method, rather than accessing the
option directly as a property of the ngModelContoller.$options
object. This does not
affect the usage in templates and only affects custom directives that might have been
reading options for their own purposes.
One benefit of these changes, though, is that the ngModelControler.$options
property
is now guaranteed to be defined so there is no need to check before accessing.
So, previously:
var myOption = ngModelController.$options && ngModelController.$options['my-option'];
and now:
var myOption = ngModelController.$options.getOption('my-option');
1.6.0-rc.0 bracing-vortex (2016-10-26)
Major notes
Please read the Sandbox Removal Blog Post.
Bug Fixes
- input: fix
step
validation forinput[type=number]
/input[type=range]
(081d06 #15257) - jqLite:
- $parse:
- ngModel: treat synchronous validators as boolean always (7bc71a #14734)
- $q: treat thrown errors as regular rejections (e13eea #3174 #15213)
- ngTransclude: use fallback content if only whitespace is provided (32aa7e #15077)
- $location: prevent infinite digest with IDN URLs in Edge (705afc #15217)
- $compile:
- don't throw tplrt error when there is a whitespace around a top-level comment (76d3da #15108)
- disallow linking the same element more than once (1e1fbc)
- lower the $sce context for src on video, audio, and track. (ad9a99)
- correctly merge consecutive text nodes on IE11 (13c252 #14924)
- secure
link[href]
as aRESOURCE_URL
s in$sce
. (04cad4 #14687) - don't add leading white-space in attributes for a specific merge case (305ba1)
- don't trim white-space in attributes (97bbf8 #5513 #5597)
- move check for interpolation of on-event attributes to compile time (b89c21 #13267)
- clean up
@
-binding observers when re-assigning bindings (586e2a #15268) - set attribute value even if
ngAttr*
contains no interpolation (3fe3da #15133) bindToController
should work withoutcontrollerAs
(16dcce #15088)- do not overwrite values set in
$onInit()
for<
-bound literals (a1bdff #15118) - avoid calling
$onChanges()
twice forNaN
initial values (7d7efb)
- select:
- select, ngOptions: make the handling of unknown / empty options consistent (2785ad)
- ngValue: set the element's value property in addition to the value attribute (e6afca #14031)
- aria/ngModel: do not overwrite the default
$isEmpty()
method for checkboxes (975a61 #14621) - $resource:
- $http:
- ngMock: trigger digest in
$httpBackend.verifyNoOutstandingRequest()
(267ee9 #13506) - ngAria:
- ngBind: use same string representation as
$interpolate
(fa80a6) - ngMock/$httpBackend: fail if a url is provided but is
undefined
(7551b8 #8442 #10934) - $route: don't process route change controllers and templates for
redirectTo
routes (7f4b35 #3332) - loader:
module.decorator
order of operations is now irrelevant (6a2ebd #12382) - $sanitize: reduce stack height in IE <= 11 (45129c #14928)
- ngAnimate: make svg elements work with
classNameFilter
(81bf7e)
New Features
- jqLite:
- implement
jqLite(f)
as an alias tojqLite(document).ready(f)
(369fb7) - don't throw for elements with missing
getAttribute
(4e6c14) - don't get/set properties when getting/setting boolean attributes (7ceb5f, #14126)
- don't remove a boolean attribute for
.attr(attrName, '')
(3faf45) - remove the attribute for
.attr(attribute, null)
(4e3624) - return
[]
for.val()
on<select multiple>
with no selection (d882fd)
- implement
- $compile:
- $http:
- $anchorScroll: convert numeric hash targets to string (9062ba #14680)
- ngModelOptions: allow options to be inherited from ancestor
ngModelOptions
(87a2ff #10922) - input:
- ngSwitch: allow multiple case matches via optional attribute
ngSwitchWhenSeparator
(0b221 #3410 #3516) - ngRoute: allow
ngView
to be included in an asynchronously loaded template (c13c66 #1213) - select: support values of any type added with
ngValue
(f02b70 #9842) - $interpolate: use custom
toString()
function if present (a5fd2e #7317 #11406) - $route: implement
resolveRedirectTo
(e98656 #5150) - $q: report promises with non rejection callback (c9dffd #13653 #7992)
- $resource: pass
status
/statusText
to success callbacks (e3a378 #8341 #8841) - $location:
- $controller: throw when requested controller is not registered (eacfe4 #14980)
Performance Improvements
- form, ngModel: change controllers to use prototype methods (9e24e7)
- select: don't prepend unknown option if already prepended (ba36bd)
- $animate: listen for document visibility changes (d71dc2)
- injector: cache the results of the native class detection check (5ceb5d)
- $parse: Inline constants (bd7d5f)
- $compile:
- $parse: remove Angular expression sandbox (1547c7 #15094)
Breaking Changes
jqLite due to:
- fc0c11: camelCase keys in
jqLite#data
Previously, keys passed to the data method were left untouched.
Now they are internally camelCased similarly to how jQuery handles it, i.e.
only single (!) hyphens followed by a lowercase letter get converted to an
uppercase letter. This means keys a-b
and aB
represent the same data piece;
writing to one of them will also be reflected if you ask for the other one.
If you use Angular with jQuery, it already behaved in this way so no changes are required on your part.
To migrate the code follow the examples below:
BEFORE:
/* 1 */
elem.data('my-key', 2);
elem.data('myKey', 3);
/* 2 */
elem.data('foo-bar', 42);
elem.data()['foo-bar']; // 42
elem.data()['fooBar']; // undefined
/* 3 */
elem.data()['foo-bar'] = 1;
elem.data()['fooBar'] = 2;
elem.data('foo-bar'); // 1
AFTER:
/* 1 */
// Rename one of the keys as they would now map to the same data slot.
elem.data('my-key', 2);
elem.data('my-key2', 3);
/* 2 */
elem.data('foo-bar', 42);
elem.data()['foo-bar']; // undefined
elem.data()['fooBar']; // 42
/* 3 */
elem.data()['foo-bar'] = 1;
elem.data()['fooBar'] = 2;
elem.data('foo-bar'); // 2
- 73050c: align jqLite camelCasing logic with JQuery
Before, when Angular was used without jQuery, the key passed to the css method was more heavily camelCased; now only a single (!) hyphen followed by a lowercase letter is getting transformed. This also affects APIs that rely on the css method, like ngStyle.
If you use Angular with jQuery, it already behaved in this way so no changes are needed on your part.
To migrate the code follow the example below:
Before:
HTML:
// All five versions used to be equivalent.
<div ng-style={background_color: 'blue'}></div>
<div ng-style={'background:color': 'blue'}></div>
<div ng-style={'background-color': 'blue'}></div>
<div ng-style={'background--color': 'blue'}></div>
<div ng-style={backgroundColor: 'blue'}></div>
JS:
// All five versions used to be equivalent.
elem.css('background_color', 'blue');
elem.css('background:color', 'blue');
elem.css('background-color', 'blue');
elem.css('background--color', 'blue');
elem.css('backgroundColor', 'blue');
// All five versions used to be equivalent.
var bgColor = elem.css('background_color');
var bgColor = elem.css('background:color');
var bgColor = elem.css('background-color');
var bgColor = elem.css('background--color');
var bgColor = elem.css('backgroundColor');
After:
HTML:
// Previous five versions are no longer equivalent but these two still are.
<div ng-style={'background-color': 'blue'}></div>
<div ng-style={backgroundColor: 'blue'}></div>
JS:
// Previous five versions are no longer equivalent but these two still are.
elem.css('background-color', 'blue');
elem.css('backgroundColor', 'blue');
// Previous five versions are no longer equivalent but these two still are.
var bgColor = elem.css('background-color');
var bgColor = elem.css('backgroundColor');
- 7ceb5f: 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:
input[checked="checked"] { ... }
JS:
elem1.attr('checked', 'checked');
elem2.attr('checked', false);
After:
CSS:
input:checked { ... }
JS:
elem1.prop('checked', true);
elem2.prop('checked', false);
- 3faf45: don't remove a boolean attribute for
.attr(attrName, '')
Before, using the attr
method with an empty string as a value
would remove the boolean attribute. Now it sets it to its lowercase name as
was happening for every non-empty string so far. The only two values that remove
the boolean attribute are now null & false, just like in jQuery.
To migrate the code follow the example below:
Before:
elem.attr(booleanAttrName, '');
After:
elem.attr(booleanAttrName, false);
or:
elem.attr(booleanAttrName, null);
- 4e3624: remove the attribute for
.attr(attribute, null)
Invoking elem.attr(attributeName, null)
would set the
attributeName
attribute value to a string "null"
, now it removes the
attribute instead.
To migrate the code follow the example below:
Before:
elem.attr(attributeName, null);
After:
elem.attr(attributeName, "null");
- d882fd: return [] for .val() on
<select multiple>
with no selection
For the jqLite element representing a select element in the multiple variant with no options chosen the .val() getter used to return null and now returns an empty array.
To migrate the code follow the example below:
Before:
HTML:
<select multiple>
<option>value 1</option>
<option>value 2</option>
</select>
JavaScript:
var value = $element.val();
if (value) {
/* do something */
}
After:
HTML:
<select multiple>
<option>value 1</option>
<option>value 2</option>
</select>
JavaScript:
var value = $element.val();
if (value.length > 0) {
/* do something */
}
ngModel
due to:
- 7bc71a: treat synchronous validators as boolean always
Previously, only a literal false
return would resolve as the
synchronous validator failing. Now, all falsy JavaScript values
are treated as failing the validator, as one would naturally expect.
Specifically, the values 0
(the number zero), null
, NaN
and ''
(the
empty string) used to be considered valid (passing) and they are now considered
invalid (failing). The value undefined
was treated similarly to a pending
asynchronous validator, causing the validation to be pending. undefined
is
also now considered invalid.
To migrate, make sure your synchronous validators are returning either a
literal true
or a literal false
value. For most code, we expect this to
already be the case. Only a very small subset of projects will be affected.
Namely, anyone using undefined
or any falsy value as a return will now see
their validation failing, whereas previously falsy values other than undefined
would have been seen as passing and undefined
would have been seen as pending.
- 9e24e7: change controllers to use prototype methods
The use of prototype methods instead of new methods per instance removes the ability to pass NgModelController and FormController methods without context.
For example
$scope.$watch('something', myNgModelCtrl.$render)
will no longer work because the $render
method is passed without any context.
This must now be replaced with
$scope.$watch('something', function() {
myNgModelCtrl.$render();
})
or possibly by using Function.prototype.bind
or angular.bind
.
aria/ngModel
due to:
- 975a61: do not overwrite the default
$isEmpty()
method for checkboxes
Custom checkbox
-shaped controls (e.g. checkboxes, menuitemcheckboxes), no longer have a custom
$isEmpty()
method on their NgModelController
that checks for value === false
. Unless
overwritten, the default $isEmpty()
method will be used, which treats undefined
, null
, NaN
and ''
as "empty".
Note: The $isEmpty()
method is used to determine if the checkbox is checked ("not empty" means
"checked") and thus it can indirectly affect other things, such as the control's validity
with respect to the required
validator (e.g. "empty" + "required" --> "invalid").
Before:
var template = '<my-checkbox role="checkbox" ng-model="value"></my-checkbox>';
var customCheckbox = $compile(template)(scope);
var ctrl = customCheckbox.controller('ngModel');
scope.$apply('value = false');
console.log(ctrl.$isEmpty()); //--> true
scope.$apply('value = true');
console.log(ctrl.$isEmpty()); //--> false
scope.$apply('value = undefined'/* or null or NaN or '' */);
console.log(ctrl.$isEmpty()); //--> false
After:
var template = '<my-checkbox role="checkbox" ng-model="value"></my-checkbox>';
var customCheckbox = $compile(template)(scope);
var ctrl = customCheckbox.controller('ngModel');
scope.$apply('value = false');
console.log(ctrl.$isEmpty()); //--> false
scope.$apply('value = true');
console.log(ctrl.$isEmpty()); //--> false
scope.$apply('value = undefined'/* or null or NaN or '' */);
console.log(ctrl.$isEmpty()); //--> true
--
If you want to have a custom $isEmpty()
method, you need to overwrite the default. For example:
.directive('myCheckbox', function myCheckboxDirective() {
return {
require: 'ngModel',
link: function myCheckboxPostLink(scope, elem, attrs, ngModelCtrl) {
ngModelCtrl.$isEmpty = function myCheckboxIsEmpty(value) {
return !value; // Any falsy value means "empty"
// Or to restore the previous behavior:
// return value === false;
};
}
};
})
$http
due to:
- b54a39: remove deprecated callback methods:
success()/error()
$http
's deprecated custom callback methods - success()
and error()
- have been removed.
You can use the standard then()
/catch()
promise methods instead, but note that the method
signatures and return values are different.
success(fn)
can be replaced with then(fn)
, and error(fn)
can be replaced with either
then(null, fn)
or catch(fn)
.
Before:
$http(...).
success(function onSuccess(data, status, headers, config) {
// Handle success
...
}).
error(function onError(data, status, headers, config) {
// Handle error
...
});
After:
$http(...).
then(function onSuccess(response) {
// Handle success
var data = response.data;
var status = response.status;
var statusText = response.statusText;
var headers = response.headers;
var config = response.config;
...
}, function onError(response) {
// Handle error
var data = response.data;
var status = response.status;
var statusText = response.statusText;
var headers = response.headers;
var config = response.config;
...
});
// or
$http(...).
then(function onSuccess(response) {
// Handle success
var data = response.data;
var status = response.status;
var statusText = response.statusText;
var headers = response.headers;
var config = response.config;
...
}).
catch(function onError(response) {
// Handle error
var data = response.data;
var status = response.status;
var statusText = response.statusText;
var headers = response.headers;
var config = response.config;
...
});
Note:
There is a subtle difference between the variations showed above. When using
$http(...).success(onSuccess).error(onError)
or $http(...).then(onSuccess, onError)
, the
onError()
callback will only handle errors/rejections produced by the $http()
call. If the
onSuccess()
callback produces an error/rejection, it won't be handled by onError()
and might go
unnoticed. In contrast, when using $http(...).then(onSuccess).catch(onError)
, onError()
will
handle errors/rejections produced by both $http()
and onSuccess()
.
- fb6634: JSONP callback must be specified by
jsonpCallbackParam
config
You can no longer use the JSON_CALLBACK
placeholder in your JSONP requests.
Instead you must provide the name of the query parameter that will pass the
callback via the jsonpCallbackParam
property of the config object, or app-wide via
the $http.defaults.jsonpCallbackParam
property, which is "callback"
by default.
Before this change:
$http.json('trusted/url?callback=JSON_CALLBACK');
$http.json('other/trusted/url', {params: {cb:'JSON_CALLBACK'}});
After this change:
$http.json('trusted/url');
$http.json('other/trusted/url', {jsonpCallbackParam:'cb'});
- 6476af: JSONP requests now require a trusted resource URL
All JSONP requests now require the URL to be trusted as resource URLs. There are two approaches to trust a URL:
Whitelisting with the $sceDelegateProvider.resourceUrlWhitelist()
method.
You configure this list in a module configuration block:
appModule.config(['$sceDelegateProvider', function($sceDelegateProvider) {
$sceDelegateProvider.resourceUrlWhitelist([
// Allow same origin resource loads.
'self',
// Allow JSONP calls that match this pattern
'https://some.dataserver.com/**.jsonp?**'
]);
}]);
Explicitly trusting the URL via the $sce.trustAsResourceUrl(url)
method.
You can pass a trusted object instead of a string as a URL to the $http
service:
var promise = $http.jsonp($sce.trustAsResourceUrl(url));
- 4f6f2b: properly increment/decrement
$browser.outstandingRequestCount
HTTP requests now update the outstanding request count synchronously. Previously the request count would not have been updated until the request to the server is actually in flight. Now the request count is updated before the async interceptor is called.
The new behaviour is correct but it may change the expected behaviour in a small number of e2e test cases where an async request interceptor is being used.
$q
due to:
- e13eea: treat thrown errors as regular rejections
Previously, throwing an error from a promise's onFulfilled
or onRejection
handlers, would result
in passing the error to the $exceptionHandler()
(in addition to rejecting the promise with the
error as reason).
Now, a thrown error is treated exactly the same as a regular rejection. This applies to all
services/controllers/filters etc that rely on $q
(including built-in services, such as $http
and
$route
). For example, $http
's transformRequest/Response
functions or a route's redirectTo
function as well as functions specified in a route's resolve
object, will no longer result in a
call to $exceptionHandler()
if they throw an error. Other than that, everything will continue to
behave in the same way; i.e. the promises will be rejected, route transition will be cancelled,
$routeChangeError
events will be broadcasted etc.
- c9dffd: report promises with non rejection callback
Unhandled rejected promises will be logged to $exceptionHandler.
Tests that depend on specific order or number of messages in $exceptionHandler will need to handle rejected promises report.
ngTransclude
due to:
- 32aa7e: use fallback content if only whitespace is provided
Previously whitespace only transclusion would be treated as the transclusion being "not empty", which meant that fallback content was not used in that case.
Now if you only provide whitespace as the transclusion content, it will be assumed to be empty and the fallback content will be used instead.
If you really do want whitespace then you can force it to be used by adding a comment to the whitespace.
ngModelOptions
due to:
- 87a2ff: allow options to be inherited from ancestor
ngModelOptions
Previously, if a setting was not applied on ngModelOptions
, then it would default
to undefined. Now the setting will be inherited from the nearest ngModelOptions
ancestor.
It is possible that an ngModelOptions
directive that does not set a property,
has an ancestor ngModelOptions that does set this property to a value other than
undefined
. This would cause the ngModel
and input controls below this ngModelOptions
directive to display different behaviour. This is fixed by explicitly setting the
property in the ngModelOptions
to prevent it from inheriting from the ancestor.
For example if you had the following HTML:
<form ng-model-options="{updateOn: 'blur'}">
<input ng-model="..." ng-model-options="{allowInvalid: true}">
</form>
Then before this change the input would update on the default event not blur. After this change the input will inherit the option to update on blur. If you want the original behaviour then you will need to specify the option on the input as well:
<form ng-model-options="{updateOn: 'blur'}">
<input ng-model="..." ng-model-options="{updateOn: 'default', allowInvalid: true}">
</form>
The programmatic API for ngModelOptions
has changed. You must now read options
via the getOption
method, rather than accessing the option directly as a property
of the options object. This does not affect the usage in templates and only
affects custom directives that might have been reading options for their own purposes.
$compile
due to:
- 13c252: correctly merge consecutive text nodes on IE11
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 unexpected side effects in the following cases:
-
Passing an array or jqLite/jQuery collection of parent-less text nodes to
$compile
directly:// Assuming: var textNodes = [ document.createTextNode('{{'), document.createTextNode('"foo:"'), document.createTextNode('}}') ]; var compiledNodes = $compile(textNodes)($rootScope); // Before: console.log(compiledNodes.length); // 3 console.log(compiledNodes.text()); // {{'foo'}} // After: console.log(compiledNodes.length); // 1 console.log(compiledNodes.text()); // foo // To get the old behavior, compile each node separately: var textNodes = [ document.createTextNode('{{'), document.createTextNode('"foo"'), document.createTextNode('}}') ]; var compiledNodes = angular.element(textNodes.map(function (node) { return $compile(node)($rootScope)[0]; }));
-
Using multi-slot transclusion with non-consecutive, default-content text nodes (that form interpolated expressions when merged):
// Assuming the following component: .component('someThing', { template: '<ng-transclude><!-- Default content goes here --></ng-transclude>' transclude: { ignored: 'veryImportantContent' } })
<!-- And assuming the following view: --> <some-thing> {{ <very-important-content>Nooot</very-important-content> 'foo'}} </some-thing> <!-- Before: --> <some-thing> <ng-transclude> {{ <-- Two separate 'foo'}} <-- text nodes </ng-transclude> </some-thing> <!-- After: --> <some-thing> <ng-transclude> foo <-- The text nodes were merged into `{{'foo'}}`, which was then interpolated </ng-transclude> </some-thing> <!-- To (visually) get the old behavior, wrap top-level text nodes on --> <!-- multi-slot transclusion directives into `<span>` elements; e.g.: --> <some-thing> <span>{{</span> <very-important-content>Nooot</very-important-content> <span>'foo'}}</span> </some-thing> <!-- Result: --> <some-thing> <ng-transclude> <span>{{</span> <-- Two separate <span>'foo'}}</span> <-- nodes </ng-transclude> </some-thing>
- b89c21: move check for interpolation of on-event attributes to compile time
Using interpolation in any on* event attributes (e.g. <button onclick="{{myVar}}">
) will now throw
the "nodomevents" error at compile time.
Previously the nodomevents was thrown at link time. The new behavior makes it consistent with
the "selmulti" error.
The breaking change should be rare, as it relates to incorrect API use that should not make it to
production apps in the first place.
- 04cad4: secure
link[href]
as aRESOURCE_URL
in$sce
link[href]
attributes are now protected via $sce
, which prevents interpolated
values that fail the RESOURCE_URL
context tests from being used in interpolation.
For example if the application is running at https://docs.angularjs.org
then the
following will fail:
<link href="{{ 'http://mydomain.org/unsafe.css' }}" rel="stylesheet">
By default, RESOURCE_URL
safe URLs are only allowed from the same domain and protocol
as the application document.
To use URLs from other domains and/or protocols, you may either whitelist them or
wrap it into a trusted value by calling $sce.trustAsResourceUrl(url)
.
- 97bbf8: don't trim white-space in attributes
White-space in attributes is no longer trimmed automatically. This includes leading and trailing white-space, and attributes that are purely white-space.
To migrate, attributes that require trimming must now be trimmed manually.
A common cases where stray white-space can cause problems is when attribute values are compared, for example in an $observer:
Before:
$attrs.$observe('myAttr', function(newVal) {
if (newVal === 'false') ...
});
To migrate, the attribute value should be trimmed manually:
$attrs.$observe('myAttr', function(newVal) {
if (newVal.trim() === 'false') ...
});
Note that $parse
trims expressions automatically, so attributes with expressions (e.g. directive
bindings) are unlikely to be affected by stray white-space.
ngRoute
due to:
- c13c66: allow
ngView
to be included in an asynchronously loaded template
In cases where ngView
was loaded asynchronously, $route
(and its dependencies; e.g. $location
)
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 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 unexpected requests in tests), by using
$routeProvider.eagerInstantiationEnabled(false)
.
- 7f4b35: don't process route change controllers and templates for
redirectTo
routes
The $route service no longer instantiates controllers nor calls resolves or template functions
for routes that have a redirectTo
unless the redirectTo
is a function that returns
undefined
.
- e98656: implement
resolveRedirectTo
Previously, if redirectTo
was a function that threw an Error, execution was aborted without firing
a $routeChangeError
event.
Now, if a redirectTo
function throws an Error, a $routeChangeError
event will be fired.
ngMock
due to:
- 267ee9: trigger digest in
$httpBackend.verifyNoOutstandingRequest()
Calling $httpBackend.verifyNoOutstandingRequest()
will trigger a digest. This will ensure that
requests fired asynchronously will also be detected (without the need to manually trigger a digest).
This is not expected to affect the majority of test-suites. Most of the time, a digest is (directly
or indirectly) triggered anyway, before calling verifyNoOutstandingRequest()
.
In the unlikely case that a test needs to verify the timing of a request with respect to the digest
cycle, you should rely on other means, such as mocking and/or spying.
- 7551b8: fail if a url is provided but is
undefined
It is no longer valid to explicitly pass undefined
as the url
argument
to any of the $httpBackend.when...()
and $httpBackend.expect...()
methods.
While this argument is optional, it must have a defined value if it is provided.
Previously passing an explicit undefined
value was ignored but this
lead to invalid tests passing unexpectedly.
ngAria
due to:
- ad41ba: bind to
keydown
instead ofkeypress
inngClick
If you were explicitly setting the value of the bindKeypress
flag, you need to change your code to
use bindKeydown
instead.
Before: $ariaProvider.config({bindKeypress: xyz})
After: $ariaProvider.config({bindKeydown: xyz})
Note:
If the element already has any of the ngKeydown
/ngKeyup
/ngKeypress
directives, ngAria
will
not bind to the keydown
event, since it assumes that the developer has already taken care of
keyboard interaction for that element.
Although it is not expected to affect many applications, it might be desirable to keep the previous
behavior of binding to the keypress
event instead of the keydown
. In that case, you need to
manually use the ngKeypress
directive (in addition to ngClick
).
Before:
<div ng-click="onClick()">
I respond to `click` and `keypress` (not `keydown`)
</div>
After:
<div ng-click="onClick()" ng-keypress="onClick()">
I respond to `click` and `keypress` (not `keydown`)
</div>
<!-- OR -->
<div ng-click="onClick()">
I respond to `click` and `keydown` (not `keypress`)
</div>
Finally, it is possible that this change affects your unit or end-to-end tests. If you are currently
expecting your custom buttons to automatically respond to the keypress
event (due to ngAria
),
you need to change the tests to trigger keydown
events instead.
- 9978de: don't add roles to native control elements
ngAria will no longer add the "role" attribute to native control elements (textarea, button, select, summary, details, a, and input). Previously, "role" was not added to input, but all others in the list.
This should not affect accessibility, because native inputs are accessible by default, but it might affect applications that relied on the "role" attribute being present (e.g. for styling or as directive attributes).
$resource
due to:
- acb545: pass all extra, owned properties as params
All owned properties of the params
object that are not used to replace URL params, will be passed
to $http
as config.params
(to be used as query parameters in the URL), even if
Object.prototype
has a property with the same name. E.g.:
Before:
var Foo = $resource('/foo/:id');
Foo.get({id: 42, bar: 'baz', toString: 'hmm'});
// URL: /foo/42?bar=baz
// Note that `toString` is _not_ included in the query,
// because `Object.prototype.toString` is defined :(
After:
var Foo = $resource('/foo/:id');
Foo.get({id: 42, bar: 'baz', toString: 'hmm'});
// URL: /foo/42?bar=baz&toString=hmm
// Note that `toString` _is_ included in the query, as expected :)
- 2456ab: add semicolon to whitelist of delimiters to unencode in URL params
Although it shouldn't matter in practice (since both the encoded and the unencoded ;
character would
be interpreted identically by the server), this change could break some tests: For example, where
$httpBackend
was set up to expect an encoded ;
character, but the request is made to the URL with an
unencoded ;
character.
select
due to:
- f02b70: support values of any type added with ngValue
<option>
elements added to <select ng-model>
via ngValue
now add their values in hash form, i.e.
<option ng-value="myString">
becomes <option ng-value="myString" value="string:myString">
.
This is done to support binding options with values of any type to selects.
This should rarely affect applications, as the values of options are usually not relevant to the application logic, but it's possible that option values are checked in tests.
- e8c2e1: don't register options when select has no ngModel
Option elements will no longer set their value attribute from their text value when their select element has no ngModel associated. Setting the value is only needed for the select directive to match model values and options. If no ngModel is present, the select directive doesn't need it.
This should not affect many applications as the behavior was undocumented and not part of a public API. It also has no effect on the usual HTML5 behavior that sets the select value to the option text if the option does not provide a value attribute.
ngBind
due to:
- fa80a6: use same string representation as $interpolate
ngBind
now uses the same logic as $interpolate (i.e. {{myString}}) when
binding, which means values other than strings are now transformed as following:
- null / undefined become empty string
- with an object's custom toString() function, except if the object is a Date, Array, or Number
- otherwise with JSON.stringify
Previously, ngBind would always use toString().
The following examples show the different output:
$scope.myPlainObject = {a: 1, b: 2};
$scope.myCustomObject = {a: 1, b: 2, toString: function() {return 'a+b';}};
Plain Object:
<!-- Before: -->
<span ng-bind="myPlainObject">[object Object]</span>
<!-- After: -->
<span ng-bind="myPlainObject">{'a':1,'b':2}</span>
Object with custom toString():
<!-- Before: -->
<span ng-bind="myCustomObject">[object Object]</span>
<!-- After: -->
<span ng-bind="myCustomObject">a+b</span>
If you want the output of toString()
, you can use it directly on the value in ngBind:
<span ng-bind="myObject.toString()">[object Object]</span>
$interpolate
due to:
- a5fd2e: use custom toString() function if present
When converting values to strings, interpolation now uses a custom toString() function on objects
that are not Number, Array or Date (custom means that the toString
function is not the same as
Object.prototype.toString
). Otherwise, interpolation uses JSON.stringify() as usual.
Should you have a custom toString() function but still want the output of JSON.stringify(), migrate as shown in the following examples:
Before:
<span>{{myObject}}</span>
After - use the json
filter to stringify the object:
<span>{{myObject | json}}</span>
loader
due to:
- 6a2ebd: module.decorator order of operations is now irrelevant
module.decorator
declarations are now processed as part of the module.config
queue and may result in providers being decorated in a different order if
module.config
blocks are also used to decorate providers via
$provide.decorator
.
For example, consider the following declaration order in which 'theFactory' is
decorated by both a module.decorator
and a $provide.decorator
:
angular
.module('theApp', [])
.factory('theFactory', theFactoryFn)
.config(function($provide) {
$provide.decorator('theFactory', provideDecoratorFn);
})
.decorator('theFactory', moduleDecoratorFn);
Prior to this fix, 'theFactory' provider would be decorated in the following order:
- moduleDecoratorFn
- provideDecoratorFn
The result of this fix changes the order in which 'theFactory' is decorated
because now module.decorator
declarations are processed in the same order as
module.config
declarations:
- provideDecoratorFn
- moduleDecoratorFn
$location
due to:
- aa077e: default hashPrefix to '!'
The hash-prefix for $location
hash-bang URLs has changed from the empty
string "" to the bang "!". If your application does not use HTML5 mode
or is being run on browsers that do not support HTML5 mode, and you have
not specified your own hash-prefix then client side URLs will now contain
a "!" prefix. For example, rather than mydomain.com/#/a/b/c
will become
mydomain.com/#!/a/b/c
.
If you actually wanted to have no hash-prefix then you should configure this by adding a configuration block to you application:
appModule.config(['$locationProvider', function($locationProvider) {
$locationProvider.hashPrefix('');
}]);
input[type=range]
due to:
- 913016: add support for binding to
input[type=range]
Due to the way that input[type=range]
elements behave this feature modifies the behavior of such elements
when bound to ngModel
:
- Like
input[type=number]
, it requires the model to be a Number, and will set the model to a Number - it supports setting the min/max values only via the min/max 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.
- browsers that do not support
input[type=range]
(IE9) handle the input like a number input (with validation etc.)
input[type=number]
due to:
- e1da4be: add support for
step
toinput[type=number]
Number inputs that use ngModel
and specify a step
constraint (via step
/ngStep
attributes)
will now have a new validator (step
), which will verify that the current value is valid under the
step
constraint (according to the spec).
Previously, the step
constraint was ignored by ngModel
, treating values as valid even when there
was a step-mismatch.
If you want to restore the previous behavior (use the step
attribute while disabling step
validation), you can overwrite the built-in step
validator with a custom directive. For example:
// For all `input` elements...
.directive('input', function() {
return {
restrict: 'E',
require: '?ngModel',
link: function (scope, elem, attrs, ngModelCtrl) {
// ...that are of type "number" and have `ngModel`...
if ((attrs.type === 'number') && ngModelCtrl) {
// ...remove the `step` validator.
delete ngModelCtrl.$validators.step;
}
}
};
})
1.2.32 alternation-intention (2016-10-11)
This release reverts the fix in 1.2.31 and provides an alternative fix that doesn't break Angular Material.
Reverts
- input: ensure that hidden input values are correct after history back (ed44dd065)
Bug Fixes
- $compile: ensure that hidden input values are correct after history back (b8a0ecdd6)
1.4.13 croaking-elderweed (2016-10-10)
Bug Fixes
- input: ensure that hidden input values are correct after history back (693d1334
1.2.31 barking-moustache (2016-10-10)
Bug Fixes
- input: ensure that hidden input values are correct after history back (7ec663fc
1.4.12
Invalid release
1.5.8 arbitrary-fallbacks (2016-07-22)
Bug Fixes
- $animate: do not get affected by custom, enumerable properties on
Object.prototype
(181e4401, #14804, #14830) - $compile: ensure
$doCheck
hooks can be defined in the controller constructor (3010ed4e, #14811) - $injector: fix class detection RegExp (4724d56c, #14533)
- $jsonpCallbacks: do not overwrite callbacks added by other apps (1778d347, #14824)
- $timeout: make $flush handle new $timeouts added in $timeout callbacks (1a387ba5, #5420, #14686)
- copy: fix handling of typed subarrays (1645924d, #14842, #14845)
- modules: allow modules to be loaded in any order when using
angular-loader
(98e4a220, #9140, #14794) - ngAnimate: allow removal of class that is scheduled to be added with requestAnimationFrame (7ccfe92b, #14582)
- ngMocks: allow
ErrorAddingDeclarationLocationStack
to be recognized as anError
(c6074dc3, #13821, #14344) - ngOptions: don't duplicate groups with falsy values (c3bfd7f5)
- ngTransclude:
Features
- $compile: backport $doCheck (de59ca71, #14656)
- $jsonpCallbacks: new service to abstract how JSONP callbacks are handled (a8cacfe9, #14795)
- $q: implement $q.race (b9a56d58, #12929, #14757)
- $resource: pass the resource to a dynamic param functions (a126fcfe, #4899)
- $swipe: add pointer support (f797f83c, #14061, #14791)
- filterFilter: allow overwriting the special
$
property name (33514ec3, #13313)
Performance Improvements
- $compile: wrap try/catch of collect comment directives into a function to avoid V8 deopt (acd45518, #14848)
1.2.30 patronal-resurrection (2016-07-21)
Note: This release contains some security fixes that required breaking changes. Since the legacy 1.2.x branch is the only version branch that supports IE8, it was necessary to introduce a couple of low-impact breaking changes in a patch release - something we generally avoid - in order to make the fixes available to people that still need IE8 support.
Bug Fixes
- $compile:
- ngSanitize: blacklist the attribute
usemap
as it can be used as a security exploit (ac0d5286, #14903) - ngAnimate: do not use event.timeStamp anymore for time tracking (8d83b563, #13494, #13495)
Breaking Changes
- $compile: due to f35f334b,
link[href]
attributes are now protected via $sce
, which prevents interpolated values that fail
the RESOURCE_URL
context tests from being used in interpolation. For example if the application is
running at https://mydomain.org/
then the following will fail:
<link rel="stylesheet" href="{{ 'https://otherdomain.org/unsafe.css' }}" />
By default, RESOURCE_URL
safe URLs are only allowed from the same domain and protocol as the
application document. To use URLs from other domains and/or protocols, you may either whitelist them
using $sceDelegateProvider.resourceUrlWhitelist(...)
or wrap them into a trusted value by calling
$sce.trustAsResourceUrl(url)
.
- ngSanitize: due to 234053fc,
The $sanitize
service will now remove instances of the usemap
attribute from any elements passed
to it.
This attribute is used to reference another element by name
or id
. Since the name
and id
attributes are already blacklisted, a sanitized usemap
attribute could only reference unsanitized
content, which is a security risk.
1.5.7 hexagonal-circumvolution (2016-06-15)
Bug Fixes
- $compile:
- $location: initialize
$$absUrl
to empty string (294d6793f, #11091, #13565, #14488) - $parse: allow arguments to contain filter chains (cc6dcb4b, #4175, #4168, #14720)
- $routeProvider: do not deep-copy route definition objects (6d0dcca6, #14478, #14699, #14750)
- input[email]: improve email address validation (f423dc6b, #14719)
- ngMessages: create new scope for ngMessage, clean it up correctly (56f33af8, #14307)
- ngMessagesInclude: don't break on empty (or whitespace-only) templates (01b8772c, #12941, #14726)
- ngMock#$controller: properly assign bindings to all types of controllers (e.g. class-based) (db58801a, #14437, #14439)
- ngMockE2E: allow $httpBackend.passThrough() to work when ngMock is loaded (6685043a, #1434, #13124)
- ngSanitize: call attribute setter in linky for all links (c4fad6ad, #14707)
Features
- limitTo: add support for array-like objects (b03957f0, #14657, #14694)
- orderBy: add support for custom comparators (2e33d170, #13238, #14455, #5123, #8112, #10368, #14468)
1.4.12 cultural-conservation (2016-06-15)
This release contains only documentation updates. Specifically, it restores the old (deprecated) version of the tutorial on the 1.4.x branch. If someone needs a version of the tutorial that is compatible with v1.4, they can find it at https://code.angularjs.org/1.4.12/docs/tutorial/.
As always, the latest and greatest version of the tutorial can be found on the master branch (at https://docs.angularjs.org/tutorial/). We strongly recommend using this version as it is kept up-to-date, showcases several new features introduced in v1.5 or later and follows modern best practices.
1.5.6 arrow-stringification (2016-05-27)
Bug Fixes
- $browser: set the url even if the browser transforms it (743b33ab, #14427, #14499)
- $compile:
- properly bind context to linking functions for directives with
templateUrl
(5ae72dc7) - always use the DDO as
this
in pre-/post-linking functions (47bc98a1, #9306) - don't run unnecessary update to one-way bindings (30479647, #14546, #14580)
- removing unnecessary white space in element-transclusion comments (1116a96d, #14549, #14550)
- properly handle setting
srcset
to undefined (308f22ba, #14470, #14493)
- properly bind context to linking functions for directives with
- $injector:
- $templateRequest: trust empty templates in
$templateCache
as well (10955969, #14479, #14496) - filters: always call
splice()
with 2 arguments or more (6f1fae8a, #14467, #14489) - ng-bind-html: watch the unwrapped value using
$sce.valueOf()
(instead oftoString()
) (1c1c9b27, #14526, #14527) - ngAnimate:
- ngMessages: do not compile ngMessagesInclude template if scope is destroyed (69d9072d, #12695, #14640)
- ngMock:
Features
- $compile: support omitting required controller name if same as the local name (8965d57a, #14513)
- $parse: Add support for ES6 object initializers (1c9b9e24)
Performance Improvements
- $rootScope: make queues more efficient (51b78f61, #14545)
- ngAnimate: listen for document visibility changes (b377d6b0, #14568)
- ngClass: improve even-odd checking (cf1b1755)
1.4.11 relentless-syncomania (2016-05-27)
Bug Fixes
- $compile: properly handle setting
srcset
to undefined (85a53ea9, #14470, #14493) - $templateRequest: trust empty templates in
$templateCache
as well (ad21f8fe, #14479, #14496) - filters: always call
splice()
with 2 arguments or more (4e735e53, #14467, #14489) - formatNumber: handle small numbers correctly when
gSize
!==lgSize
(a1188721, #14289, #14290) - ng-bind-html: watch the unwrapped value using
$sce.valueOf()
(instead oftoString()
) (f31586db, #14526, #14527) - ngAnimate:
- ngClass: fix watching of an array expression containing an object (b5086700, #14405)
- ngMessages: don't crash when nested messages are removed (71dca7c4, #14183, #14242)
- ngMock: fix collecting stack trace in
inject()
on IE10+, PhantomJS (56dae6fa, #13591, #13592, #13593)
Performance Improvements
1.5.5 material-conspiration (2016-04-18)
Reverts
-
$compile: move setting of controller data to single location Reverted commit 21d148ae since it caused the Angular Material tabs directive to fail.
-
ngRoute: allow
ngView
to be included in an asynchronously loaded template 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 in tests.
Bug Fixes
- $compile:
- do not use
noop()
as controller for multiple components (4c8aeefb, #14391, #14402) - still trigger
$onChanges
even if the inner value already matches the new value (d9448dcb, #14406) - handle boolean attributes in
@
bindings (499e1b2a, #14070) - don't throw if controller is named (e72990dc)
- ensure that
$onChanges
hook is called correctly (0ad2b708, #14355, #14359)
- do not use
- $injector: ensure functions with overridden
toString()
are annotated properly (d384834f, #14361) - ngAnimate:
- ngClass: fix watching of an array expression containing an object (f975d8d4, #14405)
- ngMock: fix collecting stack trace in
inject()
on IE10+, PhantomJS (e9c718a4, #13591, #13592, #13593) - ngOptions: set select value when model matches disabled option (832eba5f, #12756)
- $http: pass event object to
eventHandlers
/uploadEventHandlers
(25d4e5cc, #14436)
Features
- $compile:
- $componentController: provide isolated scope if none is passed (#14425) (33f817b9, #14425)
- $http:
- $parse: add the ability to define the identifier characters (3e7fa191)
- ngAnimate: let $animate.off() remove all listeners for an element (bf6cb8ab)
- ngAria: add support for aria-readonly based on ngReadonly (ec0baadc, #14140, #14077)
- ngParseExt: new ngParseExt module (d08f5c69)
Performance Improvements
- $compile: use createMap() for directive bindings to allow fast
forEach
(c115b37c, #12529) - ngOptions: use
documentFragment
to populateselect
options (6a4124d0, #13607, #13239, #12076)
1.5.4 graduated-sophistry (2016-04-14)
This was a partially published release that you should ignore.
1.5.3 diplohaplontic-meiosis (2016-03-25)
Bug Fixes
- $compile: workaround a GC bug in Chrome < 50 (513199ee, #14041, #14286)
- $sniffer: fix history sniffing in Chrome Packaged Apps (457fd21a, #11932, #13945)
- formatNumber: handle small numbers correctly when
gSize
!==lgSize
(3277b885, #14289, #14290) - ngAnimate: run structural animations with cancelled out class changes (c7813e9e, #14249)
- ngMessages: don't crash when nested messages are removed (ef91b04c, #14183, #14242)
Features
- $compile: add more lifecycle hooks to directive controllers (9cd9956d, #14127, #14030, #14020, #13991, #14302)
1.5.2 differential-recovery (2016-03-18)
This release reverts a breaking change that accidentally made it into the 1.5.1 release. See fee7bac3 for more info.
Bug Fixes
- ngAnimate.$animate: remove animation callbacks when the element is removed (ce7f4000)
1.5.1 equivocal-sophistication (2016-03-16)
Bug Fixes
- core: only call
console.log
whenwindow.console
exists (ce138f3c, #14006, #14007, #14047) - $compile: allow directives to have decorators (0728cc2f)
- $resource: fix parse errors on older Android WebViews (df8db7b4, #13989)
- $routeProvider: properly handle optional eager path named groups (c0797c68, #14011)
- copy: add support for copying
Blob
objects (e9d579b6, #9669, #14064) - dateFilter: correctly format BC years (e36205f5)
- formatNumber: allow negative fraction size (e046c170, #13913)
- input: re-validate when partially editing date-family inputs (e383804c, #12207, #13886)
- input[date]: support years with more than 4 digits (d76951f1, #13735, #13905)
- ngOptions: always set the 'selected' attribute for selected options (9f5a1722, #14115)
- ngRoute: allow
ngView
to be included in an asynchronously loaded template (8237482d, #1213, #6812, #14088) - ngMock:
- ngMockE2E: pass
responseType
to$delegate
when usingpassThrough
(d16faf9f, #5415, #5783)
Features
- $compile: add custom annotations to the controller (0c800930, #14114)
- $controllerProvider: add a
has()
method for checking the existence of a controller (bb9575db, #13951, #14109) - dateFilter: add support for STANDALONEMONTH in format (
LLLL
) (3e5b25b3, #13999, #14013) - ngMock: add
sharedInjector()
toangular.mock.module
(a46ab60f, #14093, #10238)
Performance Improvements
- ngRepeat: avoid duplicate jqLite wrappers (632e15a3)
- ngAnimate:
1.4.10 benignant-oscillation (2016-03-16)
Bug Fixes
- core: only call
console.log
whenwindow.console
exists (beb00e44, #14006, #14007, #14047) - $animateCss: cancel fallback timeout when animation ends normally (a60bbc12, #13787)
- $compile:
- $parse:
- $rootScope: set no context when calling helper functions for
$watch
(ab5c7698) - $route: allow preventing a route reload (4bc30314, #9824, #13894)
- $routeProvider: properly handle optional eager path named groups (6a4403a1, #14011)
- copy: add support for copying
Blob
objects (863a4232, #9669, #14064) - dateFilter: follow the CLDR on pattern escape sequences (f476060d, #12839)
- dateFilter, input: fix Date parsing in IE/Edge when timezone offset contains
:
(571afd65, #13880, #13887) - input: re-validate when partially editing date-family inputs (02929f82, #12207, #13886)
- select: handle corner case of adding options via a custom directive (df6e7315, #13874, #13878)
- ngOptions: always set the 'selected' attribute for selected options (f87e8288, #14115)
- ngAnimate: properly cancel previously running class-based animations (3b27dd37, #10156, #13822)
- ngAnimateChildren: make it compatible with
ngIf
(dc158e7e, #13865, #13876) - ngMockE2E: pass
responseType
to$delegate
when usingpassThrough
(947cb4d1, #5415, #5783)
Features
- $locale: Include original locale ID in $locale (e69f3550, #13390)
- ngAnimate: provide ng-[event]-prepare class for structural animations (796f7ab4)
Performance Improvements
- $compile: avoid needless overhead when wrapping text nodes (946d9ae9)
- ngRepeat: avoid duplicate jqLite wrappers (d04c38c4)
- ngAnimate:
1.5.0 ennoblement-facilitation (2016-02-05)
Bug Fixes
- $parse: Copy
inputs
for expressions with expensive checks (37cb9ad4) - $rootScope: Set no
this
context when calling helper functions for$watch
(1c6edd41) - $route: allow route reload to be prevented (2f0a50b5, #9824, #13894)
- dateFilter, input: fix Date parsing in IE/Edge when timezone offset contains
:
(622c4216, #13880, #13887) - ngAnimateChildren: make it compatible with
ngIf
(8aecf46a, #13865, #13876) - ngAria: Apply ARIA attrs correctly (d06431e5, #13078, #11374, #11830, #13483)
- select: handle the corner case of adding options via a custom directive (ca5b27bd, #13874, #13878)
Features
- $compile: add one-way binding to the isolate scope definition (4ac23c0a, #13928, #13854, #12835, #13900)
Breaking Changes
Upgrade to 1.5.1
This version of AngularJS is problematic due to a issue during its release. Please upgrade to version 1.5.2.
- ngAria: due to d06431e5,
Where appropriate, ngAria now applies ARIA to custom controls only, not native inputs. Because of this, support for
aria-multiline
on textareas has been removed.
1.5.0-rc.2 controller-requisition (2016-01-28)
Deprecation Warning
- The
ngTouch
module'sngClick
directive has been deprecated and disabled by default. See the breaking changes section for more information - The
angular.lowercase
andangular.uppercase
functions have been deprecated and will be removed in version 1.7.0. It is recommended to use String.prototype.toLowerCase and String.prototype.toUpperCase functions instead.
Bug Fixes
- $compile:
- $parse: Preserve expensive checks when running $eval inside an expression (acfda102)
- dateFilter: follow the CLDR on pattern escape sequences (1ab4e444, #12839)
- ngAnimate:
- cancel fallback timeout when animation ends normally (e9c406b2, #13787)
- correctly handle
$animate.pin()
host elements (7700e2df, #13783) - properly cancel-out previously running class-based animations (20b8ece4, #10156, #13822)
- ensure that animate promises resolve when the document is hidden (52ea4110)
- do not trigger animations if the document is hidden (a3a7afd3, #12842, #13776)
- ngSanitize: blacklist the attribute
usemap
as it can be used as a security exploit (234053fc) - ngTouch: deprecate ngClick and disable it by default (0dfc1dfe, #4030, #5307, #6001, #6432, #7231, #11358, #12082, #12153, #12392, #12545, #12867, #13213, #13558, #3296, #3347, #3447, #3999, #4428, #6251, #6330, #7134, #7935, #9724, #9744, #9872, #10211, #10366, #10918, #11197, #11261, #11342, #11577, #12150, #12317, #12455, #12734, #13122, #13272, #13447)
Features
- $compile:
- $locale: include original locale ID in
$locale
(63492a02, #13390) - $resource: add support for timeout in cancellable actions (d641901b, #13824)
Performance Improvements
- $compile: avoid needless overhead when wrapping text nodes (92e4801d)
- ngAnimate: speed up
areAnimationsAllowed
check (683bd92f)
Breaking Changes
- ngSanitize: due to 234053fc,
The $sanitize
service will now remove instances of the usemap
attribute from any elements passed
to it.
This attribute is used to reference another element by name
or id
. Since the name
and id
attributes are already blacklisted, a sanitized usemap
attribute could only reference unsanitized
content, which is a security risk.
- ngTouch: due to 0dfc1dfe,
The ngClick
override directive from the ngTouch
module is deprecated and disabled by default.
This means that on touch-based devices, users might now experience a 300ms delay before a click event is fired.
If you rely on this directive, you can still enable it with the $touchProvider.ngClickOverrideEnabled()
method:
angular.module('myApp').config(function($touchProvider) {
$touchProvider.ngClickOverrideEnabled(true);
});
Going forward, we recommend using FastClick or perhaps one of the Angular 3rd party touch-related modules that provide similar functionality.
Also note that modern browsers already remove the 300ms delay under some circumstances:
- Chrome and Firefox for Android remove the 300ms delay when the well-known
<meta name="viewport" content="width=device-width">
is set - Internet Explorer removes the delay when
touch-action
css property is set tonone
ormanipulation
- Since iOs 8, Safari removes the delay on so-called "slow taps"
See this article by Telerik for more info on the topic.
Note that this change does not affect the ngSwipe
directive.
1.4.9 implicit-superannuation (2016-01-21)
Bug Fixes
- Animation
- ensure that animate promises resolve when the document is hidden (9a60408c)
- do not trigger animations if the document is hidden (09f6061a, #12842, #13776)
- only copy over the animation options once (2fc954d3, #13722, #13578)
- allow event listeners on document in IE (5ba4419e, #13548, #13696)
- allow removing classes that are added by a running animation (6c4581fc, #13339, #13380, #13414, #13472, #13678)
- do not use
event.timeStamp
anymore for time tracking (620a20d1, #13494, #13495) - ignore children without animation data when closing them (be01cebf, #11992, #13424)
- do not alter the provided options data (7a81e6fe, #13040, #13175)
- correctly handle
$animate.pin()
host elements (a985adfd, #13783) - allow animations when pinned element is parent element (4cb8ac61, #13466)
- allow enabled children to animate on disabled parents (6d85f24e, #13179, #13695)
- correctly access
minErr
(0c1b54f0) - ensure animate runner is the same with and without animations (937942f5, #13205, #13347)
- remove animation end event listeners on close (d9157849, #13672)
- consider options.delay value for closing timeout (592bf516, #13355, #13363)
- $controller: allow identifiers containing
$
(2563ff7b, #13736) - $http: throw if url passed is not a string (c5bf9dae, #12925, #13444)
- $parse: handle interceptors with
undefined
expressions (7bb2414b) - $resource: don't allow using promises as
timeout
and log a warning (47486524) - formatNumber: cope with large and small number corner cases (9c49eb13, #13394, #8674, #12709, #8705, #12707, #10246, #10252)
- input:
- isArrayLike: recognize empty instances of an Array subclass (323f9ab7, #13560, #13708)
- ngInclude: do not compile template if original scope is destroyed (9590bcf0)
- ngOptions:
- select: re-define
ngModelCtrl.$render
in theselect
directive's postLink function (529b2507, #13583, #13583, #13663)
Minor Features
- ngLocale: add support for standalone months (54c4041e, #3744, #10247, #12642, #12844)
- ngMock: add support for
$animate.closeAndFlush()
(512c0811)
Performance Improvements
- ngAnimate: speed up
areAnimationsAllowed
check (2d3303dd)
Breaking Changes
While we do not deem the following to be a real breaking change we are highlighting it here in the changelog to ensure that it does not surprise anyone.
- $resource: due to 47486524,
Possible breaking change for users who updated their code to provide a timeout
promise for a $resource
request in version v1.4.8.
Up to v1.4.7 (included), using a promise as a timeout in $resource
, would silently
fail (i.e. have no effect).
In v1.4.8, using a promise as timeout would have the (buggy) behaviour described in https://github.com/angular/angular.js/pull/12657#issuecomment-152108887. (I.e. it will work as expected for the first time you resolve the promise and will cancel all subsequent requests after that - one has to re-create the resource class. This was not documented.)
With this change, using a promise as timeout in v1.4.9 onwards is not allowed. It will log a warning and ignore the timeout value.
If you need support for cancellable $resource
actions, you should upgrade to
version 1.5 or higher.
1.5.0-rc.1 quantum-fermentation (2016-01-15)
Features
- $compile:
- $compileProvider: - allow registering components with the component() method (feeb19787ca6e23e15578a4d1319f1c33853290c)
- component:
- $injector: support instantiating classes. (8b6b4282)
- ngMock: add support for
$animate.closeAndFlush()
(e1def1b8, #13005, #13576, #13707) - ngMock.$componentController: add helper to instantiate controllers for components (dd14e0c4, #13683, #13711)
Bug Fixes
- $animate:
- $animateCss:
- $compile:
- component:
- $controller: allow identifiers containing
$
(4e1b36c2, #13736) - $injector: workaround for MS Edge class detection (fabc6ab5)
- $q: make instanceof work for $q promises (b3ef5e08)
- copy:
- input: fix URL validation being too strict (e3be5d6e, #13528, #13544)
- isArrayLike: recognize empty instances of an Array subclass (93c7251f, #13560, #13708)
- linky: throw error if input is not a string (98c2db7f, #13547, #13693)
- ngAnimate:
- only copy over the animation options once (d4fa3313, #13722, #13578)
- allow event listeners on document in IE (e5cab951, #13548, #13696)
- allow removing classes that are added by a running animation (776972ed, #13339, #13380, #13414, #13472, #13678)
- do not use event.timeStamp anymore for time tracking (e020b899, #13494, #13495)
- ngInclude: do not compile template if original scope is destroyed (98776487)
- ngMock: ignore empty javascript animations in $animate.closeAndFlush() (a801df71)
- ngOptions: don't skip optgroup elements with value === '' (6858caf2, #13487, #13489)
- select: re-define ngModelCtrl.$render in the select postLink fn (f7eab8d8, #13583, #13583, #13663)
Breaking Changes
-
$component: These breaking changes affect only applications updating from previous 1.5 beta / rc versions
-
Due to d91cf167, the default
controllerAs
value for components is now$ctrl
(previously the name of the component was used). To migrate, either setcontrollerAs
to the component name, or change the property name in your templates to$ctrl
-
Due to 25bc5318, it is no longer possible to set the
restrict
option on directives created via themodule.component()
helper. All components are now element directives (restrict: 'E'
). If you need a directive that is not an element then you must use themodule.directive()
helper instead. -
Due to f31c5a39, components are now always created with
scope: {}
(isolate scope). Previously, it was also possible to create components withscope: true
orscope: false
. If your components rely on this scope configuration, you will have to create a regular directive instead. -
Due to 6a47c0d7, the
transclude
property is nowfalse
by default (previouslytrue
). If you created components that expected transclusion then you must change your code to specifytransclude: true
.
-
-
linky: due to 98c2db7f,
Before this change, the filter assumed that the input (if not undefined/null) was of type 'string'
and that certain methods (such as .match()
) would be available on it. Passing a non-string value
would most likely result in a not-very-useful error being thrown (trying to call a method that does
not exist) or in unexpected behavior (if the input happened to have the assumed methods).
After this change, a proper (informative) error will be thrown. If you want to pass non-string
values through linky
, you need to explicitly convert them to strings first.
Since input values could be initialized asynchronously, undefined
or null
will still be
returned unchanged (without throwing an error).
1.5.0-rc.0 oblong-panoptikum (2015-12-09)
This is the first Release Candidate for AngularJS 1.5.0. Please try upgrading your applications and report any regressions or other issues you find as soon as possible.
Features
- $parse: provide a mechanism to access the locals object,
$locals
(0ea53503) - $resource: add proper support for cancelling requests,
$cancelRequest()
(98528be3, #9332, #13050, #13058, #13210) - ngAnimate: provide ng-[event]-prepare class for structural animations (6e18b50a)
- ngLocale: add support for standalone months (96c73a06, #3744, #10247, #12642, #12844)
- ngMock: destroy $rootScope after each test (b75c0d8d, #13433)
- ngTransclude: don't overwrite the contents with an unfilled optional slot (0812af49, #13426)
- ngView: reference resolved locals in scope,
resolveAs: '$resolve'
(983b0598, #13400)
Bug Fixes
- $compile:
- $http: throw if url passed is not a string (6628b4f1, #12925, #13444)
- $parse:
- $sanitize: blacklist SVG
<use>
elements (7a668cdd, #13453) - formatNumber: cope with large and small number corner cases (6a0686d4, #13394, #8674, #12709, #8705, #12707, #10246, #10252)
- input: add missing chars to URL validation regex (e4bb8387, #13379, #13460)
- ngAnimate:
- consider options.delay value for closing timeout (7ffb2d3c, #13355, #13363)
- ensure animate runner is the same with and without animations (546a277d, #13205, #13347)
- ignore children without animation data when closing them (77419cf1, #11992, #13424)
- do not alter the provided options data (193153c3, #13040, #13175)
- ngMock: clear out
$providerInjector
after each test (a72c12bd, #13397, #13416) - ngOptions: don't $dirty multiple select after compilation (c7a2028a, #13211, #13326)
- ngTransclude:
Breaking Changes
- $compile: due to c3a26911,
This is only a breaking change to a feature that was added in beta 2. If you have not started using multi-slot transclusion then this will not affect you.
The keys and values for the transclude
map of the directive definition have been swapped around
to be more consistent with the other maps, such as scope
and bindToController
.
Now the key
is the slot name and the value
is a normalized element selector.
- $resource: due to 98528be3,
Using a promise as timeout
is no longer supported and will log a
warning. It never worked the way it was supposed to anyway.
Before:
var deferred = $q.defer();
var User = $resource('/api/user/:id', {id: '@id'}, {
get: {method: 'GET', timeout: deferred.promise}
});
var user = User.get({id: 1}); // sends a request
deferred.resolve(); // aborts the request
// Now, we need to re-define `User` passing a new promise as `timeout`
// or else all subsequent requests from `someAction` will be aborted
User = $resource(...);
user = User.get({id: 2});
After:
var User = $resource('/api/user/:id', {id: '@id'}, {
get: {method: 'GET', cancellable: true}
});
var user = User.get({id: 1}); // sends a request
user.$cancelRequest(); // aborts the request
user = User.get({id: 2});
- $sanitize: due to 7a668cdd,
The $sanitize service will now remove instances of the <use>
tag from the content passed to it.
This element is used to import external SVG resources, which is a security risk as the $sanitize
service does not have access to the resource in order to sanitize it.
- ngView: due to 983b0598,
A new property to access route resolves is now available on the scope of the route. The default name
for this property is $resolve
. If your scope already contains a property with this name then it
will be hidden or overwritten.
In this case, you should choose a custom name for this property, that does not collide with other
properties on the scope, by specifying the resolveAs
property on the route.
- $parse: due to 0ea53503,
A new property to access all the locals for an expression is now available on the scope. This property
is $locals
.
- If
scope.$locals
already exists, the way to reference this property is nowthis.$locals
. - If the locals themselves include a property
$locals
then the way to reference that is now$locals.$locals
.
1.4.8 ice-manipulation (2015-11-19)
Bug Fixes
- $animate: ensure leave animation calls
close
callback (6bd6dbff, #12278, #12096, #13054) - $cacheFactory: check key exists before decreasing cache size count (2a5a52a7, #12321, #12329)
- $compile:
- $http: apply
transformResponse
even whendata
is empty (c6909464, #12976, #12979) - $location: ensure
$locationChangeSuccess
fires even if URL ends with#
(6f8ddb6d, #12175, #13251) - $parse: evaluate once simple expressions only once (e4036824, #12983, #13002)
- $resource: allow XHR request to be cancelled via a timeout promise (7170f9d9, #12657, #12675, #10890, #9332)
- $rootScope: prevent IE9 memory leak when destroying scopes (87b0055c, #10706, #11786)
- Angular.js: fix
isArrayLike
for unusual cases (70edec94, #10186, #8000, #4855, #4751, #10272) - isArrayLike: handle jQuery objects of length 0 (d3da55c4)
- jqLite:
- limitTo: start at 0 if
begin
is negative and exceeds input length (4fc40bc9, #12775, #12781) - merge:
- ngAria: don't add tabindex to radio and checkbox inputs (59f1f4e1, #12492, #13095)
- ngInput: change URL_REGEXP to better match RFC3987 (cb51116d, #11341, #11381)
- ngMock: reset cache before every test (91b7cd9b, #13013)
- ngOptions:
Performance Improvements
- $compile: use static jquery data method to avoid creating new instances (55ad192e)
- copy:
- merge: remove unnecessary wrapping of jqLite element (ce6a96b0, #13236)
1.5.0-beta.2 effective-delegation (2015-11-17)
Bug Fixes
- $animate: ensure leave animation calls
close
callback (bfad2a4f, #12278, #12096, #13054) - $cacheFactory: check key exists before decreasing cache size count (b9bed7d9, #12321, #12329)
- $compile:
- bind all directive controllers correctly when using
bindToController
(bd7b2177, 1c13a4f4 #11343, #11345) - evaluate against the correct scope with bindToController on new scope (50557a6c, #13021, #13025)
- fix scoping of transclusion directives inside a replace directive (1a98c0ee, #12975, #12936, #13244)
- bind all directive controllers correctly when using
- $http: apply
transformResponse
even whendata
is empty (7c0731ed, #12976, #12979) - $location: ensure
$locationChangeSuccess
fires even if URL ends with#
(4412fe23, #12175, #13251) - $parse: evaluate simple expressions in interpolations only once (1caf0b6b, #12983, #13002)
- $resource: allow XHR request to be cancelled via a timeout promise (4fc73466, #12657, #12675, #10890, #9332)
- $rootScope: prevent IE9 memory leak when destroying scopes (8fe781fb, #10706, #11786)
- Angular.js: fix
isArrayLike
for unusual cases (2c8d87e0, #10186, #8000, #4855, #4751, #10272) - isArrayLike: handle jQuery objects of length 0 (773efd08)
- jqLite:
- limitTo: start at 0 if
begin
is negative and exceeds input length (ecf93048, #12775, #12781) - merge:
- ngAria: don't add tabindex to radio and checkbox inputs (662fb282, #12492, #13095)
- ngInput: change URL_REGEXP to better match RFC3987 (ffb6b2fb, #11341, #11381)
- ngMessage: make ngMessage compatible with ngBind (4971ef12, #8089, #13074)
- ngMock: reset cache before every test (fd83d372, #13013)
- ngOptions:
- orderByFilter: throw error if input is not array-like (2a85a634, #11255, #11719)
Features
- $compile: multiple transclusion via named slots (a4ada8ba, #4357, #12742, #11736, #12934)
- $injector: allow specifying a decorator on $injector (29a05984)
- $templateRequest: support configuration of $http options (b2fc39d2, #13188, #11868, #6860)
- Module: add helper method,
component(...)
for creating component directives (54e81655, #10007, #12933) - linky: add support for custom attributes (06f002b1, #12558, #13061)
- ngAnimate: introduce ngAnimateSwap directive (78297d25)
- ngMock:
Performance Improvements
- $compile: use static jquery data method to avoid creating new instances (9b90c32f)
- $interpolate: provide a simplified result for constant expressions (cf83b4f4)
- copy:
- merge: remove unnecessary wrapping of jqLite element (4daafd3d, #13236)
Breaking Changes
- ngMessage: due to 4971ef12,
ngMessage is now compiled with a priority of 1, which means directives on the same element as ngMessage with a priority lower than 1 will be applied when ngMessage calls the $transclude function. Previously, they were applied during the initial compile phase and were passed the comment element created by the transclusion of ngMessage. To restore this behavior, custom directives need to have their priority increased to at least "1".
- orderByFilter: due to 2a85a634,
Previously, an non array-like input would pass through the orderBy filter unchanged.
Now, an error is thrown. This can be worked around by converting an object
to an array, either manually or using a filter such as
https://github.com/petebacondarwin/angular-toArrayFilter.
(null
and undefined
still pass through without an error, in order to
support asynchronous loading of resources.)
1.5.0-beta.1 dense-dispersion (2015-09-29)
Bug Fixes
- $compile:
- $parse:
- $sanitize:
- filters: ensure
formatNumber
observes i18n decimal separators (658a865c, #10342, #12850) - injector: support arrow functions with no parenthesis (03726f7f, #12890)
- input: remove workaround for Firefox bug (b366f035)
- ngAnimate:
- ngMessages: prevent race condition with ngAnimate (8366622b, #12856, #12903)
- ngOptions:
- ngResource: encode
&
in URL query param values (1c97a605, #12201)
Features
- $animateCss: add support for temporary styles via
cleanupStyles
(9f67da62, #12930) - $http: add
$xhrFactory
service to enable creation of custom xhr objects (106f90aa, #2318, #9319, #12159) - $injector: add strictDi property to $injector instance (79577c5d, #11728, #11734)
- $sanitize: make svg support an opt-in (181fc567, #12524)
- ngModel: provide ng-empty and ng-not-empty CSS classes (630280c7, #10050, #12848)
Performance Improvements
- $compile: Lazily compile the
transclude
function (652b83eb) See https://github.com/angular/angular.js/issues/14343#issuecomment-229037252 for more information.
Breaking Changes
- $sanitize: due to 181fc567, The svg support in is now an opt-in option
Applications that depend on this option can use to turn the option back on, but while doing so, please read the warning provided in the documentation for information on preventing click-hijacking attacks when this option is turned on.
- ngOptions: due to b71d7c3f,
If your data contains falsy values (''
, 0
, false
and null
) for option groups, then these
options will now be placed into option groups. Previously all of these falsy values were treated as
the option not being a member of a group.
Only option groups that are undefined
will result in the option being put in no group.
If you have data that contains falsy values that should not be used as groups then you must filter
the values before passing them to ngOptions
converting falsy values to undefined
.
- ngOptions: due to ded25187,
ngOptions
will now throw if ngModel
is not present on the select
element. Previously, having no ngModel
let ngOptions
silently
fail, which could lead to hard to debug errors. The change should
therefore not affect any applications, as it simply makes the
requirement more strict and alerts the developer explicitly.
1.4.7 dark-luminescence (2015-09-29)
Bug Fixes
- $compile: use createMap() for $$observe listeners when initialized from attr interpolation (5a98e806, #10446)
- $parse:
- filters: ensure
formatNumber
observes i18n decimal separators (4994acd2, #10342, #12850) - jqLite: properly handle dash-delimited node names in
jqLiteBuildFragment
(cdd1227a, #10617, #12759) - ngAnimate:
- ngMessages: prevent race condition with ngAnimate (7295c60f, #12856, #12903)
- ngOptions:
Features
- $animateCss: add support for temporary styles via
cleanupStyles
(e52d731b, #12930) - $http: add
$xhrFactory
service to enable creation of custom xhr objects (7a413df5, #2318, #9319, #12159)
1.3.20 shallow-translucence (2015-09-29)
Bug Fixes
- $parse: do not convert to string computed properties multiple times (d434f3db)
1.2.29 ultimate-deprecation (2015-09-29)
Bug Fixes
- $browser: prevent infinite digests when clearing the hash of a url (9845cee6, #9629, #9635, #10228, #10308)
- $compile: workaround for IE11 MutationObserver (fccce96d, #11781, #12613)
- $location: strip off empty hash segments when comparing (e81b2f72, #9635, #10748)
- $parse:
- ngAnimate: ensure that minified repaint code isn't removed (b041b664, #9936)
1.5.0-beta.0 intialization-processation (2015-09-17)
Bug Fixes
1.4.6 multiplicative-elevation (2015-09-17)
Bug Fixes
- $animate: invalid CSS class names should not break subsequent elements (c3a654b7, #12674, #12725)
- $browser: handle async updates to location (8d39bd8a, #12241, #12819)
- $http: propagate status -1 for timed out requests (38520a1a, #4491, #8756)
- $httpBackend: send
null
when post-data is undefined (6f39f108, #12141, #12739) - $parse:
- angular.copy: support copying XML nodes (122ab074, #5429, #12786)
- form, ngModel: correctly notify parent form when children are added (c6110e8b)
- input: ignore min/max if they are empty on all input types (544001f5, #12363, #12785)
- ngAnimateMock: $animate.flush should work for looping animations (472d076c)
- ngAria: clean up tabindex usage (f48244ce, #11500)
- ngJq: properly detect when
ng-jq
is empty (19ecdb54, #12741) - ngModel:
- ngRepeat: add support to iterate an object's properties even if it does not inherit from Object (7ea2c7f3, #9964)
- rootScope: add support for watchCollection to watch an object which does not inherit from Object (20fb626b, #9964)
- select: update option if interpolated value attribute changes (82b0929e, #12005, #12582)
- toDebugString: change replacement string (0ca8b1df, #10103)
Performance Improvements
1.3.19 glutinous-shriek (2015-09-15)
Bug Fixes
- $http: propagate status -1 for timed out requests (f13055a0, #4491, #8756)
- $location: don't crash if navigating outside the app base (623ce1ad, #11667)
- $parse: throw error when accessing a restricted property indirectly (ec98c94c, #12833)
- ngModel: validate pattern against the viewValue (274e9353, #12344)
Features
- ngAnimate: introduce
$animate.flush
for unit testing (f98e0384)
Possible Breaking Changes
- ngModel: due to 274e9353,
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 guarantees 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);
};
}
};
}
};
});
1.4.5 permanent-internship (2015-08-28)
Bug Fixes
- $animate:
$animate.enabled(false)
should disable animations on $animateCss as well (c3d5e33e, #12696, #12685) - $animateCss:
- do not throw errors when a closing timeout is fired on a removed element (2f6b6fb7, #12650)
- fix parse errors on older Android WebViews (1cc9c9ca, #12610)
- properly handle cancellation timeouts for follow-up animations (d8816731, #12490, #12359)
- ensure failed animations clear the internal cache (0a75a3db, #12214, #12518, #12381)
- the transitions options delay value should be applied before class application (0c81e9fd, #12584)
- ngAnimate:
- ngModel: validate pattern against the viewValue (0e001084, #12344)
- ngResources: support IPv6 URLs (b643f0d3, #12512, #12532)
Breaking Changes
- ngModel: due to 0e001084,
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 guarantees 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);
};
}
};
}
};
});
1.3.18 collective-penmanship (2015-08-18)
Bug Fixes
1.4.4 pylon-requirement (2015-08-13)
Bug Fixes
- $animate:
- $animateCss: make sure that
skipBlocking
avoids the pre-emptive transition-delay styling (11695ca6) - $compile:
- $injector: Allows ES6 function syntax (44a96a4c, #12424, #12425)
- $location: don't crash if navigating outside the app base (9e492c35, #11667)
- $q: Use extend to avoid overwriting prototype (3abb3fef, #10697)
- $rootScope: don't clear phase if $apply is re-entered (e0cf496f, #12174)
- Angular: allow unescaped
=
signs in values inparseKeyValue
(f13852c1, #12351) - httpParamSerializerJQLike: Follow jQuery for index of arrays of objects (18a2e4fb)
- i18n: by default put negative sign before currency symbol (96f2e3be, #10158)
- injector: check that modulesToLoad isArray. (5abf593e, #12285)
- input: Firefox validation trigger (e7423168, #12102)
- merge: regExp should not be treated as a objects when merging. (a5221f32, #12419, #12409)
- ng/$locale: by default put negative sign before currency symbol (52986724, #10158)
- ngAnimate:
- always apply a preparation reflow for CSS-based animations (d33cedda, #12553, #12554, #12267, #12554)
- ensure that only string-based addClass/removeClass values are applied (0d6fc2dc, #12458, #12459)
- ensure that parent class-based animations are never closed by their children (32d3cbb3, #11975, #12276)
- allow animations on body and root elements (44ce9c82, #11956, #12245)
- $timeout without invokeApply (7db5f361, #12281, #12282)
- ngCsp: allow CSP to be configurable (618356e4, #11933, #8459, #12346)
- ngModel: correct minErr usage for correct doc creation (a268c29f, #12386, #12416)
- ngOptions: allow empty option selection with multiple attribute (c11a7d67, #12511, #12541)
- ngSanitize: escape the wide char quote marks in a regex in linky.js (39ff3332, #11609)
Features
- $animateCss: expose a core version of
$animateCss
(39b634e5, #12509) - $httpProvider: add 'useLegacyPromiseExtensions' configuration (a8f7e9cf, #12112, #10508)
- orderBy: Stable sort the input (ed3a33a0, #12408, #12405)
Performance Improvements
Breaking Changes
- ngAnimate: due to 32d3cbb3, CSS classes added/removed by ngAnimate are now applied synchronously once the first digest has passed.
The previous behavior involved ngAnimate having to wait for one
requestAnimationFrame before CSS classes were added/removed. The CSS classes
are now applied directly after the first digest that is triggered after
$animate.addClass
, $animate.removeClass
or $animate.setClass
is
called. If any of your code relies on waiting for one frame before
checking for CSS classes on the element then please change this
behavior. If a parent class-based animation, however, is run through a
JavaScript animation which triggers an animation for beforeAddClass
and/or beforeRemoveClass
then the CSS classes will not be applied
in time for the children (and the parent class-based animation will not
be cancelled by any child animations).
- $q due to 6838c979,
When writing tests, there is no need to call
$timeout.flush()
to resolve a call to$q.when
with a value.
The previous behavior involved creating an extra promise that needed to be resolved. This is no longer needed when
$q.when
is called with a value. In the case that the test is not aware if $q.when
is called with a value or
another promise, it is possible to replace $timeout.flush();
with $timeout.flush(0);
.
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 AngularJS 1.4.3 a call to `$timeout.flush();` was needed
$timeout.verifyNoPendingTasks();
}));
it('should accept $timeout.flush(0) when not sure if $q.when was called with a value or a promise',
inject(function($q, $timeout) {
$q.when('foo');
$timeout.flush(0);
$timeout.verifyNoPendingTasks();
}));
it('should need a call to $timeout.flush() to resolve $q.when when called with a promise',
inject(function($q, $timeout) {
$q.when($q.when('foo'));
$timeout.flush();
$timeout.verifyNoPendingTasks();
}));
});
-
form: Due to 94533e57, the
name
attribute ofform
elements can now only contain characters that can be evaluated as part of an Angular expression. This is because Angular uses the value ofname
as an assignable expression to set the form on the$scope
. For example,name="myForm"
assigns the form to$scope.myForm
andname="myObj.myForm"
assigns it to$scope.myObj.myForm
.Previously, it was possible to also use names such
name="my:name"
, because Angular used a special setter function for the form name. Now the general, more robust$parse
setter is used.The easiest way to migrate your code is therefore to remove all special characters from the
name
attribute.If you need to keep the special characters, you can use the following directive, which will replace the
name
with a value that can be evaluated as an expression in the compile function, and then re-set the original name in the postLink function. This ensures that (1), the form is published on the scope, and (2), the form has the original name, which might be important if you are doing server-side form submission.angular.module('myApp').directive('form', function() { return { restrict: 'E', priority: 1000, compile: function(element, attrs) { var unsupportedCharacter = ':'; // change accordingly var originalName = attrs.name; if (attrs.name && attrs.name.indexOf(unsupportedCharacter) > 0) { attrs.$set('name', 'this["' + originalName + '"]'); } return postLinkFunction(scope, element) { // Don't trigger $observers element.setAttribute('name', originalName); } } }; });
1.4.3 foam-acceleration (2015-07-15)
Bug Fixes
- $animateCss: ensure animations execute if only a keyframeStyle is provided (97d79eec, #12124, #12340)
- loader: define isFunction (9ea52d81)
- ngAnimate: ensure that orphaned elements do not throw errors when animated (e4aeae0c, #11975, #12338)
1.4.2 nebular-readjustment (2015-07-06)
Bug Fixes
- $browser: prevent infinite digest if changing hash when there is no hashPrefix (f81ff3be, #10423, #12145)
- $compile:
- $location: allow navigating outside the original base URL (6903b5ec, #11302, #4776)
- merge: treat dates as atomic values instead of objects. (6cbbd966, #11720, #11720)
- ngOptions: only watch numeric properties of an array (14638f4a)
- orderBy: ensure correct ordering with arrays of objects and no predicate (48e1f560, #11866, #11312, #4282)
Features
Breaking Changes
- ngInclude: due to 3c6e8ce044446735eb2e70d0061db8c6db050289, the
src
attribute of ngInclude no longer accepts an expression that returns the result of$sce.trustAsResourceUrl
. This will now cause an infinite digest:
Before:
<div ng-include="findTemplate('https://example.com/myTemplate.html')"></div>
$scope.findTemplate = function(templateName) {
return $sce.trustAsResourceUrl(templateName);
};
To migrate, either cache the result of trustAsResourceUrl()
, or put the template url in the resource
whitelist in the config()
function:
After:
var templateCache = {};
$scope.findTemplate = function(templateName) {
if (!templateCache[templateName]) {
templateCache[templateName] = $sce.trustAsResourceUrl(templateName);
}
return templateCache[templateName];
};
// Alternatively, use `$sceDelegateProvider.resourceUrlWhitelist()`:
angular.module('myApp', []).config(function($sceDelegateProvider) {
$sceDelegateProvider.resourceUrlWhitelist(['self', 'https://example.com/**'])
});
1.3.17 tsktskskly-euouae (2015-07-06)
Bug Fixes
- $browser: prevent infinite digest if changing hash when there is no hashPrefix (61a3fb67, #10423, #12145)
- $location:
- linky: allow case insensitive scheme detection (6b28aef1, #12073, #12074)
1.4.1 hyperionic-illumination (2015-06-16)
Bug Fixes
- $compile:
- $location: do not get caught in infinite digest in IE9 when redirecting in
$locationChangeSuccess
(91b60226, #11439, #11675, #11935, #12083) - $parse: set null reference properties to
undefined
(71fc3f4f, #12099) (d19504a1, #11959) - $sanitize: do not remove
tabindex
attribute (799353c7, #8371, #5853) - copy: do not copy the same object twice (0e622f7b)
- forms: parse exponential notation in
numberInputType
directive (ebd0fbba, #12121, #12122) - linky: allow case insensitive scheme detection (8dc09e6d, #12073, #12073)
- ngAria:
- ngModel: ignore Object.prototype properties on the form validation object (0934b76b, #12066)
- ngOptions:
Features
- $compile: show module name during
multidir
error (351fe4b7, #11775) - $q: $q.resolve as an alias for $q.when (3ef52980, #11944, #11987)
Performance Improvements
- $compile: avoid jquery data calls when there is no data (9efb0d5e)
1.3.16 cookie-oatmealification (2015-06-05)
Bug Fixes
- $compile: throw error on invalid directive name (634e4671, #11281, #11109)
- $cookies: update $cookies to prevent duplicate cookie writes and play nice with external code (706a93ab, #11490, #11515)
- $http: throw error if
success
anderror
methods do not receive a function (731e1f65, #11330, #11333) - core: ensure that multiple requests to requestAnimationFrame are buffered (0adc0364, #11791)
- filterFilter: fix matching against
null
/undefined
(9dd0fe35, #11573, #11617) - jqLite:
- ngAnimate:
- ngAria: handle elements with role="checkbox/menuitemcheckbox" (1c282af5, #11317, #11321)
- ngModel: allow setting model to NaN when asyncValidator is present (b64519fe, #11315, #11411)
- ngTouch:
- select: prevent unknown option being added to select when bound to null property (9e3f82bb, #11872, #11875)
Features
1.4.0 jaracimrman-existence (2015-05-26)
Bug Fixes
- $animate:
- $animateCss: ensure that custom durations do not confuse the gcs cache (e0e1b520, #11723, #11852)
- $http: do not modify the config object passed into $http short methods (f7a4b481)
- ngAnimate:
- close follow-up class-based animations when the same class is added/removed when removed/added (db246eb7, #11717)
- ensure nested class-based animations are spaced out with a RAF (213c2a70, #11812)
- class-based animations must not set addClass/removeClass CSS classes on the element (3a3db690, #11810)
- ensure that repeated structural calls during pre-digest function (2327f5a0, #11867)
- ensure that cancelled class-based animations are properly cleaned up (718ff844, #11652)
- throw an error if a callback is passed to animate methods (9bb4d6cc, #11826, #11713)
- ensure anchored animations remove the leave element at correct time (64c66d0e, #11850)
- select: prevent unknown option being added to select when bound to null property (4090491c, #11872, #11875)
Features
1.4.0-rc.2 rocket-zambonimation (2015-05-12)
Bug Fixes
- $compile: ensure directive names have no leading or trailing whitespace (bab474aa, #11397, #11772)
- $httpParamSerializerJQLike: follow jQuery logic for nested params (2420a0a7, #11551, #11635)
- jqLite: check for "length" in obj in isArrayLike to prevent iOS8 JIT bug from surfacing (426a5ac0, #11508)
- ngAnimate:
- ensure that multiple requests to requestAnimationFrame are buffered (db20b830, #11791)
- ensure that an object is always returned even when no animation is set to run (d5683d21)
- force use of
ng-anchor
instead of a suffixed-anchor
CSS class when triggering anchor animations (df24410c) - rename
ng-animate-anchor
tong-anchor
(e6d053de) - ensure that shared CSS classes between anchor nodes are retained (e0014002, #11681)
- prohibit usage of the
ng-animate
class with classNameFilter (1002b80a, #11431, #11807) - ensure that the temporary CSS classes are applied before detection (f7e9ff1a, #11769, #11804)
- ensure that all jqLite elements are deconstructed properly (64d05180, #11658)
- ensure animations are not attempted on text nodes (2aacc2d6, #11703)
- ensure JS animations recognize $animateCss directly (0681a540)
- ngClass: add/remove classes which are properties of Object.prototype (f7b99970, #11813, #11814)
- ngOptions:
- ngTouch:
Features
Breaking Changes
- ngAnimate - $animateCss: due to d5683d21, The $animateCss service will now always return an object even if the animation is not set to run. If your code is using $animateCss then please consider the following code change:
// before
var animator = $animateCss(element, { ... });
if (!animator) {
continueApp();
return;
}
var runner = animator.start();
runner.done(continueApp);
runner.then(continueApp);
// now
var animator = $animateCss(element, { ... });
var runner = animator.start();
runner.done(continueApp);
runner.then(continueApp);
- due to df24410c, Prior to this fix there were to ways to apply CSS animation code to an anchor animation. With this fix, the suffixed CSS -anchor classes are now not used anymore for CSS anchor animations.
Instead just use the ng-anchor
CSS class like so:
<div class="container-animation" ng-if="on">
<div ng-animate-ref="1" class="my-anchor-element"></div>
</div>
<div class="container-animation" ng-if="!on">
<div ng-animate-ref="1" class="my-anchor-element"></div>
</div>
before:
/* before (notice the container-animation CSS class) */
.container-animation-anchor {
transition:0.5s linear all;
}
now:
/* now (just use `ng-anchor` on a class that both the
elements that contain `ng-animate-ref` share) */
.my-anchor-element.ng-anchor {
transition:0.5s linear all;
}
-
due to e6d053de, if your CSS code made use of the
ng-animate-anchor
CSS class for referencing the anchored animation element then your code must now useng-anchor
instead. -
due to 1002b80a, partially or fully using a regex value containing
ng-animate
as a token is not allowed anymore. Doing so will trigger a minErr exception to be thrown.
So don't do this:
// only animate elements that contain the `ng-animate` CSS class
$animateProvider.classNameFilter(/ng-animate/);
// or partially contain it
$animateProvider.classNameFilter(/some-class ng-animate another-class/);
but this is OK:
$animateProvider.classNameFilter(/ng-animate-special/);
- ngOptions: due to dfa722a8,
Although it is unlikely that anyone is using it in this way, this change does change the
behavior of ngOptions
in the following case:
- you are iterating over an array-like object, using the array form of the
ngOptions
syntax (item.label for item in items
) and that object contains non-numeric property keys.
In this case these properties with non-numeric keys will be ignored.
** Here array-like is defined by the result of a call to this internal function: https://github.com/angular/angular.js/blob/v1.4.0-rc.1/src/Angular.js#L198-L211 **
To get the desired behavior you need to iterate using the object form of the ngOptions
syntax
(value.label
for (key, value) in items)`).
v1.4.0-rc.1 sartorial-chronography (2015-04-24)
Bug Fixes
- $animate:
- $animateCss: ensure that rAF waiting loop doesn't ignore pending items during a flush (90e424b2)
- $http: stop coercing falsy HTTP request bodies to null / empty body (e04a887c, #11552, #11593)
- ngAnimate:
- close parent animations only when there are classes to resolve (1459be17)
- ensure ngClass-based classes are always resolved for CSS-enabled animations (89f081e4)
- do not abort animation if only
ng-anchor-in
is used (3333a5c3) - ensure that a filtered-out leave animation always runs its DOM operation (6dd64ab5, #11555)
- ensure that animations work when the app is bootstrapped on the document node (bee14ed1, #11574)
- ensure SVG classes are properly removed (fa0bbded)
- ngAria: change accessibility keypress event to use event.which if it is provided (249f9b81, #11340)
- ngMessageFormat:
- select: allow empty option to be added dynamically by ng-repeat (abf59c28, #11470, #11512)
Features
- $animate: provide support for animations on elements outside of $rootElement (e41faaa2)
v1.4.0-rc.0 smooth-unwinding (2015-04-10)
Bug Fixes
- $compile:
- $http: throw error if
success
anderror
methods do not receive a function (1af563d4, #11330, #11333) - $parse: fix parse errors on older Android WebViews which choke with reserved keywords (10ae33b2, #11455)
- $rootScope: allow destroying a root scope (f8c8cf69, #11241, #10895)
- cookieReader: safely access $document so it can be mocked (a057e089, #11373, #11388)
- filterFilter: fix matching against
null
/undefined
(b5002ab6, #11432, #11445) - ngAnimate: ensure that minified repaint code isn't removed (c55a4944, #9936)
- ngAria: handle elements with role="checkbox/menuitemcheckbox" (44337f63, #11317, #11321)
- ngModel: allow setting model to NaN when asyncValidator is present (948120ec, #11315, #11411)
- ngTouch: register touches properly when jQuery is used (06a9f0a9, #4001, #8584, #10797, #11488)
- select: don't call $render twice if $viewValue ref changes (7e5c447f, #11329, #11412)
Features
- $anchorScroll: allow scrolling to a specified element (731c8b5e, #4568, #9596)
- $animate: complete refactor of internal animation code (c8700f04)
- $http: support custom params serializers (6c8464ad, #3740, #7429, #9224, #11461)
- $interpolate: extend interpolation with MessageFormat like syntax (1e58488a, #11152)
- angular.Module: add
decorator
method (e57138d7, #11305, #11300) - ngClass: add support for conditional map within an array. (4588e627, #4807)
- travis: run unit tests on iOS 8 (2cdb2016, #11479)
Performance Improvements
- $rootScope: remove history event handler when app is torn down (d996305b, #9897, #9905)
- benchmark: add ngmodel benchmarks to largetable-bp (b8dbdb0c, #11082)
- ngOptions: only perform deep equality check on ngModel if using track by (171b9f7f, #11448, #11447)
Breaking Changes
-
$animate: due to c8700f04, JavaScript and CSS animations can no longer be run in parallel. With earlier versions of ngAnimate, both CSS and JS animations would be run together when multiple animations were detected. This feature has now been removed, however, the same effect, with even more possibilities, can be achieved by injecting
$animateCss
into a JavaScript-defined animation and creating custom CSS-based animations from there. Read the ngAnimate docs for more info. -
$animate: due to c8700f04, The function params for
$animate.enabled()
when an element is used are now flipped. This fix allows the function to act as a getter when a single element param is provided.
// < 1.4
$animate.enabled(false, element);
// 1.4+
$animate.enabled(element, false);
-
$animate: due to c8700f04, In addition to disabling the children of the element,
$animate.enabled(element, false)
will now also disable animations on the element itself. -
$animate: due to c8700f04, Animation-related callbacks are now fired on
$animate.on
instead of directly being on the element.
// < 1.4
element.on('$animate:before', function(e, data) {
if (data.event === 'enter') { ... }
});
element.off('$animate:before', fn);
// 1.4+
$animate.on(element, 'enter', function(data) {
//...
});
$animate.off(element, 'enter', fn);
- $animate: due to c8700f04,
There is no need to call
$scope.$apply
or$scope.$digest
inside of an animation promise callback anymore since the promise is resolved within a digest automatically (but a digest is not run unless the promise is chained).
// < 1.4
$animate.enter(element).then(function() {
$scope.$apply(function() {
$scope.explode = true;
});
});
// 1.4+
$animate.enter(element).then(function() {
$scope.explode = true;
});
- $animate: due to c8700f04, When an enter, leave or move animation is triggered then it will always end any pending or active parent class based animations (animations triggered via ngClass) in order to ensure that any CSS styles are resolved in time.
1.4.0-beta.6 cookie-liberation (2015-03-17)
Bug Fixes
- $animate: call
applyStyles
from options onleave
(4374f892, #10068) - $browser: don't crash if
history.state
access causes error in IE (3b8163b7, #10367, #10369) - $sanitize: disallow unsafe svg animation tags (67688d5c, #11290)
- Angular: properly compare RegExp with other objects for equality (f22e1fc9, #11204, #11205)
- date filter: display localized era for
G
format codes (2b4dfa9e, #10503, #11266) - filterFilter:
- form: allow dynamic form names which initially evaluate to blank (410f7c68)
- jqLite: attr should ignore comment, text and attribute nodes (bb5bf7f8)
- ng/$locale: add ERA info in generic locale (4acb0af2)
- ngJq: don't rely on existence of jqlite (342e5f3c, #11044)
- ngMessages: ensure that multi-level transclusion works with
ngMessagesInclude
(d7ec5f39, #11196) - ngOptions: fix model<->option interaction when using
track by
(6a03ca27, #10869, #10893) - rootScope: prevent memory leak when destroying scopes (fb7db4a0, #11173, #11169)
Features
- $cookies:
- $cookiesProvider: provide path, domain, expires and secure options (53c66369)
- $interval: pass additional arguments to the callback (4f1f9cfd, #10632)
- $timeout: pass additional arguments to the callback (3a4b6b83, #10631)
- angular.merge: provide an alternative to
angular.extend
that merges 'deeply' (c0498d45, #10507, #10519) - filterFilter: compare object with custom
toString()
to primitive (f8c42161, #10464, #10548) - ngAria:
- ngLocale: Add FIRSTDAYOFWEEK and WEEKENDRANGE from google data (3d149c7f)
- ngMock:
- ngModel: support conversion to timezone other than UTC (0413bee8, #11005)
Breaking Changes
- $cookies: due to 38fbe3ee,
$cookies
no longer exposes properties that represent the current browser cookie
values. Now you must explicitly the methods described above to access the cookie
values. This also means that you can no longer watch the $cookies
properties for
changes to the browser's cookies.
This feature is generally only needed if a 3rd party library was programmatically changing the cookies at runtime. If you rely on this then you must either write code that can react to the 3rd party library making the changes to cookies or implement your own polling mechanism.
1.3.15 locality-filtration (2015-03-17)
Bug Fixes
- $animate: call
applyStyles
with options onleave
(ebd84e80, #10068) - $browser: don't crash if history.state access causes error in IE (92767c09, #10367, #10369)
- Angular: properly compare RegExp with other objects for equality (b8e8f9af, #11204, #11205)
- date filter: display localized era for
G
format codes (f2683f95, #10503, #11266) - filterFilter:
- form: allow dynamic form names which initially evaluate to blank (190ea883, #11096)
- ng/$locale: add ERA info in generic locale (57842530)
- rootScope: prevent memory leak when destroying scopes (528cf09e, #11173, #11169)
- templateRequest: avoid throwing syntax error in Android 2.3 (75abbd52, #11089, #11051, #11088)
Features
- ngAria:
- ngMock:
1.4.0-beta.5 karmic-stabilization (2015-02-24)
Bug Fixes
- $http: properly access request headers with mixed case (5da1256f, #10881, #10883)
- input: create max and/or min validator regardless of initial value (c211e7a5, #10307, #10327)
- ngAria: correctly set "checked" attr for checkboxes and radios (d6eba217, #10389, #10212)
- ngModel: fix issues when parserName is same as validator key (056a3170, #10698, #10850, #11046)
- ngOptions: ngModel is optional (ef894c87)
- ngSanitize: Do not ignore white-listed svg camelCased attributes (46b80654, #10779, #10990, #11124)
- select: remove unknown option when model is undefined and empty option is available (30b48132, #11078, #11092)
- templateRequest: avoid throwing syntax error in Android 2.3 (f6272333, #11089, #11051, #11088)
Features
-
CommonJS: - angular modules are now packaged for npm with helpful exports
-
limitTo: extend the filter to take a beginning index argument (aaae3cc4, #5355, #10899)
-
ngMessages: provide support for dynamic message resolution (c9a4421f, #10036, #9338)
-
ngOptions: add support for disabling an option (da9eac86, #638, #11017)
Performance Improvements
- $compile:
- ngOptions: only watch labels if a display expression is specified (51faaffd)
Breaking Changes
- ngMessages: due to c9a4421f,
The ngMessagesInclude
attribute is now its own directive and that must
be placed as a child element within the element with the ngMessages
directive. (Keep in mind that the former behavior of the
ngMessageInclude attribute was that all included ngMessage template
code was placed at the bottom of the element containing the
ngMessages directive; therefore to make this behave in the same way,
place the element containing the ngMessagesInclude directive at the
end of the container containing the ngMessages directive).
<!-- AngularJS 1.3.x -->
<div ng-messages="model.$error" ng-messages-include="remote.html">
<div ng-message="required">Your message is required</div>
</div>
<!-- AngularJS 1.4.x -->
<div ng-messages="model.$error">
<div ng-message="required">Your message is required</div>
<div ng-messages-include="remote.html"></div>
</div>
- ngMessages: due to c9a4421f,
it is no longer possible to use interpolation inside the ngMessages
attribute expression. This technique
is generally not recommended, and can easily break when a directive implementation changes. In cases
where a simple expression is not possible, you can delegate accessing the object to a function:
<div ng-messages="ctrl.form['field_{{$index}}'].$error">...</div>
would become
<div ng-messages="ctrl.getMessages($index)">...</div>
where ctrl.getMessages()
ctrl.getMessages = function($index) {
return ctrl.form['field_' + $index].$error;
}
- $http: due to 5da1256,
transformRequest
functions can no longer modify request headers.
Before this commit transformRequest
could modify request headers, ex.:
function requestTransform(data, headers) {
headers = angular.extend(headers(), {
'X-MY_HEADER': 'abcd'
});
}
return angular.toJson(data);
}
This behavior was unintended and undocumented, so the change should affect very few applications. If one needs to dynamically add / remove headers it should be done in a header function, for example:
$http.get(url, {
headers: {
'X-MY_HEADER': function(config) {
return 'abcd'; //you've got access to a request config object to specify header value dynamically
}
}
})
1.3.14 instantaneous-browserification (2015-02-24)
Features
- CommonJS: - angular modules are now packaged for npm with helpful exports
Bug Fixes
- input: create max and/or min validator regardless of initial value (abfce532, #10307, #10327)
- ngAria: correctly set "checked" attr for checkboxes and radios (944c150e, #10389, #10212)
- ngModel: fix issues when parserName is same as validator key (6b7625a0, #10698, #10850, #11046)
1.4.0-beta.4 overlyexplosive-poprocks (2015-02-09)
Bug Fixes
- $location: prevent page reload if initial url has empty hash at the end (a509e9aa, #10397, #10960)
- $parse: Initialize elements in an array from left to right (966f6d83)
- ngAria: ensure native controls fire a single click (9d53e5a3, #10388, #10766)
- ngMock: handle cases where injector is created before tests (898714df, #10967)
- sanitize: handle newline characters inside special tags (cc8755cd, 030a42e7 #10943)
Features
- ng-jq: adds the ability to force jqLite or a specific jQuery version (09ee82d8)
1.3.13 meticulous-riffleshuffle (2015-02-09)
Bug Fixes
- $location: prevent page reload if initial url has empty hash at the end (4b3a590b, #10397, #10960)
- ngAria: ensure native controls fire a single click (69ee593f, #10388, #10766)
- ngMock: handle cases where injector is created before tests (39ddef68, #10967)
- sanitize: handle newline characters inside special tags (11aedbd7, ce49d4d6 #10943)
1.4.0-beta.3 substance-mimicry (2015-02-02)
Bug Fixes
- $compile:
- $controller: throw better error when controller expression is bad (dda65e99, #10875, #10910)
- $parse:
- a: don't reload if there is only a name attribute (d729fcf0, #6273, #10880)
- angular.copy: support copying
TypedArray
s (aa0f6449, #10745) - filter: format timezone correctly in the case that UTC timezone is used (8c469191, #9359)
- ngRoute: don't duplicate optional params into query (27bf2ce4, #10689)
- ngScenario: allow ngScenario to handle lazy-loaded and manually bootstrapped applications (c69caa7b, #10723)
- validators: maxlength should use viewValue for $isEmpty (bfcf9946, #10898)
Features
- $compile: allow using bindToController as object, support both new/isolate scopes (35498d70, #10420, #10467)
- filter: support conversion to timezone other than UTC (c6d8512a, #10858)
- ngMocks: cleanup $inject annotations after each test (0baa17a3)
Performance Improvements
- $scope: Add a property $$watchersCount to scope (c1500ea7)
- $parse new and more performant parser (0d42426)
Breaking Changes
- $compile: due to 6a38dbfd, Previously, '&' expressions would always set up a function in the isolate scope. Now, if the binding is marked as optional and the attribute is not specified, no function will be added to the isolate scope.
1.3.12 outlandish-knitting (2015-02-02)
Bug Fixes
- $controller: throw better error when controller expression is bad (632b2ddd, #10875, #10910)
- $parse: remove references to last arguments to a fn call (7caad220, #10894)
- ngRoute: don't duplicate optional params into query (f41ca4a5, #10689)
- ngScenario: Allow ngScenario to handle lazy-loaded and manually bootstrapped applications (0bcd0872, #10723)
- validators: maxlength should use viewValue for $isEmpty (abd8e2a9, #10898)
Features
- ngMocks: cleanup $inject annotations after each test (6ec59460)
1.4.0-beta.2 holographic-rooster (2015-01-26)
Bug Fixes
- $location: don't rewrite when link is shift-clicked (8b33de6f, #9904, #9906)
- $templateRequest: cache downloaded templates as strings (b3a9bd3a, #10630, #10646)
- filterFilter: throw error if input is not an array (cea8e751, #9992, #10352)
- htmlAnchorDirective:
- ngPluralize: fix wrong text content when count is null/undefined (3228d3b4, #10836, #10841)
Breaking Changes
- filterFilter: due to cea8e751, Previously, the filter was not applied if used with a non array. Now, it throws an error. This can be worked around by converting an object to an array, using a filter such as https://github.com/petebacondarwin/angular-toArrayFilter
Closes #9992 Closes #10352
1.3.11 spiffy-manatee (2015-01-26)
Bug Fixes
1.4.0-beta.1 trepidatious-salamander (2015-01-20)
Bug Fixes
- $animate: ensure no transitions are applied when an empty inline style object is provided (0db5b21b, #10613, #10770)
- $compile: support class directives on SVG elements (23c8a90d, #10736, #10756)
- form: clean up success state of controls when they are removed (2408f2de, #10509)
- ngController: allow bound constructor fns as controllers (d17fbc38, #10784, #10790)
- ngRepeat: do not sort object keys alphabetically (c260e738, #6210, #10538)
Features
Breaking Changes
- ngRepeat: due to c260e738,
Previously, the order of items when using ngRepeat to iterate over object properties was guaranteed to be consistent by sorting the keys into alphabetic order.
Now, the order of the items is browser dependent based on the order returned
from iterating over the object using the for key in obj
syntax.
It seems that browsers generally follow the strategy of providing keys in the order in which they were defined, although there are exceptions when keys are deleted and reinstated. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete#Cross-browser_issues
The best approach is to convert Objects into Arrays by a filter such as https://github.com/petebacondarwin/angular-toArrayFilter or some other mechanism, and then sort them manually in the order you need.
Closes #6210 Closes #10538
1.3.10 heliotropic-sundial (2015-01-20)
Bug Fixes
- $animate: ensure no transitions are applied when an empty inline style object is provided (9b8df52a, #10613, #10770)
- $compile: support class directives on SVG elements (7a9e3360, #10736, #10756)
- form: clean up success state of controls when they are removed (cdc7280d, #10509)
- ngController: allow bound constructor fns as controllers (d015c8a8, #10784, #10790)
1.4.0-beta.0 photonic-umbrakinesis (2015-01-13)
Bug Fixes
- $location: support right button click on anchors in firefox (aa798f12, #7984)
- $templateRequest: propagate HTTP status on failed requests (e24f22bd, #10514, #10628)
- dateFilter: ignore invalid dates (1334b8c8, #10640)
- filterFilter: use isArray() to determine array type (a01ce6b8, #10621)
- ngChecked: ensure that ngChecked doesn't interfere with ngModel (e079111b, #10662, #10664)
- ngClass: handle multi-class definitions as an element of an array (e1132f53, #8578, #10651)
- ngModelOptions: allow sharing options between multiple inputs (9c9c6b3f, #10667)
- ngOptions:
- support one-time binding on the option values (ba90261b, #10687, #10694)
- prevent infinite digest if track by expression is stable (fc21db8a, #9464)
- update model if selected option is removed (933591d6, #7736)
- ensure that the correct option is selected when options are loaded async (7fda214c, #8019, #9714, #10639)
- ngPluralize: generate a warning when using a not defined rule (c66b4b6a)
Features
- $filter: display Infinity symbol when number is Infinity (51d67742, #10421)
- $timeout: allow
fn
to be an optional parameter (5a603023, #9176) - limitTo: ignore limit when invalid (a3c3bf33, #10510)
- ngMock/$exceptionHandler: log errors when rethrowing (deb3cb4d, #10540, #10564)
Performance Improvements
Breaking Changes
-
limitTo: due to a3c3bf33, limitTo changed behavior when limit value is invalid. Instead of returning empty object/array it returns unchanged input.
-
ngOptions: due to 7fda214c,
When using ngOptions
: the directive applies a surrogate key as the value of the <option>
element.
This commit changes the actual string used as the surrogate key. We now store a string that is computed
by calling hashKey
on the item in the options collection; previously it was the index or key of the
item in the collection.
(This is in keeping with the way that the unknown option value is represented in the select directive.)
Before you might have seen:
<select ng-model="x" ng-option="i in items">
<option value="1">a</option>
<option value="2">b</option>
<option value="3">c</option>
<option value="4">d</option>
</select>
Now it will be something like:
<select ng-model="x" ng-option="i in items">
<option value="string:a">a</option>
<option value="string:b">b</option>
<option value="string:c">c</option>
<option value="string:d">d</option>
</select>
If your application code relied on this value, which it shouldn't, then you will need to modify your
application to accommodate this. You may find that you can use the track by
feature of ngOptions
as this provides the ability to specify the key that is stored.
- ngOptions: due to 7fda214c,
When iterating over an object's properties using the (key, value) in obj
syntax
the order of the elements used to be sorted alphabetically. This was an artificial
attempt to create a deterministic ordering since browsers don't guarantee the order.
But in practice this is not what people want and so this change iterates over properties
in the order they are returned by Object.keys(obj), which is almost always the order
in which the properties were defined.
- ngOptions: due to 7fda214c,
setting the ngOptions attribute expression after the element is compiled, will no longer trigger the ngOptions behavior. This worked previously because the ngOptions logic was part of the select directive, while it is now implemented in the ngOptions directive itself.
- select: due to 7fda214c,
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 AngularJS 1.3.x, setting scope.x = 200
would select the option
with the value 200 in the following select
:
<select ng-model="x">
<option value="100">100</option>
<option value="200">200</option>
</select>
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
:
ngModelCtrl.$parsers.push(function(value) {
return parseInt(value, 10); // Convert option value to number
});
ngModelCtrl.$formatters.push(function(value) {
return value.toString(); // Convert scope value to string
});
1.3.9 multidimensional-awareness (2015-01-13)
Bug Fixes
- $parse: allow use of locals in assignments (86900814)
- filterFilter: use isArray() to determine array type (d4b60ada, #10621)
Features
Performance Improvements
1.3.8 prophetic-narwhal (2014-12-19)
Bug Fixes
- filterFilter:
- ngAria: trigger digest on
ng-click
via keypress, pass$event
to expression (924e68c7, #10442, #10443, #10447) - orderBy: compare timestamps when sorting date objects (661f6d9e, #10512, #10516)
Performance Improvements
- limitTo: replace for loop with slice (cd77c089)
1.3.7 leaky-obstruction (2014-12-15)
Bug Fixes
- $compile: use
createMap()
for$$observe
listeners when initialized from attr interpolation (8e28bb4c) - $http:
- $parse: a chain of field accessors should use a single
getterFn
(c90ad968) - ngRepeat: allow extra whitespaces in
(key,value)
part of micro-syntax (ef640cbc, #6827, #6833) - orderBy: do not try to call
valueOf
/toString
onnull
(a097aa95, #10385, #10386)
Features
- $compile: add support for
ng-attr
with camelCased attributes (d8e37078, #9845, #10194) - $http: pass response status code to data transform functions (1b740974, #10324, #6734, #10440)
- $rootScope: allow passing
locals
argument to$evalAsync
(9b96cea4, #10390)
Performance Improvements
- $compile: only re-
$interpolate
attribute values at link time if changed since compile (9ae0c01c)
Breaking Changes
- orderBy: due to a097aa95,
Previously, if either value being compared in the orderBy comparator was null or undefined, the
order would, incorrectly, not change. Now, this order behaves more like Array.prototype.sort, which
by default pushes null
behind objects, due to n
occurring after [
(the first characters of their
stringified forms) in ASCII / Unicode. If toString
is customized, or does not exist, the
behavior is undefined.
1.2.28 finnish-disembarkation (2014-12-15)
Bug Fixes
- $route: fix redirection with optional/eager params (1b9e408d, #9742, #10202)
- linky: encode double quotes when serializing email addresses (929dd15b, #8945, #8964, #5946, #10090, #9256)
1.3.6 robofunky-danceblaster (2014-12-08)
Bug Fixes
- $browser: prevent infinite digests when clearing the hash of a url (10ac5948, #9629, #9635, #10228, #10308)
- $http: preserve config object when resolving from cache (facfec98, #9004, #9030)
- $location:
- $parse:
- filterFilter:
- inputs: ignoring input events in IE caused by placeholder changes or focus/blur on inputs with placeholders (55d9db56, #9265)
- linky: make urls starting with www. links, like markdown (915a891a, #10290)
- ngAnimate: do not use jQuery class API (40a537c2, #10024, #10329)
- ngMock: allow numeric timeouts in $httpBackend mock (acb066e8, #4891)
- ngModel:
- ngSanitize: exclude smart quotes at the end of the link (7c6be43e, #7307)
- numberFilter: numbers rounding to zero shouldn't be negative (96c61fe7, #10278)
- orderBy:
Features
- $$jqLite: export jqLite as a private service (f2e7f875)
- $injector: print caller name in "unknown provider" errors (when available) (013b522c, #8135, #9721)
- jsonFilter: add optional arg to define custom indentation (1191edba, #9771)
- ngAria: bind keypress on ng-click w/ option (5481e2cf, #10288)
Breaking Changes
- $location: due to 2dc34a96,
We no longer throw an ihshprfx
error if the URL after the base path
contains only a hash fragment. Previously, if the base URL was http://abc.com/base/
and the hashPrefix is !
then trying to parse http://abc.com/base/#some-fragment
would have thrown an error. Now we simply assume it is a normal fragment and
that the path is empty, resulting $location.absUrl() === "http://abc.com/base/#!/#some-fragment"
.
This should not break any applications, but you can no longer rely on receiving the
ihshprfx
error for paths that have the syntax above. It is actually more similar
to what currently happens for invalid extra paths anyway: If the base URL
and hashPrfix are set up as above, then http://abc.com/base/other/path
does not
throw an error but just ignores the extra path: http://abc.com/base
.
-
filterFilter: due to a75537d4,
Named properties in the expression object will only match against properties on the same level. Previously, named string properties would match against properties on the same level or deeper.
Before:
arr = filterFilter([{level1: {level2: 'test'}}], {level1: 'test'}); // arr.length -> 1
After:
arr = filterFilter([{level1: {level2: 'test'}}], {level1: 'test'}); // arr.length -> 0
In order to match deeper nested properties, you have to either match the depth level of the property or use the special
$
key (which still matches properties on the same level or deeper). E.g.:// Both examples below have `arr.length === 1` arr = filterFilter([{level1: {level2: 'test'}}], {level1: {level2: 'test'}}); arr = filterFilter([{level1: {level2: 'test'}}], {$: 'test'});
1.3.5 cybernetic-mercantilism (2014-12-01)
Bug Fixes
- $templateRequest: propagate rejection reason when ignoreRequestError flag is set (f6458826, #10266)
- $httpBackend: allow canceling request with falsy timeoutId (719d5c5f, #10177)
- linky: encode all double quotes when serializing email addresses (2ec8d1ff, #10090)
- ngMock:
- select:
1.3.4 highfalutin-petroglyph (2014-11-24)
Bug Fixes
- $browser: allow chaining url() calls in setter mode (764fa869, #10157)
- $http: return empty headers, ignore properties in Object prototype (637c020f, #7779, #10113, #10091)
- $locale: Allow currency filter to fall back to maxFrac from locale (6dbd606a, #10179)
- $location: allow empty string URLs to reset path, search, and hash (7812dfce, #10063, #10064)
- $route: fix redirection with optional/eager params (891acf4c, #9819, #9827)
- Angular: properly get node name for svg element wrapper (09a98323, #10078, #10172)
- NgModelController: typo $rawModelValue -> $$rawModelValue (4f4ff5f3)
- input:
- inputdate: do not use
$isEmpty
to check the model validity (40406e2f) - linky: encode double quotes when serializing email addresses (8ee8ffeb, #8945, #8964, #5946, #10090, #9256)
- ngMaxlength: ignore maxlength when not set to a non-negative integer (92f87b11, #9874)
- ngModel: don't run parsers when executing $validate (e3764e30)
- ngModelOptions: preserve context of getter/setters (bb4d3b73, #9394, #9865)
Features
- ngMaxlength: add support for disabling max length limit (5c1fdff6, #9995)
- ngModelController: add $setDirty method (e8941c0f, #10038, #10049)
- ngPluralize: add support for
count
to be a one-time expression (2b41a586, #10004)
Performance Improvements
Breaking Changes
- ngModelOptions: due to bb4d3b73, previously, ngModel invoked getter/setters in the global context.
For example:
<input ng-model="model.value" ng-model-options="{ getterSetter: true }">
would previously invoke model.value()
in the global context.
Now, ngModel invokes value
with model
as the context.
It's unlikely that real apps relied on this behavior. If they did they can use .bind
to explicitly
bind a getter/getter to the global context, or just reference globals normally without this
.
1.2.27 prime-factorization (2014-11-20)
Bug Fixes
- $animate: clear the GCS cache even when no animation is detected (f619d032, #8813)
- $browser:
- $http: add missing shortcut methods and missing docs (ec4fe1bc, #9180, #9321)
- $location:
- $parse: add quick check for Function constructor in fast path (756640f5)
- $parse, events: prevent accidental misuse of properties on $event (4d0614fd, #9969)
- ngMock: $httpBackend should match data containing Date objects correctly (1426b029, #5127)
- orderBy: sort by identity if no predicate is given (45b896a1, #5847, #4579, #9403)
- select: ensure the label attribute is updated in Internet Explorer (16833d0f, #9621, #10042)
Performance Improvements
1.3.3 undersea-arithmetic (2014-11-17)
Bug Fixes
- $http: don't parse single space responses as JSON (6f19a6fd, #9907)
- minErr: stringify non-JSON compatible objects in error messages (cf43ccdf, #10085)
- $rootScope: handle cyclic references in scopes when creating error messages (e80053d9, #10085)
- ngRepeat: support cyclic object references in error messages (fa12c3c8, #9838, #10065, #10085)
- ngMock: call $interval callbacks even when invokeApply is false (d81ff888, #10032)
- ngPattern: match behavior of native HTML pattern attribute (85eb9660, #9881, #9888)
- select: ensure the label attribute is updated in Internet Explorer (6604c236, #9621, #10042)
Features
- $location: allow to location to be changed during $locationChangeStart (a9352c19, #9607, #9678)
- $routeProvider: allow setting caseInsensitiveMatch on the provider (0db573b7, #6477, #9873)
Performance Improvements
Breaking Changes
- $parse: due to fbad2805,
you can't use characters that have special meaning in AngularJS expressions (ex.:
.
or-
) as part of filter's name. Before this commit custom filters could contain special characters (like a dot) in their name but this wasn't intentional.
1.3.2 cardiovasculatory-magnification (2014-11-07)
Bug Fixes
- $compile: do not rebind parent bound transclude functions (841c0907, #9413)
- $parse:
- $parse, events: prevent accidental misuse of properties on $event (e057a9aa)
- ngRoute: allow proto inherited properties in route params object (b4770582, #8181, #9731)
- select: use strict comparison for isSelected with selectAs (9e305948, #9639, #9949)
Features
- ngAria: announce ngMessages with aria-live (187e4318, #9834)
- ngMock: decorator that adds Scope#$countChildScopes and Scope#$countWatchers (74981c9f, #9926, #9871)
Security Note
This release also contains security fixes for expression sandbox bypasses.
These issues affect only applications with known server-side XSS holes that are also using CSP to secure their client-side code. If your application falls into this rare category, we recommend updating your version of Angular.
We'd like to thank security researches Sebastian Lekies, Jann Horn, and Gábor Molnár for reporting these issues to us.
We also added a documentation page focused on security, which contains some of the best practices, DOs and DON'Ts. Please check out https://docs.angularjs.org/guide/security.
1.3.1 spectral-lobster (2014-10-31)
Bug Fixes
- $compile: returning null when an optional controller is not found (2cd5b4ec, #9404, #9392)
- $observe: check if the attribute is undefined (531a8de7, #9707, #9720)
- $parse: support dirty-checking objects with null prototype (28661d1a, #9568)
- $sce: use msie instead of $document[0].documentMode (45252c3a, #9661)
- $templateRequest: ignore JSON Content-Type header and content (1bd473eb, #5756, #9619)
- i18n: rename datetimeSymbols to be camelCase (94f5a285)
- loader: fix double spaces (8b2f1a47, #9630)
- ngMock: $httpBackend should match data containing Date objects correctly (1025f6eb, #5127)
- ngSanitize: attribute name: xmlns:href -> xlink:href (4cccf0f2, #9769)
- select: assign result of track exp to element value (4b4098bf, #9718, #9592)
- templateRequest: allow empty html template (52ceec22, #9581)
- testability: escape regex chars in
findBindings
if usingexactMatch
(02aa4f4b, #9595, #9600)
Features
- $compile: allow $watchCollection to be used in bi-directional bindings (40bbc981, #9725)
- ngSanitize: accept SVG elements and attributes (a54b25d7, #9578, #9751)
Breaking Changes
- $observe: Due to 531a8de7,
observers no longer register on undefined attributes. For example, if you were using
$observe
on an absent optional attribute to set a default value, the following would not work anymore:
<my-dir></my-dir>
// link function for directive myDir
link: function(scope, element, attr) {
attr.$observe('myAttr', function(newVal) {
scope.myValue = newVal ? newVal : 'myDefaultValue';
})
}
Instead, check if the attribute is set before registering the observer:
link: function(scope, element, attr) {
if (attr.myAttr) {
// register the observer
} else {
// set the default
}
}
1.3.0 superluminal-nudge (2014-10-13)
Bug Fixes
- $browser:
- $http:
- $injector: ensure $get method invoked with provider context (372fa699, #9511, #9512)
- $location: use clone of passed search() object (c7a9009e, #9445)
- $parse: stabilize one-time literal expressions correctly (874cac82)
- formController: remove scope reference when form is destroyed (01f50e1a, #9315)
- jqLite: remove native listener when all jqLite listeners were deregistered (d71fb6f2, #9509)
- select:
Features
- $anchorScroll: support a configurable vertical scroll offset (09c39d2c, #9368, #2070, #9360)
- $animate:
- currencyFilter: add fractionSize as optional parameter (20685ffe, #3642, #3461, #3642, #7922)
- jqLite: add private jqLiteDocumentLoaded function (0dd316ef)
Breaking Changes
- $animate: due to e5f4d7b1,
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 behavior 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.
1.3.0-rc.5 impossible-choreography (2014-10-08)
Bug Fixes
- $anchorScroll: don't scroll to top when initializing and location hash is empty (d5445c60, #8848, #9393)
- $animate:
- ensure hidden elements with ngShow/ngHide stay hidden during animations (39d0b368, #9103, #9493)
- permit class-based animations for leave operations if ngAnimateChildren is enabled (df1a00b1, #8092, #9491)
- ensure that class-based animations only consider the most recent DOM operations (c93924ed, #8946, #9458)
- abort class-based animations if the element is removed during digest (613d0a32, #8796)
- clear the GCS cache even when no animation is detected (cb85cbce, #8813)
- $browser:
- $compile:
- $http: honor application/json response header and parse json primitives (7b6c1d08, #2973)
- $injector: throw when factory $get method does not return a value (0d3b69a5, #4575, #9210)
- $location: allow
0
inpath()
andhash()
(b8c5b871) - form: fix submit prevention (86c7d122, #3370, #3776)
- ngAnimate: defer DOM operations for changing classes to postDigest (667183a8, #8234, #9263)
- orderBy: sort by identity if no predicate is given (607f016a, #5847, #4579, #9403)
- select:
Features
Performance Improvements
Breaking Changes
- $compile: due to feba0174,
If a template contains directives within comment nodes, and there is more than a single node in the template, those comment nodes are removed. The impact of this breaking change is expected to be quite low.
Closes #9212 Closes #9215
- ngAnimate: due to 667183a8,
The $animate
CSS class API will always defer changes until the end of the next digest. This allows ngAnimate
to coalesce class changes which occur over a short period of time into 1 or 2 DOM writes, rather than
many. This prevents jank in browsers such as IE, and is generally a good thing.
If you find that your classes are not being immediately applied, be sure to invoke $digest()
.
Closes #8234 Closes #9263
- $select: due to 30996f8
ngOptions
will now throw an error when the comprehension expressions contains both a select as
and track by
expression.
These expressions are fundamentally incompatible because it is not possible to reliably and
consistently determine the parent object of a model, since select as
can assign any child of a
value
as the model value.
Prior to refactorings in this release, neither of these expressions worked correctly independently, and did not work at all when combined.
See #6564
- $route: due to f4ff11b0,
Order of events has changed.
Previously: $locationChangeStart
-> $locationChangeSuccess
-> $routeChangeStart
-> $routeChangeSuccess
Now: $locationChangeStart
-> $routeChangeStart
-> $locationChangeSuccess
-> -> $routeChangeSuccess
Fixes #5581 Closes #5714 Closes #9502
1.3.0-rc.4 unicorn-hydrafication (2014-10-01)
Bug Fixes
- $compile:
- input:
- ngModel: do not parse undefined viewValue when validating (92f05e5a, #9106, #9260)
- ngView: use animation promises ensure that only one leave animation occurs at a time (3624e380, #9355, #7606, #9374)
- select: make ctrl.hasOption method consistent (2bcd02dc, #8761)
Features
- $compile: optionally get controllers from ancestors only (07e3abc7, #4518, #4540, #8240, #8511)
- Scope: allow the parent of a new scope to be specified on creation (6417a3e9)
Performance Improvements
- $rootScope: moving internal queues out of the Scope instances (b1192518, #9071)
- benchmark: add ngBindOnce benchmarks to largetable-bp (2c8b4648)
- ngForm,ngModel: move initial addClass to the compile phase (b1ee5386, #8268)
Breaking Changes
- $compile: due to fb0c77f0,
$transclude
functions no longer attach $destroy
event handlers to the
transcluded content, and so the associated transclude scope will not automatically
be destroyed if you remove a transcluded element from the DOM using direct DOM
manipulation such as the jquery remove()
method.
If you want to explicitly remove DOM elements inside your directive that have been compiled, and so potentially contain child (and transcluded) scopes, then it is your responsibility to get hold of the scope and destroy it at the same time.
The suggested approach is to create a new child scope of your own around any DOM elements that you wish to manipulate in this way and destroy those scopes if you remove their contents - any child scopes will then be destroyed and cleaned up automatically.
Note that all the built-in directives that manipulate the DOM (ngIf, ngRepeat, ngSwitch, etc) already follow this best practice, so if you only use these for manipulating the DOM then you do not have to worry about this change.
Closes #9095 Closes #9281
-
$parse: due to 5572b40b,
-
$scope['this'] no longer exits on the $scope object
-
$parse-ed expressions no longer allow chaining 'this' such as this['this'] or $parent['this']
-
'this' in $parse-ed expressions can no longer be overridden, if a variable named 'this' is put on the scope it must be accessed using this['this']
Closes #9105
- input: due to 1eda1836,
(Note: this change landed in 1.3.0-rc.3, but was not considered a breaking change at the time).
For text based inputs (text, email, url), the $viewValue
will now always be converted to a string,
regardless of what type the value is on the model.
To migrate, any code or expressions that expect the $viewValue
to be anything other than string
should be updated to expect a string.
- input: due to a0bfdd0d60882125f614a91c321f12f730735e7b (see #8949),
Similar to input[number]
Angular will now throw if the model value
for a input[date]
is not a Date
object. Previously, Angular only
showed an empty string instead.
Angular does not set validation errors on the <input>
in this case
as those errors are shown to the user, but the erroneous state was
caused by incorrect application logic and not by the user.
1.2.26 captivating-disinterest (2014-10-01)
Bug Fixes
1.3.0-rc.3 aggressive-pacification (2014-09-23)
Bug Fixes
Features
- $location: add ability to opt-out of
<base>
tag requirement in html5Mode (dc3de7fb, #8934) - formController: add $setUntouched to propagate untouched state (fd899755, #9050)
- input: support dynamic element validation (729c238e, #4791, #1404)
- ngAria: add an ngAria module to make a11y easier (d1434c99, #5486)
Performance Improvements
- map: use Array.prototype.map (a591e8b8)
Breaking Changes
-
$location: due to dc3de7fb, The $location.html5Mode API has changed to allow enabling html5Mode by passing an object (as well as still supporting passing a boolean). Symmetrically, the method now returns an object instead of a boolean value.
To migrate, follow the code example below:
Before:
var mode = $locationProvider.html5Mode();
After:
var mode = $locationProvider.html5Mode().enabled;
Fixes #8934
1.2.25 hypnotic-gesticulation (2014-09-16)
Bug Fixes
- i18n: fix typo at i18n generation code (1b6d74cc)
- ngLocale: Regenerate Locale Files (06c76694)
- select: update option labels when model changes (d89d59f4, #9025)
1.3.0-rc.2 tactile-perception (2014-09-16)
Bug Fixes
- $compile: update
'@'
-bindings in controller whenbindToController
istrue
(e7ac08a0, #9052, #9077) - $parse: ensure CSP assignable expressions have
assign()
(d13b4bd1, #9048) - i18n: fix typo at i18n generation code (eb4afd45)
- input: always pass in the model value to
ctrl.$isEmpty
(3e51b84b, #5164, #9017) - jqLite: fix
event.stopImmediatePropagation()
so it works as expected (30354c58, #4833) - ngLocale: Regenerate Locale Files (6a96a820, #8931, #8583, #7799)
- ngModel:
- ngResource: make badcfg error message more helpful (a3962f0d, #9005, #9010)
- select: update option labels when model changes (46274102, #9025)
Features
- limitTo: support numeric input to limitTo (1c8a7459, #8926)
- ngInclude: add template url parameter to events (fd2d6c02, #8453, #8454)
Performance Improvements
- $compile: move
$$isolateBinding
creation to directive factory instead of on each link (56f09f0b) - $parse:
Breaking Changes
- $parse: due to fca6be71, all filters are assumed to be stateless functions
Previously it was just a good practice to make all filters stateless. Now it's a requirement in order for the model change-observation to pick up all changes.
If an existing filter is stateful, it can be flagged as such but keep in
mind that this will result in a significant performance-penalty (or rather
lost opportunity to benefit from a major perf improvement) that will
affect the $digest
duration.
To flag a filter as stateful do the following:
myApp.filter('myFilter', function() {
function myFilter(input) { ... };
myFilter.$stateful = true;
return myFilter;
});
1.3.0-rc.1 backyard-atomicity (2014-09-09)
Bug Fixes
- $location:
- $parse: disallow passing Function to Array.sort (bd8ad0fb)
- input: check
scope.$$phase
only on$rootScope
(bf59d727) - ngAnimate: support removing classes from SVG elements when using jQuery (b3b67213, #8872, #8893)
- ngEventDirs: check
scope.$$phase
only on$rootScope
(203ea10f, #8891) - ngForm: don't clear validity of whole form when removing control (953ee22f, #8863)
- ngInclude: correctly add svg-namespaced template content (6639ca9d, #7538, #8981, #8997)
- ngModel:
- update model value with async validators correctly (64c3b745)
- render immediately also with async validators (f94d5515)
- properly parse min/max date values as strings for date inputs (088545c1, #6755)
- revalidate the model when min/max expression values change for date inputs (b3502835, #6755)
- consider ngMin/ngMax values when validating number input types (25541c1f)
- revalidate the model when min/max expression values change for number inputs (7b273a2c, #2404)
- ngModelOptions: do not trigger digest on
setViewValue
if debouncing (e322cd9b, #8814, #8850, #8911) - ngRepeat: preserve original position of elements that are being animated away (ed637330, #8918, #8994)
- ngSwitch: ensure correct iterator is passed to async function (712299c2, #8833)
- numberFilter: format numbers that round to zero as nonnegative (ae952fbf, #8489)
- orderBy: allow arrayLike objects to be ordered (cbdaabfb, #8944)
Features
- angular.forEach: add the array/object as the 3rd param like the native array forEach (df9e60c8, #7902)
- ngModelOptions: add allowInvalid option (3c538c1d, #8290, #8313)
Performance Improvements
- $parse:
- extend: remove use of forEach to remove calls/closures/passing arguments (9bedeb33, #8898)
- jQuery: only trigger $destroy if a handler exists (f6aa1c55, #8859)
Breaking Changes
-
ngModelController,formController: due to 6046e14b,
-
ctrl.$error
no longer contains entries for validators that were successful. -
ctrl.$setValidity
now differentiates betweentrue
,false
,undefined
andnull
, instead of previously only truthy vs falsy.
Closes #8941- ngSwitch: due to 0f806d96,
Ever since 0df93fd, tagged in v1.0.0rc1, the ngSwitch directive has had an undocumented change
attribute, used for evaluating a scope expression when the switch value changes.
While it's unlikely, applications which may be using this feature should work around the removal by adding a custom directive which will perform the eval instead. Directive controllers are re-instantiated when being transcluded, so by putting the attribute on each item that you want to be notified of a change to, you can more or less emulate the old behavior.
Example:
angular.module("switchChangeWorkaround", []).
directive("onSwitchChanged", function() {
return {
link: function($scope, $element, $attrs) {
$scope.$parent.$eval($attrs.onSwitchChanged);
}
};
});
<div ng-switch="switcher">
<div ng-switch-when="a" on-switch-changed="doSomethingInParentScope()"></div>
<div ng-switch-when="b" on-switch-changed="doSomethingInParentScope()"></div>
</div>
Closes #8858 Closes #8822
1.2.24 static-levitation (2014-09-09)
Bug Fixes
- $browser: detect changes to the browser url that happened in sync (2ece4d03, #6976)
- $compile:
- $location:
- $parse: disallow passing Function to Array.sort (b39e1d47)
- form: ensure concurrent animations use setClass (d7548fdf, #8166)
- input: check
scope.$$phase
only on$rootScope
(36e6de1d) - ngEventDirs:
- ngRepeat: improve errors for duplicate items (1812af58)
- numberFilter: format numbers that round to zero as nonnegative (7e02fa07, #8489)
- orderBy: allow arrayLike objects to be ordered (94b0f2d3, #8944)
Breaking Changes
- ngEventDirs: due to 54f0bc0f,
The blur
and focus
event fire synchronously, also during DOM operations
that remove elements. This lead to errors as the Angular model was not
in a consistent state. See this fiddle for a demo.
This change executes the expression of those events using
scope.$evalAsync
if an $apply
is in progress, otherwise
keeps the old behavior.
Fixes #4979 Fixes #5945 Closes #8803 Closes #6910 Closes #5402
1.3.0-RC.0 sonic-boltification (2014-08-29)
Bug Fixes
- $animate:
- $browser: detect changes to the browser url that happened in sync (3be00df4, #6976)
- $compile: use the correct namespace for transcluded svg elements (cb73a37c, #8808, #8816)
- $location: always resolve relative links in html5mode to
<base>
url (22948807, #8492, #8172) - $parse: properly handle dots at the end of identifiers (8ac90357, #4613, #4912, #8559)
- Angular: remove duplicate nodeName_ references (a4520a74)
- currencyFilter: pass through null and undefined values (c2aaddbe, #8605)
- docs: don't throw exception on the 404 page (550ba01b, #8518)
- input:
- ngBindHtml: throw error if interpolation is used in expression (cd21602d, #8824)
- ngEventDirs: execute
blur
andfocus
expression usingscope.$evalAsync
(719c747c, #4979, #5945, #8803, #6910, #5402) - ngModel:
- ngRepeat: improve errors for duplicate items (0604bb7b)
- ngSwitch: avoid removing DOM nodes twice within watch operation (c9b0bfec, #8662)
- numberFilter: pass through null and undefined values (2ae10f67, #8605, #8842)
Features
- core:
- add angular.reloadWithDebugInfo() (41c1b88)
- $animate:
- $compile:
- $compile/ngBind: allow disabling binding info (3660fd09)
- $http: implement mechanism for coalescing calls to $apply in $http (ea6fc6e6, #8736, #7634, #5297)
- $rootScope: implement $applyAsync to support combining calls to $apply into a single digest. (e94d454b)
- $templateRequest: introduce the $templateRequest service (a70e2833)
- filter: allow to define the timezone for formatting dates (4739b1d9)
- filterFilter: pass index to function predicate (46343c60, #654)
- input: allow to define the timezone for parsing dates (cc6fc199, #8447)
- minErr: allow specifying ErrorConstructor in minErr constructor (a6bd4bc8)
- ngModel: provide validation API functions for sync and async validations (2ae4f40b)
- ngRoute: alias string as redirectTo property in .otherwise() (3b5d75c0, #7794)
- testability: add $$testability service (85880a64)
Performance Improvements
- $compile:
- nodeName_: simplify the code and reduce the number of DOM calls (5a1a0c96)
- select: execute render after $digest cycle (6f7018d5, #8825)
Breaking Changes
- $location: due to 22948807
since 1.2.0 and 1.3.0-beta.1
Angular now requires a <base>
tag when html5 mode of $location
is enabled. Reasoning:
Using html5 mode without a <base href="...">
tag makes relative links for images, links, ...
relative to the current url if the browser supports
the history API. However, if the browser does not support the history API Angular falls back to using the #
,
and then all those relative links would be broken.
The <base>
tag is also needed when a deep url is loaded from the server, e.g. http://server/some/page/url
.
In that case, Angular needs to decide which part of the url is the base of the application, and which part
is path inside of the application.
To summarize: Now all relative links are always relative to the <base>
tag.
Exception (also a breaking change):
Link tags whose href
attribute starts with a #
will only change the hash of the url, but nothing else
(e.g. <a href="#someAnchor">
). This is to make it easy to scroll to anchors inside a document.
Related to #6162 Closes #8492
since 1.2.17 and 1.3.0-beta.10
In html5 mode without a <base>
tag on older browser that don't support the history API
relative paths were adding up. E.g. clicking on <a href="page1">
and then on <a href="page2">
would produce $location.path()==='/page1/page2'
. The code that introduced this behavior was removed
and Angular now also requires a <base>
tag to be present when using html5 mode.
Closes #8172, #8233
- ngInclude, ngMessage, ngView and directives that load templates: due to a70e2833
Angular will now throw a $compile minErr each a template fails to download for ngView, directives and ngMessage template requests. This changes the former behavior of silently ignoring failed HTTP requests--or when the template itself is empty. Please ensure that all directive, ngView and ngMessage code now properly addresses this scenario. NgInclude is unaffected from this change.
- $animate: due to 23da6140
If any stagger code consisted of having BOTH transition staggers and delay staggers together then that will not work the same way. Angular will now instead choose the highest stagger delay value and set the timeout to wait for that before applying the active CSS class.
- $animate: due to bf0f5502
Both the API for the cancelation method and the done callback for $animate animations is different. Instead of using a callback function for each of the $animate animation methods, a promise is used instead.
//before
$animate.enter(element, container, null, callbackFn);
//after
$animate.enter(element, container).then(callbackFn);
The animation can now be cancelled via $animate.cancel(promise)
.
//before
var cancelFn = $animate.enter(element, container);
cancelFn(); //cancels the animation
//after
var promise = $animate.enter(element, container);
$animate.cancel(promise); //cancels the animation
keep in mind that you will still need to run $scope.$apply inside of the then
callback
to trigger a digest.
- $animate: due to 2f4437b3
$animate.addClass, $animate.removeClass and $animate.setClass will no longer start the animation right after being called in the directive code. The animation will only commence once a digest has passed. This means that all animation-related testing code requires an extra digest to kick off the animation.
//before this fix
$animate.addClass(element, 'super');
expect(element).toHaveClass('super');
//now
$animate.addClass(element, 'super');
$rootScope.$digest();
expect(element).toHaveClass('super');
$animate will also tally the amount of times classes are added and removed and only animate the left over classes once the digest kicks in. This means that for any directive code that adds and removes the same CSS class on the same element then this may result in no animation being triggered at all.
$animate.addClass(element, 'klass');
$animate.removeClass(element, 'klass');
$rootScope.$digest();
//nothing happens...
- $compile/ngBind: due to 3660fd09,
The value of $binding
data property on an element is always an array now
and the expressions do not include the curly braces {{ ... }}
.
- currencyFilter: due to c2aaddbe, previously the currency filter would convert null and undefined values into empty string, after this change these values will be passed through.
Only cases when the currency filter is chained with another filter that doesn't expect null/undefined will be affected. This should be very rare.
This change will not change the visual output of the filter because the interpolation will convert the null/undefined to an empty string.
Closes #8605
- numberFilter: due to 2ae10f67, previously the number filter would convert null and undefined values into empty string, after this change these values will be passed through.
Only cases when the number filter is chained with another filter that doesn't expect null/undefined will be affected. This should be very rare.
This change will not change the visual output of the filter because the interpolation will convert the null/undefined to an empty string.
Closes #8605 Closes #8842
- input:
- due to 77ce5b89,
NgModel.viewValue will always be used when rendering validations for minlength
and maxlength
.
Closes #7967 Closes #8811
- input:
- due to 29f0b568,
According to the HTML5 spec input[time]
should create dates
based on the year 1970 (used to be based on the year 1900).
Related to #8447.
- ngModel: due to db044c40
Any parser code from before that returned an undefined
value
(or nothing at all) will now cause a parser failure. When this occurs
none of the validators present in $validators
will run until the parser
error is gone. The error will be stored on ngModel.$error
.
- ngEventDirs: due to 719c747c,
The blur
and focus
event fire synchronously, also during DOM operations
that remove elements. This lead to errors as the Angular model was not
in a consistent state. See this fiddle for a demo.
This change executes the expression of those events using
scope.$evalAsync
if an $apply
is in progress, otherwise
keeps the old behavior.
Fixes #4979 Fixes #5945 Closes #8803 Closes #6910 Closes #5402
- $compile: due to 5f3f25a1,
The returned value from directive controller constructors are now ignored, and only the constructed instance itself will be attached to the node's expando. This change is necessary in order to ensure that it's possible to bind properties to the controller's instance before the actual constructor is invoked, as a convenience to developers.
In the past, the following would have worked:
angular.module("myApp", []).
directive("myDirective", function() {
return {
controller: function($scope) {
return {
doAThing: function() { $scope.thingDone = true; },
undoAThing: function() { $scope.thingDone = false; }
};
},
link: function(scope, element, attrs, ctrl) {
ctrl.doAThing();
}
};
});
However now, the reference to doAThing()
will be undefined, because the return value of the controller's constructor is ignored. In order to work around this, one can opt for several strategies, including the use of _.extend()
or merge()
like routines, like so:
angular.module("myApp", []).
directive("myDirective", function() {
return {
controller: function($scope) {
_.extend(this, {
doAThing: function() { $scope.thingDone = true; },
undoAThing: function() { $scope.thingDone = false; }
});
},
link: function(scope, element, attrs, ctrl) {
ctrl.doAThing();
}
};
});
1.2.23 superficial-malady (2014-08-22)
Bug Fixes
- $location:
- $sanitize: sanitize javascript urls with comments (4f387050, #8274)
- Angular: make Date comparison in equals() NaN-aware (98f60372, #8650, #8715)
- copy: clear array destinations correctly for non-array sources (888b0f54, #8610, #8702)
- input:
- linky: handle quotes around email addresses (effc98fd, #8520)
- minErr: encode btstrpd error input to strip angle brackets (aaf9c5e5, #8683)
- ngHref: remove attribute when empty value instead of ignoring (ed56872b, #2755)
Breaking Changes
- input: due to ebece0bc,
Previously, input[type=password]
would trim values by default, and would require an explicit ng-trim="false"
to disable the trimming behavior. After this CL, ng-trim
no longer affects input[type=password]
, and will
never trim the password value.
Closes #8250 Closes #8230
1.3.0-beta.19 rafter-ascension (2014-08-22)
Bug Fixes
- $compile:
- $location:
- $parse: remove unused variable declaration in generated getters (6acea115)
- $sanitize: sanitize javascript urls with comments (b7e82a33, #8274)
- $watchGroup: call listener once when the
watchExpressions
array is empty (bf0e8373) - Angular: make Date comparison in
equals()
NaN
-aware (693e846a, #8650, #8715) - Scope: don't clear the phase when an exception is thrown from asyncQueue or watch (bf1a57ad)
- copy: clear array destinations correctly for non-array sources (a603e202, #8610, #8702)
- forEach: match behavior of Array.prototype.forEach (ignore missing properties) (36230194, #8510, #8522, #8525)
- input:
- jQuery: cooperate with other libraries monkey-patching jQuery.cleanData (b9389b26, #8471)
- jqLite:
- linky: handle quotes around email addresses (a9d22712, #8520)
- minErr: encode btstrpd error input to strip angle brackets (0872388a, #8683)
- ngRepeat:
Features
- $compile:
- benchpress: configure benchpress grunt task (6bdaa4bc)
- jqLite: implement the
detach
method (1a05daf5, #5461) - ngRoute: add method for changing url params (77a1acc7)
Performance Improvements
- $compile:
- don't register $destroy callbacks on element-transcluded nodes (b5f7970b)
- refactor publicLinkFn to simplify the code and use 'for in' loop (645625cf)
- clone the nodeList during linking only if necessary (3e0a2e1f)
- delay object initialization in nodeLinkFn (31ed0af7)
- optimize nodeLinkFn (35134a0e)
- optimize publicLinkFn (274e9c4d)
- $interpolate: do not keep empty separators (94b5c9f0)
- $parse:
- don't bind filters to a context (8863b9d0)
- optimize filter implementation (ece6ef47)
- speed up fn invocation for no args case (a17578ad)
- speed up fn invocation by optimizing arg collection (fecfc5b0)
- use no-proto maps as caches and avoid hasOwnProperty checks (d302ea0c)
- trim expression only if string (a1341223)
- $rootScope: do not use
Function::call
when not needed (7eae29e5) - Scope:
- benchpress: add benchpress node module and port over large table test (1229334f)
- isObject: use strict comparison (d208ba25)
- jqLite:
- simplify jqLiteDealoc (f8f7a1df)
- optimize event handler (d05f27e2)
- only take
str.split()
path when needed (187b1b8e, #8648) - optimize
off()
(abb17cce) - refactor jqLiteExpandoStore to minimize access to expensive element.ng339 expando property (1e8698b3)
- microoptimization in chaining fn (fafbd494)
- don't use String#split in on() unless we need it (bda673f8)
- don't check isString many times in constructor (443b521e)
- optimize jqLiteAcceptsData method (b493c62f)
- optimize
append()
andafter()
(8d933bf9) - don't register DOM listener for $destroy event (6251751a)
- optimize event listener registration (566f1015)
- improve createEventHandler method by switching from forEach to for loop (e9cd6dc0)
- don't use
forEach
inoff()
(960a8410) - don't recreate the Node.contains polyfill (d1536e7c)
- speed up shallowCopy and special case Attributes cloning (54fa16e4)
- ngBind: bypass jquery/jqlite when setting text (0a738ce1)
- ngRepeat:
- simplify code and remove duplicate array.length access (08eb0558)
- optimize marking of nodes that are being removed via an animation (36e35b2c)
- use no-proto objects for blockMaps (13d113c5)
- move work to compile fn (bdd853cb)
- move updateScope fn to factory and reuse it for all repeaters (e58d65a5)
- clone boundary comment nodes (fbd48845)
Breaking Changes
- $compile:
- due to 09de7b5d,
Now, ng-attr-*
will never add the attribute to the DOM if any of the interpolated expressions
evaluate to undefined
.
To work around this, initialize values which are intended to be the empty string with the empty string:
For example, given the following markup:
<div ng-attr-style="border-radius: {{value}}{{units}}"></div>
If $scope.value
is 4
, and $scope.units
is undefined
, the resulting markup is unchanged:
<div ng-attr-style="border-radius: {{value}}{{units}}"></div>
However, if $scope.units is ""
, then the resulting markup is updated:
<div ng-attr-style="border-radius: {{value}}{{units}}" style="border-radius: 4"></div>
Closes #8376 Closes #8399
- due to 0d608d04, element-transcluded directives now have an extra comment automatically appended to their cloned DOM
This comment is usually needed to keep track the end boundary in the event child directives modify the root node(s). If not used for this purpose it can be safely ignored.
- due to 75c4cbf8,
directive.type
was renamed todirective.templateNamespace
This change is breaking only within 1.3.0-beta releases: directive.type
was renamed to directive.templateNamespace
The property name type
was too general.
- $parse: due to 8863b9d0,
this
in filters is now undefined and no longer the scope
It's a bad practice for filters to have hidden dependencies, so pulling stuff from scope directly is not a good idea. Scope being the filter context was never documented as public API, so we don't expect that any significant code depends on this behavior.
If an existing filter has a dependency on the scope instance, the scope reference can be passed into the filter as a filter argument (this is highly discouraged for new code):
Before: {{ user.name | customFilter }}
After: {{ user.name | customFilter:this }}
- Scope: due to 0554c1aa,
deregisterNotifier
callback for$watch
is no longer available
This API was available only in the last few 1.3 beta versions and is not very useful for applications, so we don't expect that anyone will be affected by this change.
- input: due to a7fb357f,
by default, do not trim
input[type=password]
values.
Previously, input[type=password]
would trim values by default, and would require an explicit ng-trim="false"
to disable the trimming behavior. After this change, ng-trim
no longer affects input[type=password]
, and will
never trim the password value.
Closes #8250 Closes #8230
1.3.0-beta.18 spontaneous-combustion (2014-08-12)
Bug Fixes
- $compile: make '='-bindings NaN-aware (5038bf79, #8553, #8554)
- $location: add semicolon to whitelist of delimiters to unencode (36258033, #5019)
- $parse:
- Scope: add deregisterNotifier to oneTimeLiteralWatch signature (a001a417)
- jqLite:
- ngSanitize: ensure
html
is a string in htmlParser() (34781f18, #8417, #8416) - select:
Features
- $parse: allow for assignments in ternary operator branches (2d678f1d, #8512, #8484)
- form: Add new $submitted state to forms (108a69be, #8056)
- http: allow caching for JSONP requests (3607c982, #1947, #8356)
- jQuery: upgrade to jQuery to 2.1.1 (9e7cb3c3)
- ngMock: allow override of when/expect definitions (477626d8, #5766, #8352)
Performance Improvements
- $q: move Deferred and Promise methods to prototypes (23bc92b1, #8300)
- input: prevent additional $digest when input is already touched (dd2a803f, #8450)
Breaking Changes
- jQuery: due to 9e7cb3c3, Angular no longer supports jQuery versions below 2.1.1.
- $q: due to 23bc92b1,
Promises methods are no longer enumerated when using for-loops with
hasOwnProperty
check. E.g.angular.extends
1.2.22 finicky-pleasure (2014-08-12)
Bug Fixes
- $compile: make '='-bindings NaN-aware (0b0acb03, #8553, #8554)
- $parse: correctly assign expressions who's path is undefined and that use brackets notation (60366c8d, #8039)
- jqLite: allow
triggerHandler()
to accept custom event (d262378b, #8469, #8505) - ngSanitize: ensure
html
is a string in htmlParser() (9ee07551, #8417, #8416) - select:
Features
- $parse: allow for assignments in ternary operator branches (93b0c2d8, #8512, #8484)
- http: allow caching for JSONP requests (eab5731a, #1947, #8356)
1.3.0-beta.17 turing-autocompletion (2014-07-25)
Bug Fixes
- angular.copy: clone regexp flags correctly (86340a59, #5781, #8337)
- docs: change plnkr form to open in same window (925b2080)
- jqLite: triggerHandler support unbind self (8a27abae, #5984)
- ngHref: remove attribute when empty value instead of ignoring (469ea338, #2755)
Features
- $compile: change directive's restrict setting to default to EA (element/attribute) (11f5aeee, #8321)
- $q: add streamlined ES6-style interface for using $q (f3a763fd, #8311, #6427)
- ngRepeat: provide support for aliasing filtered repeater results as a scope member (e0adb9c4, #5919, #8046, #8282)
Performance Improvements
- $parse: don't use reflective calls in generated functions (c54228fb)
Breaking Changes
- $compile: due to 11f5aeee,
directives now match elements by default unless specific restriction rules are set via
restrict
property.
This means that if a directive 'myFoo' previously didn't specify matching restriction, it will now match both the attribute and element form.
Before:
<div my-foo></div>
<---- my-foo attribute matched the directive
<my-foo></my-foo>
<---- no match
After:
<div my-foo></div>
<---- my-foo attribute matched the directive
<my-foo></my-foo>
<---- my-foo element matched the directive
It is not expected that this will be a problem in practice because of widespread use of prefixes that make <my-foo>
like
elements unlikely.
Closes #8321
1.2.21 wizard-props (2014-07-25)
Bug Fixes
- $http: fix double-quoted date issue when encoding params (2f960f15, #8150, #6128, #8154)
- $location: handle plus character in query strings (60af504c, #3042)
- $rootScope: $watchCollection should handle NaN in objects (bf13d268, #7930)
- angular.copy: clone regexp flags correctly (e25ed0d4, #5781, #8337)
- csp: fix autodetection of CSP + better docs (0e5d3190, #8162, #8191)
- docs: change plnkr form to open in same window (5d11e020)
- jqLite: triggerHandler support unbind self (209e6000, #5984)
- ngHref: remove attribute when empty value instead of ignoring (948c86c6, #2755)
- ngRoute: remove unnecessary call to decodeURIComponent (1b779028, #6326, #6327)
- ngSanitize:
- orderBy: correctly order by date values (f1b28847, #6675, #6746)
- select: force visual update in IE (c0afbfac, #7692, #8158)
Performance Improvements
- $compile: only create jqLite object when necessary (71eb1901)
- $parse: don't use reflective calls in generated functions (cbdf0c2a)
- forEach: use native for loop instead of forEach for Arrays (492b0cdf)
- jqLite: expose the low-level jqLite.data/removeData calls (3c46c943)
- ngBindHtml: move addClass to the compile phase (8eede099, #8261)
1.3.0-beta.16 pizza-transubstantiation (2014-07-18)
Bug Fixes
- $cookie: use
decodeURIComponent
instead of unescape for cookie reading (1c9ab40d, #8125) - $http: fix double-quoted date issue when encoding params (9dce42b3, #8150, #6128, #8154)
- $location: handle plus character in query strings (3f4ee151, #3042)
- $rootScope:
- csp: fix autodetection of CSP + better docs (0113f225, #8162, #8191)
- ngList: use custom separators for re-joining list items (c6c9d26e, #4008, #2561, #4344)
- ngRoute: remove unnecessary call to
decodeURIComponent
(528f56a6, #6326, #6327) - ngSanitize: follow HTML parser rules for start tags / allow < in text content (f6681d41, #8212, #8193)
- ngSwitch:
- orderBy: correctly order by date values (92bceb5c, #6675, #6746)
- select: force visual update in IE (d7f73022, #7692, #8158)
Features
- $compile: explicitly request multi-element directive behavior (e8066c4b, #5372, #6574, #5370, #8044, #7336)
- ngList: use ngTrim to manage whitespace handling when splitting (8d18d20e)
- ngTransclude: allow ngTransclude to be used as an element (3dafcba9, #8141)
Performance Improvements
- $compile: only create jqLite object when necessary (a160f76f)
- bindOnce more performant interpolation and lazy one-time binding (86d55c1d)
- jqLite: expose the low-level jqLite.data/removeData calls (e4ba8943)
- ngBindHtml: move addClass to the compile phase (903e7352, #8261)
Breaking Changes
- $compile: due to e8066c4b, Directives which previously depended on the implicit grouping between directive-start and directive-end attributes must be refactored in order to see this same behavior.
Before:
<div data-fancy-directive-start>{{start}}</div>
<p>Grouped content</p>
<div data-fancy-directive-end>{{end}}</div>
.directive('fancyDirective', function() {
return {
link: angular.noop
};
})
After:
<div data-fancy-directive-start>{{start}}</div>
<p>Grouped content</p>
<div data-fancy-directive-end>{{end}}</div>
.directive('fancyDirective', function() {
return {
multiElement: true, // Explicitly mark as a multi-element directive.
link: angular.noop
};
})
Closes #5372 Closes #6574 Closes #5370 Closes #8044 Closes #7336
- $rootScope: due to 02c0ed27,
Previously, it was possible for an action passed to $watch to be a string, interpreted as an angular expression. This is no longer supported. The action now has to be a function. Passing an action to $watch is still optional.
Before:
$scope.$watch('state', ' name="" ');
After:
$scope.$watch('state', function () {
$scope.name = "";
});
Closes #8190
- bootstrap: due to 666a3835,
If using any of the mechanisms specified above, then migrate by
specifying the attribute ng-app
to the root element. E.g.
<div ng-app="module">...</div>
Closes #8147
- ngList: due to c6c9d26e,
The ngList
directive no longer supports splitting the view value
via a regular expression. We need to be able to re-join list items back
together and doing this when you can split with regular expressions can
lead to inconsistent behavior and would be much more complex to support.
If your application relies upon ngList splitting with a regular expression then you should either try to convert the separator to a simple string or you can implement your own version of this directive for you application.
Closes #4008 Closes #2561 Closes #4344
- ngSwitch: due to 4f32e3ee,
** Directive Priority Changed ** - this commit changes the priority
of ngSwitchWhen
and ngSwitchDefault
from 800
to 1200
. This makes their
priority higher than ngRepeat
, which allows items to be repeated on
the switch case element reliably.
In general your directives should have a lower priority than these directives if you want them to exist inside the case elements. If you relied on the priority of these directives then you should check that your code still operates correctly.
Closes #8235
1.3.0-beta.15 unbelievable-advancement (2014-07-11)
Bug Fixes
- $animate:
- $http:
- $location: remove query args when passed in object (2c7d0857, #6565)
- input:
- jqLite:
- ngModel: test & update correct model when running $validate (f3cb2741, #7836, #7837)
- parseKeyValue: ignore properties in prototype chain (cb42766a, #8070, #8068)
- select: auto-select new option that is marked as selected (b8ae73e1, #6828)
Features
- $animate: allow directives to cancel animation events (ca752790, #7722)
- $controller: disable using global controller constructors (3f2232b5)
- FormController: add
$rollbackViewValue
to rollback all controls (85b77314, #7595) - input: support constant expressions for ngTrueValue/ngFalseValue (c90cefe1, #8041, #5346, #1199)
- ngAnimate: conditionally allow child animations to run in parallel with parent animations (8252b8be, #7946)
- ngModel: bind to getters/setters (b9fcf017, #768)
Performance Improvements
Breaking Changes
- $controller: due to 3f2232b5,
$controller
will no longer look for controllers on window
.
The old behavior of looking on window
for controllers was originally intended
for use in examples, demos, and toy apps. We found that allowing global controller
functions encouraged poor practices, so we resolved to disable this behavior by
default.
To migrate, register your controllers with modules rather than exposing them as globals:
Before:
function MyController() {
// ...
}
After:
angular.module('myApp', []).controller('MyController', [function() {
// ...
}]);
Although it's not recommended, you can re-enable the old behavior like this:
angular.module('myModule').config(['$controllerProvider', function($controllerProvider) {
// this option might be handy for migrating old apps, but please don't use it
// in new ones!
$controllerProvider.allowGlobals();
}]);
- input: due to c90cefe1,
Previously, these attributes would always be treated as strings. However, they are now parsed as expressions, and will throw if an expression is non-constant.
To convert non-constant strings into constant expressions, simply wrap them in an extra pair of quotes, like so:
<input type="checkbox" ng-model="..." ng-true-value="'truthyValue'">
Closes #8041 Closes #5346 Closes #1199
1.2.20 accidental-beautification (2014-07-11)
Bug Fixes
- $http:
- $location: remove query args when passed in object (a26acb64, #6565)
- input:
- parseKeyValue: ignore properties in prototype chain (873acf8f, #8070, #8068)
Features
- ngAnimate: conditionally allow child animations to run in parallel with parent animations (931789ec, #7946)
1.3.0-beta.14 harmonious-cacophonies (2014-06-30)
This release contains security fixes for $parse that prevent arbitrary code execution via Angular expressions under some very specific conditions. The only applications affected by these vulnerabilities are those that match all of the following conditions:
- application mixes server-side and client-side templating
- the server-side templating contains XSS vulnerabilities
- the vulnerabilities in the server-side templating are being guarded by server-side XSS filters or on the client-side via CSP
- the server-side XSS vulnerabilities can be used to augment the client-side template processed by Angular
Applications not meeting all of the conditions are not vulnerable.
This fix is in both 1.3.0-beta.14 and 1.2.19 release.
The Angular team would like to thank Jann Horn for reporting these vulnerabilities via [security@angularjs.org].
Bug Fixes
- $compile: bind ng-attr-* even if unbound attribute follows ng-attr-* (8b0258d8, #7739)
- $http:
- $injector: check if a fn is an array explicitly (b1a6baac, #7904, #2653)
- $interval: when canceling, use clearInterval from $window instead of global scope. (a4904c0f)
- $parse:
- prevent invocation of Function's bind, call and apply (77ada4c8)
- forbid proto properties in angular expressions (6081f207)
- forbid {define,lookup}{Getter,Setter} properties (48fa3aad)
- forbid referencing Object in angular expressions (528be29d)
- handle constants as one-time binding expressions (d9763f1b, #7970)
- $timeout/$interval: if invokeApply is false, do not use evalAsync (19b6b343, #7999, #7103)
- Angular: nodeName should always be lowercase (dafb8a3c, #3987)
- Angular.copy: preserve prototype chain when copying objects (b59b04f9, #5063, #3767, #4996)
- core: drop the toBoolean function (bdfc9c02, #3969, #4277, #7960)
- injector: allow multiple loading of function modules (2f0a4488, #7255)
- input:
- jqLite:
- numberFilter: correctly round fractions despite floating-point arithmetics issues in JS (189cd064, #7870, #7878)
- testabilityPatch: fix invocations of angular.mock.dump (e8e07502)
Features
Performance Improvements
- forEach: use native for loop instead of forEach for Arrays (36625de0)
Breaking Changes
- $parse:
- due to 77ada4c8,
You can no longer invoke .bind, .call or .apply on a function in angular expressions. This is to disallow changing the behavior of existing functions in an unforeseen fashion.
- due to 6081f207,
The (deprecated) proto property does not work inside angular expressions anymore.
- due to 48fa3aad,
This prevents the use of {define,lookup}{Getter,Setter} inside angular expressions. If you really need them for some reason, please wrap/bind them to make them less dangerous, then make them available through the scope object.
- due to 528be29d,
This prevents the use of Object
inside angular expressions.
If you need Object.keys, make it accessible in the scope.
- Angular.copy: due to b59b04f9,
This changes angular.copy
so that it applies the prototype of the original
object to the copied object. Previously, angular.copy
would copy properties
of the original object's prototype chain directly onto the copied object.
This means that if you iterate over only the copied object's hasOwnProperty
properties, it will no longer contain the properties from the prototype.
This is actually much more reasonable behavior and it is unlikely that
applications are actually relying on this.
If this behavior is relied upon, in an app, then one should simply iterate
over all the properties on the object (and its inherited properties) and
not filter them with hasOwnProperty
.
Be aware that this change also uses a feature that is not compatible with
IE8. If you need this to work on IE8 then you would need to provide a polyfill
for Object.create
and Object.getPrototypeOf
.
- core: due to bdfc9c02, values 'f', '0', 'false', 'no', 'n', '[]' are no longer treated as falsy. Only JavaScript falsy values are now treated as falsy by the expression parser; there are six of them: false, null, undefined, NaN, 0 and "".
Closes #3969 Closes #4277 Closes #7960
- $timeout/$interval:
- due to 19b6b343
Previously, even if invokeApply was set to false, a $rootScope digest would occur during promise
resolution. This is no longer the case, as promises returned from $timeout and $interval will no
longer trigger $evalAsync (which in turn causes a $digest) if invokeApply
is false.
Workarounds include manually triggering $scope.$apply(), or returning $q.defer().promise from a promise callback, and resolving or rejecting it when appropriate.
var interval = $interval(function() {
if (someRequirementFulfilled) {
$interval.cancel(interval);
$scope.$apply();
}
}, 100, 0, false);
or:
var interval = $interval(function (idx) {
// make the magic happen
}, 1000, 10, false);
interval.then(function(idx) {
var deferred = $q.defer();
// do the asynchronous magic --- $evalAsync will cause a digest and cause
// bindings to update.
return deferred.promise;
});
1.2.19 precognitive-flashbacks (2014-06-30)
Bug Fixes
- $compile: bind ng-attr-* even if unbound attribute follows ng-attr-* (ed59370d)
- $http: should not read statusText on IE<10 when request is aborted (0c80df21)
- $injector: check if a fn is an array explicitly (67c11b9a, #7904, #2653)
- $interval: when canceling, use clearInterval from $window instead of global scope. (f780ccfa)
- $parse:
- make the window check in ensureSafeObject IE8 friendly (ba62e975)
- prevent invocation of Function's bind, call and apply (07fa87a8)
- forbid proto properties in angular expressions (cb713e60)
- forbid {define,lookup}{Getter,Setter} properties (89ca8597)
- forbid referencing Object in angular expressions (bc6fb7cc)
- injector: allow multiple loading of function modules (d71f16e7, #7255)
- input:
- jqLite: change expando property to a more unique name (74e1cc68)
- numberFilter: correctly round fractions despite floating-point arithmetics issues in JS (e5f454c8, #7870, #7878)
- testabilityPatch: fix invocations of angular.mock.dump (5e944a1c)
Performance Improvements
- jqLite: don't use reflection to access expandoId (a4faa5cd)
Breaking Changes
- $parse:
- due to 07fa87a8,
You can no longer invoke .bind, .call or .apply on a function in angular expressions. This is to disallow changing the behavior of existing functions in an unforeseen fashion.
- due to cb713e60,
The (deprecated) proto property does not work inside angular expressions anymore.
- due to 89ca8597,
This prevents the use of {define,lookup}{Getter,Setter} inside angular expressions. If you really need them for some reason, please wrap/bind them to make them less dangerous, then make them available through the scope object.
- due to bc6fb7cc,
This prevents the use of Object
inside angular expressions.
If you need Object.keys, make it accessible in the scope.
1.3.0-beta.13 idiosyncratic-numerification (2014-06-16)
Bug Fixes
- jqLite: change expando property to a more unique name (20c3c9e2)
1.3.0-beta.12 ephemeral-acceleration (2014-06-13)
Bug Fixes
- $compile:
- $injector: report circularity in circular dependency error message (545d22b4, #7500)
- $parse: Handle one-time to
null
(600a41a7, #7743, #7787) - NgModel:
- ensure pattern and ngPattern use the same validator (1be9bb9d)
- make ngMinlength and ngMaxlength as standalone directives (26d91b65, #6750)
- make sure the ngMinlength and ngMaxlength validators use the $validators pipeline (5b8e7ecf, #6304)
- make sure the pattern validator uses the $validators pipeline (e63d4253)
- make sure the required validator uses the $validators pipeline (e53554a0, #5164)
- jqLite: data should store data only on Element and Document nodes (a196c8bc)
- ngResource: don't convert literal values into Resource objects when isArray is true (16dfcb61, #6314, #7741)
Features
- NgModel: introduce the $validators pipeline (a8c7cb81)
- attrs: trigger observers for specific ng-attributes (d9b90d7c, #7758)
- input: add $touched and $untouched states (adcc5a00)
- ngInclude: emit $includeContentError when HTTP request fails (e4419daf, #5803)
Performance Improvements
- $compile: move ng-binding class stamping for interpolation into compile phase (35358fdd)
- $http: move xsrf cookie check to after cache check in $http (dd1d189e, #7717)
- Scope: change Scope#id to be a simple number (8c6a8171)
- forEach: cache array length (55991e33)
- isArray: use native Array.isArray (751ebc17, #7735)
- isWindow optimize internal isWindow call (b68ac4cb)
- jqLite:
- ngBind: set the ng-binding class during compilation instead of linking (fd5f3896)
- shallowCopy: use Object.keys to improve performance (04468db4)
Breaking Changes
- $compile: due to 2cde927e,
Requesting isolate scope and any other scope on a single element is an error. Before this change, the compiler let two directives request a child scope and an isolate scope if the compiler applied them in the order of non-isolate scope directive followed by isolate scope directive.
Now the compiler will error regardless of the order.
If you find that your code is now throwing a $compile:multidir
error,
check that you do not have directives on the same element that are trying
to request both an isolate and a non-isolate scope and fix your code.
Closes #4402 Closes #4421
- NgModel: due to 1be9bb9d,
If an expression is used on ng-pattern (such as ng-pattern="exp"
) or on the
pattern attribute (something like on pattern="{{ exp }}"
) and the expression
itself evaluates to a string then the validator will not parse the string as a
literal regular expression object (a value like /abc/i
). Instead, the entire
string will be created as the regular expression to test against. This means
that any expression flags will not be placed on the RegExp object. To get around
this limitation, use a regular expression object as the value for the expression.
//before
$scope.exp = '/abc/i';
//after
$scope.exp = /abc/i;
- Scope: due to 8c6a8171, Scope#$id is now of time number rather than string. Since the id is primarily being used for debugging purposes this change should not affect anyone.
- forEach: due to 55991e33, forEach will iterate only over the initial number of items in the array. So if items are added to the array during the iteration, these won't be iterated over during the initial forEach call.
This change also makes our forEach behave more like Array#forEach.
- jqLite: due to a196c8bc, previously it was possible to set jqLite data on Text/Comment nodes, but now that is allowed only on Element and Document nodes just like in jQuery. We don't expect that app code actually depends on this accidental feature.
1.2.18 ear-extendability (2014-06-13)
Bug Fixes
- $compile:
- ensure transclude works at root of templateUrl (fd420c40, #7183, #7772)
- bound transclusion to correct scope (1382d4e8)
- don't pass transcludes to non-transclude templateUrl directives (b9ddef2a)
- don't pass transclude to template of non-transclude directive (eafba9e2)
- fix nested isolated transclude directives (bb931097, #1809, #7499)
- pass transcludeFn down to nested transclude directives (8df5f325, #7240, #7387)
- $injector: report circularity in circular dependency error message (14e797c1, #7500)
- ngResource: don't convert literal values into Resource objects when isArray is true (f0904cf1, #6314, #7741)
Performance Improvements
- $compile: move ng-binding class stamping for interpolation into compile phase (81b7e5ab)
- $http: move xsrf cookie check to after cache check in $http (8b86d363, #7717)
- isArray: use native Array.isArray (6c14fb1e)
- jqLite: cache collection length for all methods that work on a single element (6d418ef5)
- ngBind: set the ng-binding class during compilation instead of linking (1b189027)
1.3.0-beta.11 transclusion-deforestation (2014-06-06)
Bug Fixes
- $animate: remove the need to add
display:block !important
forngShow
/ngHide
(7c011e79, #3813) - $compile:
- bound transclusion to correct scope (56c60218)
- set the iteration state before linking (0c8a2cd2)
- don't pass transcludes to non-transclude templateUrl directives (2ee29c5d)
- don't pass transclude to template of non-transclude directive (19af0397)
- fix nested isolated transclude directives (d414b787, #1809, #7499)
- pass transcludeFn down to nested transclude directives (1fef5fe8, #7240, #7387)
- $parse: fix parsing error with leading space and one time bind (24c844df, #7640)
- angular.copy: support circular references in the value being copied (083f496d, #7618)
- angular.toJson: only strip properties beginning with
$$
, not$
(c054288c) - ngAnimate:
- ngClass: support multiple classes in key (7eaaca8e)
- ngIf: ensure that the correct (transcluded) scope is used (d71df9f8)
- ngLocale: fix i18n code-generation to support
get_vf_
,decimals_
, andget_wt_
(cbab51ca) - ngRepeat: ensure that the correct (transcluded) scope is used (b87e5fc0)
- ngShow: ensure that the display property is never set to
block
(1d90744f, #7707)
Features
- $resource: allow props beginning with
$
to be used on resources (d3c50c84)
Breaking Changes
- $compile: due to 2ee29c5d,
The isolated scope of a component directive no longer leaks into the template that contains the instance of the directive. This means that you can no longer access the isolated scope from attributes on the element where the isolated directive is defined.
See https://github.com/angular/angular.js/issues/10236 for an example.
-
$resource: due to d3c50c84,
If you expected
$resource
to strip these types of properties before, you will have to manually do this yourself now. -
angular.toJson: due to c054288c,
toJson()
will no longer strip properties starting with a single$
. If you relied ontoJson()
's stripping these types of properties before, you will have to do it manually now. It will still strip properties starting with$$
though.
1.2.17 - quantum disentanglement (2014-06-06)
Bug Fixes
- $animate:
- $compile:
- do not merge attrs that are the same for replace directives (b635903e, #7463)
- pass
transcludeFn
down to nested transclude directives (11385060, #7240, #7387) - set
$isolateScope
correctly for sync template directives (5319621a, #6942) - reference correct directive name in
ctreq
error (6bea0591, #7062, #7067) - fix regression which affected old jQuery releases (a97a172e)
- $httpBackend: don't error when JSONP callback is called with no parameter (a7ccb753, #7031)
- $location:
- angular.copy: support circular references in the value being copied (5c997209, #7618)
- grunt-utils: ensure special inline CSS works when
angular
is not a global (d4231171, #7176) - input:
- jqLite: use jQuery only if
jQuery.fn.on
is present (fafcd628) - limitTo: do not convert
Infinity
toNaN
(fcdac65a, #6771, #7118) - ngAnimate:
$animate
methods should accept native DOM elements (9227a5db) - ngClass:
- ngLocale: fix i18n code-generation to support
get_vf_
,decimals_
, andget_wt_
(96a31476) - ngSanitize: encode surrogate pair properly (3d0b49c0, #5088, #6911)
- ngSwitch: properly support case labels with different numbers of transclude fns (32aa4915)
- numberFilter: fix rounding error edge case (0388eed7, #7453, #7478)
Features
Performance Improvements
- $interpolate: optimize value stringification (9d4fa33e, #7501)
- scope: 10x. Share the child scope class. (9ab9bf6b)
1.3.0-beta.10 excessive-clarification (2014-05-23)
Bug Fixes
- $animate: retain inline styles for property-specific transitions (98b9d68e, #7503)
- $compile: do not merge attrs that are the same for replace directives (1ab6e908, #7463)
- $parse: remove deprecated promise unwrapping (fa6e411d)
- Scope: $broadcast and $emit should set event.currentScope to null (82f45aee, #7445, #7523)
- ngModel: do not dirty the input on $commitViewValue if nothing was changed (facd904a, #7457, #7495)
Features
- $interpolate: escaped interpolation expressions (e3f78c17, #5601, #7517)
- {{ bindings }}: lazy one-time binding support (cee429f0, #7486, #5408)
- ngMock: add support of mocha tdd interface (854bf5b7, #7489)
Performance Improvements
Breaking Changes
-
$compile: due to eec6394a, The
replace
flag for defining directives that replace the element that they are on will be removed in the next major angular version. This feature has difficult semantics (e.g. how attributes are merged) and leads to more problems compared to what it solves. Also, with Web Components it is normal to have custom elements in the DOM. -
$parse: due to fa6e411d, promise unwrapping has been removed. It has been deprecated since 1.2.0-rc.3. It can no longer be turned on. Two methods have been removed:
$parseProvider.unwrapPromises
$parseProvider.logPromiseWarnings
-
Scope: due to 82f45aee, #7445, #7523
$broadcast
and$emit
will now reset thecurrentScope
property of the event to null once the event finished propagating. If any code depends on asynchronously accessing theircurrentScope
property, it should be migrated to usetargetScope
instead. All of these cases should be considered programming bugs.
1.3.0-beta.9 release-naming (2014-05-16)
Bug Fixes
- $compile: pass
transcludeFn
down to nested transclude directives (4f03dc5a, #7240, #7387) - jqLite: use jQuery only if jQuery.fn.on present (e9bc51cb)
- ngClass: handle index changes when an item is unshifted (5fbd618c, #7256)
- ngMessages: annotate ngMessages controller for minification (0282ca97)
- numberFilter: fix rounding error edge case (81d427b5, #7453, #7478)
Features
- ngTouch: add optional
ngSwipeDisableMouse
attribute tongSwipe
directives to ignore mouse events. (5a568b4f, #6627, #6626)
Breaking Changes
- jqLite: due to d71dbb1a,
the jQuery
detach()
method does not trigger the$destroy
event. If you want to destroy Angular data attached to the element, useremove()
.
1.3.0-beta.8 accidental-haiku (2014-05-09)
Bug Fixes
- $compile: set $isolateScope correctly for sync template directives (562c4e42, #6942)
- $httpBackend: Add missing expectHEAD() method (e1d61784, #7320)
- $interpolate: don't ReferenceError when context is undefined (924ee6db, #7230, #7237)
- grunt-utils: ensure special inline CSS works when
angular
is not a global (af72f40a, #7176) - injector: invoke config blocks for module after all providers (c0b4e2db, #7139, #7147)
- ngModelOptions:
- ngSanitize: encode surrogate pair properly (627b0354, #5088, #6911)
- ngSrc, ngSrcset: only interpolate if all expressions are defined (8d180383, #6984)
- ngSwitch: properly support case labels with different numbers of transclude fns (ac37915e, #7372, #7373)
Features
- $compile: allow SVG and MathML templates via special
type
property (f0e12ea7, #7265) - $interpolate: add optional allOrNothing param (c2362e3f)
- FormController: commit
$viewValue
of all child controls when form is submitted (a0ae07bd, #7017) - NgMessages: introduce the NgMessages module and directives (0f4016c8)
Breaking Changes
- $http: due to ad4336f9,
Previously, it was possible to register a response interceptor like so:
// register the interceptor as a service
$provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {
return function(promise) {
return promise.then(function(response) {
// do something on success
return response;
}, function(response) {
// do something on error
if (canRecover(response)) {
return responseOrNewPromise
}
return $q.reject(response);
});
}
});
$httpProvider.responseInterceptors.push('myHttpInterceptor');
Now, one must use the newer API introduced in v1.1.4 (4ae46814), like so:
$provide.factory('myHttpInterceptor', function($q) {
return {
response: function(response) {
// do something on success
return response;
},
responseError: function(response) {
// do something on error
if (canRecover(response)) {
return responseOrNewPromise
}
return $q.reject(response);
}
};
});
$httpProvider.interceptors.push('myHttpInterceptor');
More details on the new interceptors API (which has been around as of v1.1.4) can be found at https://docs.angularjs.org/api/ng/service/$http#interceptors
- injector: due to c0b4e2db,
Previously, config blocks would be able to control behavior of provider registration, due to being invoked prior to provider registration. Now, provider registration always occurs prior to configuration for a given module, and therefore config blocks are not able to have any control over a providers registration.
Example:
Previously, the following:
angular.module('foo', [])
.provider('$rootProvider', function() {
this.$get = function() { ... }
})
.config(function($rootProvider) {
$rootProvider.dependentMode = "B";
})
.provider('$dependentProvider', function($rootProvider) {
if ($rootProvider.dependentMode === "A") {
this.$get = function() {
// Special mode!
}
} else {
this.$get = function() {
// something else
}
}
});
would have "worked", meaning behavior of the config block between the registration of "$rootProvider" and "$dependentProvider" would have actually accomplished something and changed the behavior of the app. This is no longer possible within a single module.
- ngModelOptions: due to adfc322b,
This commit changes the API on NgModelController
, both semantically and
in terms of adding and renaming methods.
$setViewValue(value)
- This method still changes the$viewValue
but does not immediately commit this change through to the$modelValue
as it did previously. Now the value is committed only when a trigger specified in an associatedngModelOptions
directive occurs. IfngModelOptions
also has adebounce
delay specified for the trigger then the change will also be debounced before being committed. In most cases this should not have a significant impact on howNgModelController
is used: IfupdateOn
includesdefault
then$setViewValue
will trigger a (potentially debounced) commit immediately.$cancelUpdate()
- is renamed to$rollbackViewValue()
and has the same meaning, which is to revert the current$viewValue
back to the$lastCommittedViewValue
, to cancel any pending debounced updates and to re-render the input.
To migrate code that used $cancelUpdate()
follow the example below:
Before:
$scope.resetWithCancel = function (e) {
if (e.keyCode == 27) {
$scope.myForm.myInput1.$cancelUpdate();
$scope.myValue = '';
}
};
After:
$scope.resetWithCancel = function (e) {
if (e.keyCode == 27) {
$scope.myForm.myInput1.$rollbackViewValue();
$scope.myValue = '';
}
}
v1.3.0-beta.7 proper-attribution (2014-04-25)
Bug Fixes
Performance Improvements
- scope: ~10x speedup from sharing the child scope class. (8377e818)
v1.3.0-beta.6 expedient-caffeination (2014-04-21)
Bug Fixes
- $animate: ensure class-based animations always perform a domOperation if skipped (708f2ba9, #6957)
- $compile:
- $location:
- input: don't dirty model when input event triggered due to placeholder change (ff428e72, #2614, #5960)
- limitTo: do not convert Infinity to NaN (5dee9e4a, #6771, #7118)
- ngModelController: introduce $cancelUpdate to cancel pending updates (940fcb40, #6994, #7014)
Features
- $resource: Make stripping of trailing slashes configurable. (3878be52)
- Scope: add
$watchGroup
method for observing a set of expressions (21f93163) - injector: "strict-DI" mode which disables "automatic" function annotation (4b1695ec, #6719, #6717, #4504, #6069, #3611)
- ngModelOptions: custom triggers and debounce of ngModel updates (dbe381f2, #1285)
Performance Improvements
- $compile: watch interpolated expressions individually (0ebfa0d1)
- $interpolate: speed up interpolation by recreating watchGroup approach (546cb429)
Breaking Changes
-
$interpolate: due to 88c2193c, the function returned by
$interpolate
no longer has a.parts
array set on it.Instead it has two arrays:
.expressions
, an array of the expressions in the interpolated text. The expressions are parsed with$parse
, with an extra layer converting them to strings when computed.separators
, an array of strings representing the separations between interpolations in the text. This array is always 1 item longer than the.expressions
array for easy merging with it
1.3.0-beta.5 chimeric-glitterfication (2014-04-03)
Bug Fixes
- $animate:
- $parse: mark constant unary minus expressions as constant (7914d346, #6932)
- Scope:
- ngClass: handle ngClassOdd/Even affecting the same classes (c9677920, #5271)
Breaking Changes
- $animate: due to 1cb8584e,
$animate
will no longer default the after parameter to the last element of the parent container. Instead, when after is not specified, the new element will be inserted as the first child of the parent container.
To update existing code, change all instances of $animate.enter()
or $animate.move()
from:
$animate.enter(element, parent);
to:
$animate.enter(element, parent, angular.element(parent[0].lastChild));
1.2.16 badger-enumeration (2014-04-03)
Bug Fixes
- $animate:
- $parse: mark constant unary minus expressions as constant (6e420ff2, #6932)
- Scope:
- filter.ngdoc: Check if "input" variable is defined (a275d539, #6819)
- input: don't perform HTML5 validation on updated model-value (b2363e31, #6796, #6806)
- ngClass: handle ngClassOdd/Even affecting the same classes (55fe6d63, #5271)
Features
1.3.0-beta.4 inconspicuous-deception (2014-03-28)
Bug Fixes
- $animate:
- Scope: aggressively clean up scope on $destroy to minimize leaks (f552f251, #6794, #6856)
- doc-gen: Run Gulp on Windows too (47ba6014, #6346)
- filter.ngdoc: Check if "input" variable is defined (4a6d4de5, #6819)
- input: don't perform HTML5 validation on updated model-value (b472d027, #6796, #6806)
Features
Breaking Changes
-
$animate: due to 1bebe36a,
Any class-based animation code that makes use of transitions and uses the setup CSS classes (such as class-add and class-remove) must now provide a empty transition value to ensure that its styling is applied right away. In other words if your animation code is expecting any styling to be applied that is defined in the setup class then it will not be applied "instantly" unless a
transition:0s none
value is present in the styling for that CSS class. This situation is only the case if a transition is already present on the base CSS class once the animation kicks off.
Before:
.animated.my-class-add {
opacity:0;
transition:0.5s linear all;
}
.animated.my-class-add.my-class-add-active {
opacity:1;
}
After:
.animated.my-class-add {
transition:0s linear all;
opacity:0;
}
.animated.my-class-add.my-class-add-active {
transition:0.5s linear all;
opacity:1;
}
Please view the documentation for ngAnimate for more info.
1.3.0-beta.3 emotional-waffles (2014-03-21)
Bug Fixes
- ngAnimate: support
webkitCancelRequestAnimationFrame
in addition towebkitCancelAnimationFrame
(c839f78b, #6526) - $http: allow sending Blob data using
$http
(b8cc71d4, #5012) - $httpBackend: don't error when JSONP callback is called with no parameter (6680b7b9, #4987, #6735)
- $rootScope: ng-repeat can't handle
NaN
values. #4605 (fb6062fb, #4605) - $rootScope:
$watchCollection
should call listener with old value (78057a94, #2621, #5661, #5688, #6736) - angular.bootstrap: allow angular to load only once (748a6c8d, #5863, #5587)
- jqLite:
inheritedData()
now traverses Shadow DOM boundaries via thehost
property ofDocumentFragment
(8a96f317, #6637) - ngCookie: convert non-string values to string (36528310, #6151, #6220)
- ngTouch: update workaround for Webkit quirk (bc42950b, #6302)
- orderBy: support string predicates containing non-ident characters (37bc5ef4, #6143, #6144)
- select: avoid checking option element's
selected
property in render (f40f54c6, #2448, #5994)
Features
- $compile: add support for
$observer
deregistration (299b220f, #5609) - ngMock.$httpBackend: added support for function as URL matcher (d6cfcace, #4580)
Breaking Changes
- $compile: due to 299b220f,
calling
attr.$observe
no longer returns the observer function, but a deregistration function instead. To migrate the code follow the example below:
Before:
directive('directiveName', function() {
return {
link: function(scope, elm, attr) {
var observer = attr.$observe('someAttr', function(value) {
console.log(value);
});
}
};
});
After:
directive('directiveName', function() {
return {
link: function(scope, elm, attr) {
var observer = function(value) {
console.log(value);
};
attr.$observe('someAttr', observer);
}
};
});
- $httpBackend: due to 6680b7b9, the JSONP behavior for erroneous and empty responses changed: Previously, a JSONP response was regarded as erroneous if it was empty. Now Angular is listening to the correct events to detect errors, i.e. even empty responses can be successful.
v1.2.15 beer-underestimating (2014-03-21)
Bug Fixes
- $$RAFProvider: check for webkitCancelRequestAnimationFrame (e84da228, #6526)
- $$rAF: always fallback to a $timeout incase native rAF isn't supported (ee8e4a94, #6654)
- $compile: support templates with thead and tfoot root elements (ca0ac649, #6289)
- $http:
- $rootScope:
- angular.bootstrap: only allow angular to load once (0d60f8d3, #5863, #5587)
- jqLite: traverse
host
property for DocumentFragment in inheritedData() (98d825e1, #6637) - ngAnimate: setting classNameFilter disables animation inside ng-if (a41a2a1d, #6539)
- ngCookie: convert non-string values to string (93d1c95c, #6151, #6220)
- ngTouch: update workaround for desktop Webkit quirk (01a34f51, #6302)
- orderBy: support string predicates containing non-ident characters (10d3e1e4, #6143, #6144)
- select: avoid checking option element selected properties in render (dc149de9, #2448, #5994, #6769)
1.3.0-beta.2 silent-ventriloquism (2014-03-14)
Bug Fixes
- $$rAF: always fallback to a $timeout in case native rAF isn't supported (7b5e0199, #6654)
- $http: don't convert 0 status codes to 404 for non-file protocols (56e73ea3, #6074, #6155)
- ngAnimate: setting classNameFilter disables animation inside ng-if (129e2e02, #6539)
Features
1.3.0-beta.1 retractable-eyebrow (2014-03-07)
Bug Fixes
- $compile: support templates with thead and tfoot root elements (53ec5e13, #6289)
- style: expressions in style tags (0609453e, #2387, #6492)
Features
Breaking Changes
- build: due to eaa1d00b, As communicated before, IE8 is no longer supported.
- input: types date, time, datetime-local, month, week now always
require a
Date
object as model (46bd6dc8, #5864)
For more info: http://blog.angularjs.org/2013/12/angularjs-13-new-release-approaches.html
1.2.14 feisty-cryokinesis (2014-03-01)
Bug Fixes
- $animate:
- delegate down to addClass/removeClass if setClass is not found (18c41af0, #6463)
- ensure all comment nodes are removed during a leave animation (f4f1f43d, #6403)
- only block keyframes if a stagger is set to occur (e71e7b6c, #4225)
- ensure that animatable directives cancel expired leave animations (e9881991, #5886)
- ensure all animated elements are taken care of during the closing timeout (99720fb5, #6395)
- fix for TypeError Cannot call method 'querySelectorAll' in cancelChildAnimations (c914cd99, #6205)
- $http:
- $parse: reduce false-positives in isElement tests (5fe1f39f, #4805, #5675)
- input: use ValidityState to determine validity (c2d447e3, #4293, #2144, #4857, #5120, #4945, #5500, #5944)
- isElement: reduce false-positives in isElement tests (75515852)
- jqLite:
- numberFilter: convert all non-finite/non-numbers/non-numeric strings to the empty string (cceb455f, #6188, #6261)
- $parse: support trailing commas in object & array literals (6b049c74)
- ngHref: bind ng-href to xlink:href for SVGAElement (2bce71e9, #5904)
Features
Performance Improvements
- $animate: use rAF instead of timeouts to issue animation callbacks (4c4537e6)
- $cacheFactory: skip LRU bookkeeping for caches with unbound capacity (a4078fca, #6193, #6226)
1.2.13 romantic-transclusion (2014-02-14)
Bug Fixes
Features
Breaking Changes
-
$animate:
-
due to 4f84f6b3, ngClass and {{ class }} will now call the
setClass
animation callback instead of addClass / removeClass when both a addClass/removeClass operation is being executed on the element during the animation.Please include the setClass animation callback as well as addClass and removeClass within your JS animations to work with ngClass and {{ class }} directives.
-
due to cf5e463a, Both the
$animate:before
and$animate:after
DOM events must be now registered prior to the $animate operation taking place. The$animate:close
event can be registered anytime afterwards.DOM callbacks used to fired for each and every animation operation that occurs within the $animate service provided in the ngAnimate module. This may end up slowing down an application if 100s of elements are being inserted into the page. Therefore after this change callbacks are only fired if registered on the element being animated.
-
-
input:
-
due to a9fcb0d0, input[type=file] will no longer support ngModel. Due to browser support being spotty among target browsers, file inputs cannot be cleanly supported, and even features which technically do work (such as ng-change) work in an inconsistent way depending on the attributes of the form control.
As a workaround, one can manually listen for change events on file inputs and handle them manually.
-
1.2.12 cauliflower-eradication (2014-02-07)
Bug Fixes
- $compile: retain CSS classes added in cloneAttachFn on asynchronous directives (5ed721b9, #5439, #5617)
- $http:
- $locale: minor grammar amends for the locale
locale_lt
(95be253f, #6164) - $q: make $q.reject support
finally
andcatch
(074b0675, #6048, #6076) - docs: clarify doc for "args" in $broadcast and $emit (caed2dfe, #6047)
- filterFilter: don't interpret dots in predicate object fields as paths (339a1658, #6005, #6009)
- http: make jshint happy (6609e3da)
- jqLite: trim HTML string in jqLite constructor (36d37c0e, #6053)
- mocks:
- rename mock.animate to ngAnimateMock and ensure it contains all test helper code for ngAnimate (4224cd51, #5822, #5917)
- remove usage of $animate.flushNext in favor of queuing (906fdad0)
- always call functions injected with
inject
withthis
set to the current spec (3bf43903, #6102) - refactor currentSpec to work w/ Jasmine 2 (95f0bf9b, #5662)
- ngMock: return false from mock $interval.cancel() when no argument is supplied (dd24c783, #6103)
- ngResource:
Breaking Changes
The animation mock module has been renamed from mock.animate
to ngAnimateMock
. In addition to the rename, animations will not block within test code even when ngAnimateMock is used. However, all function calls to $animate will be recorded into $animate.queue
and are available within test code to assert animation calls. In addition, $animate.triggerReflow()
is now only available when ngAnimateMock
is used.
1.2.11 cryptocurrency-hyperdeflation (2014-02-03)
Bug Fixes
- $compile: retain CSS classes added in cloneAttachFn on asynchronous directives (5ed721b9, #5439, #5617)
- $http: update httpBackend to use ActiveXObject on IE8 if necessary (ef210e5e, #5677, #5679)
- $q: make $q.reject support
finally
andcatch
(074b0675, #6048, #6076) - filterFilter: don't interpret dots in predicate object fields as paths (339a1658, #6005, #6009)
- mocks: refactor currentSpec to work w/ Jasmine 2 (95f0bf9b, #5662)
- ngResource: don't append number to '$' in url param value when encoding URI (ce1f1f97, #6003, #6004)
1.2.10 augmented-serendipity (2014-01-24)
Bug Fixes
- $parse: do not use locals to resolve object properties (f09b6aa5, #5838, #5862)
- a: don't call preventDefault on click when a SVGAElement has an xlink:href attribute (e0209169, #5896, #5897)
- input: use Chromium's email validation regexp (79e519fe, #5899, #5924)
- ngRoute: pipe preceding route param no longer masks ? or * operator (fd6bac7d, #5920)
Features
1.2.9 enchanted-articulacy (2014-01-15)
Bug Fixes
- $animate:
- ensure the final closing timeout respects staggering animations (ed53100a)
- prevent race conditions for class-based animations when animating on the same CSS class (4aa9df7a, #5588)
- correctly detect and handle CSS transition changes during class addition and removal (7d5d62da)
- avoid accidentally matching substrings when resolving the presence of className tokens (524650a4)
- $http: ensure default headers PUT and POST are different objects (e1cfb195, #5742, #5747, #5764)
- $rootScope: prevent infinite $digest by checking if asyncQueue is empty when decrementing ttl (2cd09c9f, #2622)
Features
- $animate:
Breaking Changes
-
$http: due to e1cfb195, it is now necessary to separately specify default HTTP headers for PUT, POST and PATCH requests, as these no longer share a single object.
To migrate your code, follow the example below:
Before:
// Will apply to POST, PUT and PATCH methods $httpProvider.defaults.headers.post = { "X-MY-CSRF-HEADER": "..." };
After:
// POST, PUT and PATCH default headers must be specified separately, // as they do not share data. $httpProvider.defaults.headers.post = $httpProvider.defaults.headers.put = $httpProviders.defaults.headers.patch = { "X-MY-CSRF-HEADER": "..." };
1.2.8 interdimensional-cartography (2014-01-10)
Bug Fixes
- $http:
- $location: return '/' for root path in hashbang mode (63cd873f, #5650, #5712)
- $parse: fix CSP nested property evaluation, and issue that prevented its tests from failing (3b1a4fe0, #5591, #5592)
- closure: add Closure externs for angular.$q.Promise.finally (caeb7402, #4757)
- ngMock window.inject: Remove Error 'stack' property changes (7e916455)
Features
1.2.7 emoji-clairvoyance (2014-01-03)
Bug Fixes
- $animate:
- $http: (3d38fff8)
- $injector: remove the
INSTANTIATING
flag properly when done (186a5912, #4361, #5577) - $location:
- $resource: prevent URL template from collapsing into an empty string (131e4014, #5455, #5493)
- $sanitize: consider the
size
attribute as a valid/allowed attribute (056c8493, #5522) - Scope: don't let watch deregistration mess up the dirty-checking digest loop (884ef0db, #5525)
- input:
- ngRepeat: allow for more flexible coding style in ngRepeat expression (c9705b75, #5537, #5598)
- ngRoute: instantiate controller when template is empty (498365f2, #5550)
- ngShow/ngHide, ngIf: functions with zero args should be truthy (01c5be46, #5414)
Performance Improvements
- Scope: limit propagation of $broadcast to scopes that have listeners for the event (80e7a455, #5341, #5371)
1.2.6 taco-salsafication (2013-12-19)
Bug Fixes
- $animate: use a scheduled timeout in favor of a fallback property to close transitions (54637a33, #5255, #5241, #5405)
- $compile: remove invalid IE exceptional case for
href
(c7a1d1ab, #5479) - $location: parse xlink:href for SVGAElements (bc3ff2ce, #5472, #5198, #5199, #4098, #1420)
- $log: should work in IE8 (4f5758e6, #5400)
- $parse: return
undefined
if an intermediate property's value isnull
(26d43cac, #5480) - closure: add type definition for
Scope#$watchCollection
(8f329ffb, #5475) - forEach: allow looping over result of
querySelectorAll
in IE8 (274a6734) - input: do not hold input for composition on Android (3dc18037, #5308)
- jqLite: support unbind self within handler (2f91cfd0)
- ngRepeat: allow multiline expressions (cbb3ce2c, #5000)
- select: invalidate when
multiple
,required
, and model is[]
(5c97731a, #5337)
Features
- jqLite: provide support for
element.one()
(937caab6) - ngAnimate: provide configuration support to match specific className values to trigger animations (cef084ad, #5357, #5283)
Performance Improvements
- compile: add class 'ng-scope' before cloning and other micro-optimizations (f3a796e5, #5471)
- $parse: use a faster path when the number of path parts is low (f4462319)
- use faster check for
$$
prefix (06c5cfc7)
1.2.5 singularity-expansion (2013-12-13)
Bug Fixes
- $compile: allow literals in isolate scope references (43072e38, #5296)
- angular-mocks: use copy of mock data in $httpBackend (f69dc162)
- closure: add missing FormController extern definitions (1d5e18b0, #5303)
- ngInclude: add template to DOM before linking other directives (30a8b7d0, #5247)
- ngView: add template to DOM before linking other directives (f8944efe)
Performance Improvements
- $injector: remove invoke optimization that doesn't work (05e4fd34, #5388)
- $resource: use shallow copy instead of angular.copy (fcd2a813, #5300)
- a: do not link when href or name exists in template (f3de5b6e, #5362)
- jqLite: implement and use the
empty
method in place ofhtml(‘’)
(3410f65e, #4457)
Breaking Changes
- angular-mocks: due to f69dc162,
some tests that rely on identity comparison rather than equality comparison in checking mock http responses will be broken,
since now each mock response is a copy of the original response. This is usually fixable by changing a
.toBe()
comparison totoEqual()
inside of tests.
1.2.4 wormhole-blaster (2013-12-06)
Bug Fixes
- $animate:
- $compile:
- $rootScope:
- $sanitize: don't rely on YARR regex engine executing immediately in order to prevent object mutation (81b81856, #5193, #5192)
- closure: closure compiler shouldn't rename .defaults.transformRequest (f01087f8)
- input: ensure ngModelWatch() triggers second digest pass when appropriate (b6d54393, #5258, #5282)
- isElement: return boolean value rather than
truthy
value. (2dbb6f9a, #4519, #4534) - jqLite: ignore incompatible nodes on find() (1169b544, #4120)
- ngInit: evaluate ngInit before ngInclude (0e50810c, #5167, #5208)
- ngSanitize: prefer textContent to innerText to avoid layout trashing (bf1972dc)
Performance Improvements
- $parse: micro-optimization for ensureSafeObject function (689dfb16, #5246)
- Scope: short-circuit after dirty-checking last dirty watcher (d070450c, #5272, #5287)
1.2.3 unicorn-zapper (2013-11-27)
Bug Fixes
- $animate:
- ensure blocked keyframe animations are unblocked before the DOM operation (2efe8230, #5106)
- ensure animations are disabled during bootstrap to prevent unwanted structural animations (eed23332, #5130)
- $sanitize: use the same whitelist mechanism as
$compile
does (33352348, #3748) - input: react to form auto completion, through the
change
event, on modern browsers (a090400f, #1460) - $attrs: add
$attrs.$attr
to externs so that it isn't renamed on js minification (bcca8054)
Features
No new features in this release
Breaking Changes
There are no breaking changes in this release (promise!)
1.2.2 consciousness-inertia (2013-11-22)
Bug Fixes
- $animate:
- ensure keyframe animations are blocked around the reflow (6760d7a3, #5018)
- ensure transition animations are unblocked before the dom operation occurs (062fbed8, #5014, #4265)
- ensure addClass/removeClass animations do not snap during reflow (76e4db6f, #4892)
- ensure the DOM operation isn't run twice (7067a8fb, #4949)
- $compile:
- $httpBackend: only IE8 and below can't use
script.onload
for JSONP (a3172a28, #4523, #4527, #4922) - $parse: allow for new lines in expr when promise unwrapping is on (40647b17, #4718)
- $resource: Always return a resource instance when calling class methods on resources. (f6ecf9a3, #4545, #5061)
- httpBackend: should not read response data when request is aborted (6f1050df, #4913, #4940)
- loader: expose
$$minErr
to modules such asngResource
(9e89a31b, #5050) - ngAnimate:
- ngClass: ensure that ngClass only adds/removes the changed classes (6b8bbe4d, #4960, #4944)
- ngController: fix issue with ngInclude on the same element (6288cf5c, #4431)
- ngInclude:
- ngMock: fixes httpBackend expectation with body object (4d16472b, #4956)
- ngView: Don't throw when the ngView element contains content with directives. (e6521e74, #5069)
- tests: Correct tests for IE11 (57924234, #5046)
- input: hold listener during text composition (a4e6d962, #4684)
1.2.1 underscore-empathy (2013-11-14)
Bug Fixes
- $compile:
- $resource: don't use $parse for @dotted.member (9577702e)
- bootstrap: make IE8 happy (a61b65d0)
- loader: don't rely on internal APIs (8425e9fe, #4437, #4874)
- minErr: remove references to internal APIs (94764ee0)
- ngIf: don't create multiple elements when changing from a truthy value to another truthy value (4612705e, #4852)
- urlUtils:
Features
1.2.0 timely-delivery (2013-11-08)
Features
- animations:
- $parse: secure expressions by hiding "private" properties (3d6a89e8)
- docs:
- jqLite: expose isolateScope() getter similar to scope() (27e9340b)
- misc: add externs file for Closure Compiler (9d0a6977)
Bug Fixes
- $animate:
- don't force animations to be enabled (98adc9e0)
- only apply the fallback property if any transition animations are detected (94700807)
- avoid hanging animations if the active CSS transition class is missing (b89584db, #4732, #4490)
- ensure staggering animations understand multiple delay values (41a2d5b3)
- ensure the active class is not applied if cancelled during reflow (e53ff431, #4699)
- use direct DOM comparison when checking for $rootElement (d434eabe, #4679)
- ensure former nodes are fully cleaned up when a follow-up structural animation takes place (7f0767ac, #4435)
- ensure enable/disable animations work when the document node is used (6818542c, #4669)
- skip unnecessary addClass/removeClass animations (76b628bc, #4401, #2332)
- ensure animations work properly when the $rootElement is being animated (2623de14, #4397, #4231)
- only cancel class-based animations if the follow-up class contains CSS transition/keyframe animation code (f5289fe8, #4463, #3784)
- $compile:
- don't leak isolate scope state when replaced directive is used multiple times (b5af198f)
- correct isolate scope distribution to controllers (3fe4491a)
- replaced element has isolate scope (97c7a4e3)
- only pass isolate scope to children that belong to the isolate directive (d0efd5ee)
- make isolate scope truly isolate (909cabd3, #1924, #2500)
- don't instantiate controllers twice for element transclude directives (18ae985c, #4654)
- attribute bindings should not break due to terminal directives (79223eae, #4525, #4528, #4649)
- instantiate controllers when re-entering compilation (faf5b980, #4434, #4616)
- $injector: allow a constructor function to return a function (c22adbf1)
- $parse: check function call context to be safe (6d324c76, #4417)
- angular-mocks: add inline dependency annotation (6d23591c, #4448)
- animateSpec: run digest to enable animations before tests (aea76f0d)
- bootstrap-prettify: share $animate and $$postDigestQueue with demo apps (1df3da36)
- csp:
- docModuleComponents: implement anchor scroll when content added (eb51b024, #4703)
- input: keep track of min/max attars on-the-fly (4b653aea)
- ngAnimate: fix cancelChildAnimations throwing exception (b9557b0a, #4548)
- ngClassSpec: clear animation enable fn from postDigestQueue (ffa9d0a6)
- ngEventDirectives: parse expression only once during compile phase. (9a828738)
- ngIf:
- ngInclude: only run anchorScroll after animation is done (d378f550, #4723)
- ngMock: throw more descriptive errors for $animate.flushNext() (6fb19157)
- ngModel: deregister from the form on scope not DOM destruction (8f989d65, #4226, #4779)
- ngScenario: correctly disable animations for end 2 end tests (9d004585)
- ngView:
- ngdocs:
Breaking Changes
-
$compile:
-
due to d0efd5ee, Child elements that are defined either in the application template or in some other directives template do not get the isolate scope. In theory, nobody should rely on this behavior, as it is very rare - in most cases the isolate directive has a template.
-
due to 909cabd3, Directives without isolate scope do not get the isolate scope from an isolate directive on the same element. If your code depends on this behavior (non-isolate directive needs to access state from within the isolate scope), change the isolate directive to use scope locals to pass these explicitly.
Before
<input ng-model="$parent.value" ng-isolate> .directive('ngIsolate', function() { return { scope: {}, template: '{{value}}' }; });
After
<input ng-model="value" ng-isolate> .directive('ngIsolate', function() { return { scope: {value: '=ngModel'}, template: '{{value}} }; });
- due to 79223eae,
Previously, the interpolation priority was
-100
in 1.2.0-rc.2, and100
before 1.2.0-rc.2. Before this change the binding was setup in the post-linking phase.Now the attribute interpolation (binding) executes as a directive with priority 100 and the binding is set up in the pre-linking phase.
-
-
$parse: due to 3d6a89e8,
This commit introduces the notion of "private" properties (properties whose names begin and/or end with an underscore) on the scope chain. These properties will not be available to Angular expressions (i.e. {{ }} interpolation in templates and strings passed to
$parse
) They are freely available to JavaScript code (as before).Motivation
Angular expressions execute in a limited context. They do not have direct access to the global scope,
window
,document
or the Function constructor. However, they have direct access to names/properties on the scope chain. It has been a long standing best practice to keep sensitive APIs outside of the scope chain (in a closure or your controller.) That's easier said that done for two reasons:- JavaScript does not have a notion of private properties so if you need someone on the scope chain for JavaScript use, you also expose it to Angular expressions
- the new "controller as" syntax that's now in increased usage exposes the entire controller on the scope chain greatly increasing the exposed surface.
Though Angular expressions are written and controlled by the developer, they:
- Typically deal with user input
- Don't get the kind of test coverage that JavaScript code would
This commit provides a way, via a naming convention, to allow publishing/restricting properties from controllers/scopes to Angular expressions enabling one to only expose those properties that are actually needed by the expressions.
-
csp: due to 08f376f2, triggering ngCsp directive via
ng:csp
attribute is not supported any more. Please usedata-ng-csp
instead. -
jqLite: due to 27e9340b,
jqLite.scope()
(commonly used throughangular.element(node).scope()
) does not return the isolate scope on the element that triggered directive with isolate scope. UsejqLite.isolateScope()
instead.
1.2.0-rc.3 ferocious-twitch (2013-10-14)
Features
-
$interval: add a service wrapping setInterval (2b5ce84f)
-
$sce: simpler patterns for
$sceDelegateProviders
white/blacklists (93ce5923, #4006) -
$filter: allow map of filters to be registered (4033cf28, #4036, #4091)
-
$compile: support
tel:
links ina[href]
(e7730297) -
Directives:
-
Misc:
Bug Fixes
-
$compile:
- abort compilation when duplicate element transclusion (63c5334c, #3893, #4217, #3307)
- make order directives w/ same priority deterministic (4357da85)
- fix (reverse) directive postLink fn execution order (31f190d4, #3558)
- don't terminate compilation for regular transclusion directives (fe214501)
- ng-attr to support dash separated attribute names (8e6e3eba)
- allow interpolations for non-event handlers attrs (8e1276c0)
- link parents before traversing (742271ff, #3792, #3923, #3935, #3927)
- collect ranges on multiple directives on one element (6a8edc1d, #4002)
-
$parse:
-
$httpBackend:
-
$location:
-
$log: prevent logging
undefined
for $log in IE (4ff1a650, #1705) -
Scope:
-
Filters:
- date: allow negative millisecond value strings (025c9219)
-
Directives:
- correct priority of structural directives (ngRepeat, ngSwitchWhen, ngIf, ngInclude, ngView) (b7af76b4)
- input:
false
is no longer an empty value by default (b56b21a8, #3490) - ngBindHtml: watch string value instead of wrapper (e2068ad4, #3932)
- ngOptions: ignore object properties which start with $ (aa3c54c7)
- ngRepeat: correctly track elements even when the collection is initially undefined (31c56f54, #4145, #3964)
- ngTransclude: detect ngTransclude usage without a transclusion directive (5a1a6b86, #3759)
-
jqLite:
-
Misc:
-
ngRoute:
-
ngResource:
-
ngSanitize:
-
ngTouch:
-
ngAnimate:
- ensure that a timeStamp is created if not provided by the browser event (cd216c4c, #3053)
- perform internal caching on getComputedStyle to boost the performance of CSS3 transitions/animations (b1e604e3, #4011, #4124)
- ensure structural animations skip all child animations even if no animation is present during compile (cc584607, #3215)
- cancel any ongoing child animations during move and leave animations (3f31a7c7)
- ensure elapsedTime always considers delay values (079dd939)
- ensure transition-property is not changed when only keyframe animations are in use (2df3c9f5, #3933)
- avoid completing the animation asynchronously unless CSS transitions/animations are present (2a63dfa6, #4023, #3940)
- ensure that delays are always considered before an animation closes (0a63adce, #4028)
- check elapsedTime on current event (d50ed6bf)
- support addClass/removeClass animations on SVG nodes (c785267e, #3858)
-
ngScenario:
Breaking Changes
-
$compile: due to 31f190d4, the order of postLink fn is now mirror opposite of the order in which corresponding preLinking and compile functions execute.
Previously the compile/link fns executed in this order controlled via priority:
- CompilePriorityHigh, CompilePriorityMedium, CompilePriorityLow
- compile child nodes
- PreLinkPriorityHigh, PreLinkPriorityMedium, PreLinkPriorityLow
- link child nodes
- PostLinkPriorityHigh, PostLinkPriorityMedium, PostLinkPriorityLow
This was changed to:
- CompilePriorityHigh, CompilePriorityMedium, CompilePriorityLow
- compile child nodes
- PreLinkPriorityHigh, PreLinkPriorityMedium, PreLinkPriorityLow
- link child nodes
- PostLinkPriorityLow, PostLinkPriorityMedium , PostLinkPriorityHigh
Very few directives in practice rely on order of postLinking function (unlike on the order of compile functions), so in the rare case of this change affecting an existing directive, it might be necessary to convert it to a preLinking function or give it negative priority (look at the diff of this commit to see how an internal attribute interpolation directive was adjusted).
-
$parse:
- due to 5dc35b52,
$parse and templates in general will no longer automatically unwrap promises. This feature has been deprecated and if absolutely needed, it can be reenabled during transitional period via
$parseProvider.unwrapPromises(true)
api. - due to b6a37d11, feature added in rc.2 that unwraps return values from functions if the values are promises (if promise unwrapping is enabled - see previous point), was reverted due to breaking a popular usage pattern.
- due to 5dc35b52,
$parse and templates in general will no longer automatically unwrap promises. This feature has been deprecated and if absolutely needed, it can be reenabled during transitional period via
-
directives: due to b7af76b4, the priority of ngRepeat, ngSwitchWhen, ngIf, ngInclude and ngView has changed. This could affect directives that explicitly specify their priority.
In order to make ngRepeat, ngSwitchWhen, ngIf, ngInclude and ngView work together in all common scenarios their directives are being adjusted to achieve the following precedence:
Directive | Old Priority | New Priority ============================================= ngRepeat | 1000 | 1000 --------------------------------------------- ngSwitchWhen | 500 | 800 --------------------------------------------- ngIf | 1000 | 600 --------------------------------------------- ngInclude/ngView | 1000 | 400
-
form/ngForm due to 7a586e5c, Inputs with name equal to "hasOwnProperty" are not allowed inside form or ngForm directives.
Before, inputs whose name was "hasOwnProperty" were quietly ignored and not added to the scope. Now a badname exception is thrown.
Using "hasOwnProperty" for an input name would be very unusual and bad practice.
Either do not include such an input in a
form
orngForm
directive or change the name of the input. -
ngScenario: due to 28f56a38, browserTrigger now uses an eventData object instead of direct parameters for mouse events. To migrate, place the
keys
,x
andy
parameters inside of an object and place that as the third parameter for the browserTrigger function.
1.2.0-rc.2 barehand-atomsplitting (2013-09-04)
Features
- Scope: asynchronously auto-flush
$evalAsync
queue when outside of$digest
cycle (6b91aa0a, #3539, #2438) - minErr: log minerr doc url in development builds (37123cd2, #3566)
- ngMock:
Bug Fixes
-
$injector: don't parse fns with no args (44b6b72e)
-
$parse: handle promises returned from parsed function calls (3a658220, #3503)
-
$q:
-
$location: fix history problems on Boxee box (eefcdad0)
-
$timeout: clean deferreds immediately after callback exec/cancel (920a3804)
-
Directives:
-
Filters:
-
Misc:
-
i18n: remove obsolete locale files (6382e21f)
-
ngAnimate:
- ensure that
ngClass
is always compiled before enter, leave and move animations are applied (36ad40b1, #3727, #3603) - cut down on extra
$timeout
calls (4382df03) - skip
ngAnimate
animations if the provided element already has transitions applied to it (7c605ddf, #3587) - only apply a timeout when transitions or keyframe animations are used (ee2f3d21, #3613)
- ensure older versions of webkit work for animations (b1a43cd0)
- ensure that
-
ngMocks:
$logProvider
should not use internal APIs (baaa73ee, #3612)
Breaking Changes
- i18n: due to 6382e21f, some uncommon region-specific local files were removed.
1.0.8 bubble-burst (2013-08-22)
Contains only these fixes cherry-picked from v1.2.0rc1.
Bug Fixes
-
$compile:
-
$http: ensure case-insensitive header overriding (25d9f5a8)
-
$location:
-
$parse: move global getter out of parse.js (099138fb)
-
$q: call
reject()
even if$exceptionHandler
rethrows (d59027c4) -
$timeout: clean deferreds immediately after callback exec/cancel (ac69392c)
-
$sanitize: match URI schemes case-insensitively (fcd761b9, #3210)
-
Scope: watches can be safely unregistered inside watch handlers (a4ec2979, #2915)
-
ngMock
- $timeout should forward delay argument (a5fb372e)
-
jqLite:
-
Directives:
- form: pick the right attribute name for ngForm (dc1e55ce, #2997)
- input: fix the email regex to accept TLDs up to 6 characters long (ad76e77f)
- ngCloak: hide element even when CSS 'display' is set (06b0930b)
- ngSubmit: expose $event to ngSubmit callback (b0d5f062)
- ngValue: made ngValue to write value attribute to element (3b898664)
-
Filters:
-
i18n: Do not transform arrays into objects (751c77f8)
-
jqLite:
-
Misc:
1.2.0rc1 spooky-giraffe (2013-08-13)
Features
-
ngAnimate: complete rewrite of animations (81923f1e)
-
$sce: new $sce service for Strict Contextual Escaping and lots of other security enhancements (bea9422e)
-
minErr: add error message minification and better error messages (c8fcf3b3, 09fa0656, b8ea7f6a)
-
$compile:
-
$http: accept function as headers value (a7150f12)
-
$q:
-
$resource:
-
$route: express style route matching (support for optional params and new wildcard syntax) (04cebcc1)
-
jqLite: switch bind/unbind to more recent jQuery on/off (f1b94b4b)
-
Misc:
-
Directives:
-
ngMobile/ngTouch:
-
ngMock:
-
scenario: expose jQuery for usage outside of angular scenario (3fdbe81a)
-
ngDocs:
- provide support for user to jump between different versions of the angularjs doc (46dfb92a)
- add links to source for API (52d6a599)
- support popover, foldouts and foldover annotations (ef229688)
- provide documentation for the new ngRepeat repeater syntax (b3650457)
- provide support for inline variable hinting (21c70729)
Bug Fixes
-
$compile:
- correct controller instantiation for async directives (c173ca41, #3493, #3482, #3537, #3540)
- always instantiate controllers before pre-link fns run (5c560117, #3493, #3482, #3514)
- always instantiate controllers in parent->child order (45f9f623, #2738)
- don't check attr.specified on non-ie7 (f9ea69f6, #3231, #2160)
- allow
data:
image URIs inimg[src]
bindings (3e39ac7e) - empty normalized href url should pass sanitation check (fc8c9baa, #2219)
- prevent infinite loop w/ replace+transclude directives (69f42b76, #2155)
- reject multi-expression interpolations for
src
attribute (38deedd6) - disallow interpolations for DOM event handlers (39841f2e)
- sanitize values bound to
img[src]
(1adf29af) - support multi-element group over text nodes (b28f9694)
- correct component transclusion on compilation root. (15e1a29c)
-
$http:
-
$location:
-
$parse:
-
$q: call
reject()
even if$exceptionHandler
rethrows (664526d6) -
$resource: check whether response matches action.isArray (a644ca7b, #2255)
-
$sanitize: match URI schemes case-insensitively (7fef06fe, #3210)
-
Scope:
-
jqLite:
- properly detect unsupported calls for on()/off() (3824e400, 4f5dfbc3, #3501)
- return array from multi select in val() (306a6134)
- forgive unregistration of a non-registered handler (ab59cc6c)
- support space-separated events in off (bdd4e982, #3256)
- prepend array in correct order (fd87eb0c)
- allow override of jqLite.triggerHandler event object (0cac8729)
- added optional name arg in removeData (e1a050e6)
- correctly monkey-patch core jQuery methods (da5f537c)
-
i18n: Do not transform arrays into objects (b3d7a038)
-
ngMobile/ngTouch:
-
ngMock:
-
ngScenario: select().option(val) should prefer exact value match (22a9b1ac, #2856)
-
Directives:
-
ngRepeat:
-
ngShowHide: change the .ng-hide CSS class to use an !important flag (246c1439)
-
ngSubmit: expose $event to ngSubmit callback (3371fc25)
-
ngValue: made ngValue to write value attribute to element (09a1e7af)
-
ngView: ensure ngView is terminal and uses its own manual transclusion system (87405e25)
-
ngCloak: hide ngCloak-ed element even when CSS 'display' is set (3ffddad1)
-
input[email]
: fix the email regex to accept TLDs up to 6 characters long (af731354) -
form: pick the right attribute name for ngForm (0fcd1e3b, #2997)
-
select: don't support binding to
select[multiple]
(d87fa004, #3230)
-
-
Filters:
- numberFilter: always convert scientific notation to decimal (a13c01a8)
-
Misc:
- detect transition/animation on older Android browsers (ef5bc6c7)
- handle duplicate params in parseKeyValue/toKeyValue (80739409)
- don't crash on invalid query parameters (8264d080)
- change angular.copy to correctly clone RegExp (f80730f4, #3473, #3474)
- angular.equals now supports for regular expressions (724819e3, #2685)
- angular.equals should not match keys defined in the prototype chain (7829c50f)
- angular.equals should not consider {} and [] to be equivalent (1dcafd18)
- angular.bootstrap should throw an error when bootstrapping a bootstrapped element (3ee744cc)
- angular.toJson should skip JSON.stringify for undefined (5a294c86)
- change css wrapping in grunt to prepend styles to the top of the head tag (fbad068a)
Breaking Changes
-
ngAnimate: due to 81923f1e, too many things changed, we'll write up a separate doc with migration instructions and will publish it at http://yearofmoo.com. Please check out the ngAnimate module docs and $animate api docs in the meantime.
-
$compile:
-
due to 1adf29af and 3e39ac7e,
img[src]
URLs are now being sanitized and a whitelist configured via$compileProvider
can be used to configure what safe urls look like.By default all common protocol prefixes are whitelisted including
data:
URIs with mime typesimage/*
. Therefore this change is expected to have no impact on apps that don't contain malicious image links. -
due to 38deedd6, binding more than a single expression to
*[src]
or*[ng-src]
with the exception of<a>
and<img>
elements is not supported.Concatenating expressions makes it hard to understand whether some combination of concatenated values are unsafe to use and potentially subject to XSS vulnerabilities. To simplify the task of auditing for XSS issues, we now require that a single expression be used for
*[src/ng-src]
bindings such as bindings foriframe[src]
,object[src]
, etc. (but notimg[src/ng-src]
since that value is sanitized).
This change ensures that the possible pool of values that are used for data-binding is easier to trace down.
To migrate your code, follow the example below:
Before: JS: scope.baseUrl = 'page'; scope.a = 1; scope.b = 2; HTML: <!-- Are a and b properly escaped here? Is baseUrl controlled by user? --> <iframe src="{{baseUrl}}?a={{a}&b={{b}}"> After: JS: var baseUrl = "page"; scope.getIframeSrc = function() { // There are obviously better ways to do this. The // key point is that one will think about this and do // it the right way. var qs = ["a", "b"].map(function(value, name) { return encodeURIComponent(name) + "=" + encodeURIComponent(value); }).join("&"); // baseUrl isn't on scope so it isn't bound to a user // controlled value. return baseUrl + "?" + qs; } HTML: <iframe src="{{getIframeSrc()}}">
-
due to 39841f2e, 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.To migrate the code follow the example below:
Before:
JS: scope.foo = 'alert(1)'; HTML: <div onclick="{{foo}}">
After:
JS: scope.foo = function() { alert(1); } HTML: <div ng-click="foo()">
-
due to e46100f7, existing directives with name ending with
"-start"
or"-end"
will stop working.This change was necessary to enable multi-element directives. The best fix is to rename existing directives, so that they don't end with these suffixes.
-
-
$q: due to f078762d, the
always
method is now exposed asfinally
.The reason for this change is to align
$q
with the Q promise library, despite the fact that this makes it a bit more difficult to use with non-ES5 browsers, like IE8.finally
also goes well together withcatch
api that was added to $q recently and is part of the DOM promises standard.To migrate the code follow the example below:
Before:
$http.get('/foo').always(doSomething);
After:
$http.get('/foo').finally(doSomething);
or for IE8 compatible code:
$http.get('/foo')['finally'](doSomething);
-
$resource:
-
due to 05772e15, resource instance does not have a
$then
function anymore. Use the$promise.then
instead.Before:
Resource.query().$then(callback);
After:
Resource.query().$promise.then(callback);
-
due to 05772e15, instance methods return the promise rather than the instance itself.
Before:
resource.$save().chaining = true;
After:
resource.$save(); resource.chaining = true;
-
due to 05772e15, on success, the resource promise is resolved with the resource instance rather than http response object.
Use interceptor api to access the http response object.
Before:
Resource.query().$then(function(response) {...});
After:
var Resource = $resource('/url', {}, { get: { method: 'get', interceptor: { response: function(response) { // expose response return response; } } } });
-
-
$route:
-
due to 04cebcc1, the syntax for named wildcard parameters in routes has changed from
*wildcard
to:wildcard*
To migrate the code, follow the example below. Here,
*highlight
becomes:highlight*
:Before:
$routeProvider.when('/Book1/:book/Chapter/:chapter/*highlight/edit', {controller: noop, templateUrl: 'Chapter.html'});
After:
$routeProvider.when('/Book1/:book/Chapter/:chapter/:highlight*/edit', {controller: noop, templateUrl: 'Chapter.html'});
-
due to 5599b55b, applications that use
$route
will now need to load an angular-route.js file and define a dependency on the ngRoute module.Before:
... <script src="angular.js"></script> ... var myApp = angular.module('myApp', ['someOtherModule']); ...
After:
... <script src="angular.js"></script> <script src="angular-route.js"></script> ... var myApp = angular.module('myApp', ['ngRoute', 'someOtherModule']); ...
-
-
$location: due to 80739409,
$location.search
now supports multiple keys with the same value provided that the values are stored in an array in$location.search
.Before this change:
parseKeyValue
only took the last key overwriting all the previous keys;toKeyValue
joined the keys together in a comma delimited string.
This was deemed buggy behavior. If your server relied on this behavior then either the server should be fixed, or a simple serialization of the array should be done on the client before passing it to $location.
-
ngBindHtml, sce: due to dae69473,
ngHtmlBindUnsafe
has been removed and replaced byngHtmlBind
(which has been moved fromngSanitize
module to the coreng
module).ngBindHtml
providesngHtmlBindUnsafe
like behavior (evaluate an expression and innerHTML the result into the DOM) when bound to the result of$sce.trustAsHtml(string)
. When bound to a plain string, the string is sanitized via$sanitize
before being innerHTML'd. If the$sanitize
service isn't available (ngSanitize
module is not loaded) and the bound expression evaluates to a value that is not trusted an exception is thrown. -
ngForm: due to 8ea802a1,
If you have form names that will evaluate as an expression:
<form name="ctrl.form">
And if you are accessing the form from your controller:
Before:
function($scope) { $scope['ctrl.form'] // form controller instance }
After:
function($scope) { $scope.ctrl.form // form controller instance }
This makes it possible to access a form from a controller using the new "controller as" syntax. Supporting the previous behavior offers no benefit.
-
ngView: due to 7d69d52a, previously ngView only updated its content, after this change ngView will recreate itself every time a new content is included. This ensures that a single rootElement for all the included contents always exists, which makes definition of css styles for animations much easier.
-
ngInclude: due to aa2133ad, previously ngInclude only updated its content, after this change ngInclude will recreate itself every time a new content is included. This ensures that a single rootElement for all the included contents always exists, which makes definition of css styles for animations much easier.
-
select: due to d87fa004, binding to
select[multiple]
directly or via ngMultiple (ng-multiple) directive is not supported. This feature never worked with two-way data-binding, so it's not expected that anybody actually depends on it. -
ngMobile: due to 94ec84e7, since all the code in the ngMobile module is touch related, we are renaming the module to ngTouch.
To migrate, please replace all references to "ngMobile" with "ngTouch" and "angular-mobile.js" to "angular-touch.js".
1.1.5 triangle-squarification (2013-05-22)
Note: 1.1.x releases are considered unstable. They pass all tests but we reserve the right to change new features/apis in between minor releases. Check them out and please give us feedback.
Note: This release also contains all bug fixes available in 1.0.7.
Features
-
$animator:
-
$http:
-
$parse: add support for ternary operators to parser (6798fec4)
-
$q: add $q.always() method (6605adf6)
-
$controller: support "Controller as" syntax (cd38cbf9, 400f9360)
-
Directives:
-
Mobile:
-
docs:
-
scenario runner: adds mousedown and mouseup event triggers to scenario (629fb373)
Bug Fixes
-
$animator: remove dependency on window.setTimeout (021bdf39)
-
$controller: allow dots in a controller name (de2cdb06)
-
$location:
-
$resource:
-
$rootScope: ensure $watchCollection correctly handles arrayLike objects (6452707d)
-
date filter: correctly format dates with more than 3 sub-second digits (4f2e3606)
-
jqLite: pass a dummy event into triggerHandler (0401a7f5)
-
Directives:
-
scenario runner: correct bootstrap issue on IE (ab755a25)
-
Breaking Changes
-
$animator/ngAnimate: due to 11f712bc, css transition classes changed from
foo-setup
/foo-start
tofoo
/foo-active
The CSS transition classes have changed suffixes. To migrate rename
.foo-setup {...} to .foo {...} .foo-start {...} to .foo-active {...}
or for type: enter, leave, move, show, hide
.foo-type-setup {...} to .foo-type {...} .foo-type-start {...} to .foo-type-active {...}
-
$resource: due to 53061363, a
/
followed by a.
, in the last segment of the URL template is now collapsed into a single.
delimiter.For example:
users/.json
will becomeusers.json
. If your server relied upon this sequence then it will no longer work. In this case you can now escape the/.
sequence with/\.
1.0.7 monochromatic-rainbow (2013-05-22)
Bug Fixes
-
$browser: should use first value for a cookie. (3952d35a, #2635)
-
$cookieStore: $cookieStore.get now parses blank string as blank string (cf4729fa)
-
$location: back-button should fire $locationChangeStart (dc9a5806, #2109)
-
$parse: Fix context access and double function call (7812ae75, #2496)
-
dateFilter: correctly format ISODates on Android<=2.1 (f046f6f7, #2277)
-
jqLite: correct implementation of mouseenter/mouseleave event (06f2b2a8, #2131)
-
angular.copy/angular.extend: do not copy $$hashKey in copy/extend functions. (6d0b325f, #1875)
-
i18n: escape all chars above \u007f in locale files (695c54c1, #2417)
-
Directives:
- ngPluralize: handle the empty string as a valid override (67a4a25b, #2575)
- select: ensure empty option is not lost in IE9 (4622af3f, #2150)
- ngModel: use paste/cut events in IE to support context menu (363e4cbf, #1462)
- ngClass: should remove classes when object is the same but property has changed (0ac969a5)
-
PhoneCat Tutorial: renamed Testacular to Karma (angular-phonecat)
1.1.4 quantum-manipulation (2013-04-03)
Note: 1.1.x releases are considered unstable. They pass all tests but we reserve the right to change new features/apis in between minor releases. Check them out and please give us feedback.
Note: This release also contains all bug fixes available in 1.0.6.
Features
-
$compile:
-
$q:
$q.all()
now accepts hash (e27bb6eb) -
$resource: ability to override url in resource actions (60f1f099)
-
$route: add
caseInsensitiveMatch
option for url matching (5e18a15f) -
http:
-
JQLite:
ready()
now supportsdocument.readyState=='complete'
(753fc9e5) -
Scenario: autodisable animations when running e2e tests (fec4ef38)
-
Scope: add
$watchCollection
method for observing collections (5eb96855) -
angular.bootstrap: support deferred bootstrap (mainly useful for tools like test runners and Batarang) (603fe0d1)
-
ngMobile: add ngMobile module with mobile-specific ngClick (707c65d5)
-
Directives:
Breaking Changes
-
$route: due to 6f71e809, in $routeChangeStart event, nextRoute.$route property is gone. Use the nextRoute object itself instead of nextRoute.$route.
-
ngRepeat: due to 61f2767c, it is now considered an error to have two identical items (identified by the new "track by" expression) in a collection that is fed into the repeater. This behavior was previously tolerated.
-
ngSwitch: due to e88d6179, elements not in the ng-switch were rendered after the ng-switch elements. Now they are rendered in-place.
Templates with ngSwitch directives and nested non-ngSwitchWhen elements should be updated to preserve render order.
For example: The following was previously rendered with
<li>1</li>
after<li>2</li>
:<ul ng-switch="select"> <li>1</li> <li ng-switch-when="option">2</li> </ul>
To keep the old behavior, use:
<ul ng-switch="select"> <li ng-switch-when="1">2</li> <li>1</li> </ul>
1.0.6 universal-irreversibility (2013-04-04)
Bug Fixes
- $compile:
- $http: don't encode URL query substring "null" to "+" (86d191ed)
- $httpBackend: prevent DOM err due to dereferencing .responseText (509ec745, #1922)
- $location:
- $route: make nextRoute.$route private (6f71e809, #1907)
- mocks: prevent NPE when module definition outside of it. (5c735eb4)
- dateFilter: correct timezone date filter for 1/2 hour offsets (1c1cd4fd)
1.1.3 radioactive-gargle (2013-02-20)
Note: 1.1.x releases are considered unstable. They pass all tests but we reserve the right to change new features/apis in between minor releases. Check them out and please give us feedback.
Note: This release also contains all bug fixes available in 1.0.5.
Bug Fixes
- $compile:
- $http:
- do not encode special characters
@$:,
in params (288b69a3)
- do not encode special characters
- $resource:
- params should expand array values properly (2a212344)
Features
- $http: allow overriding the XSRF header and cookie name (8155c3a2)
- $parse: added
constant
andliteral
properties (1ed63858) - $resource: expose promise based api via $then and $resolved (dba6bc73)
- $routeProvider: add support to catch-all parameters in routes (7eafbb98)
- Scope:
- angular.noConflict: added api to restore previous angular namespace reference (12ba6cec)
- Directives:
- Filters:
Breaking Changes
- $http: due to 288b69a3,
$http now follows RFC3986 and does not encode special characters like
$@,:
in params. If your application needs to encode these characters, encode them manually, before sending the request. - $resource: due to 2a212344, if the server relied on the buggy behavior of serializing arrays as http query arguments then either the backend should be fixed or a simple serialization of the array should be done on the client before calling the resource service.
1.0.5 flatulent-propulsion (2013-02-20)
Bug Fixes
- $compile:
- $cookies: set cookies on Safari&IE when
base[href]
is undefined (70909245, #1190) - $http:
- $resource:
- update RegExp to allow urlParams with out leading slash (b7e1fb05)
- Directives:
- Filters:
- scenario runner: include error messages in XML output (d46fe3c2)
- Misc:
1.1.2 tofu-animation (2013-01-22)
Note: 1.1.x releases are considered unstable. They pass all tests but we reserve the right to change new features/apis in between minor releases. Check them out and please give us feedback.
Note: This release also contains all bug fixes available in 1.0.4.
Features
- $compile: support modifying the DOM structure in postlink fn (cdf6fb19)
- $log: add $log.debug() (9e991ddb, #1592)
- $parse: allow strict equality in angular expressions (a179a9a9, #908)
- $resource:
- $route: allow using functions as template params in 'when' (faf02f0c)
- $timeout-mock: add verifyNoPendingTasks method (f0c6ebc0, #1245)
- directive:
- limitTo filter: limitTo filter accepts strings (9e96d983, #653)
- scenario:
Breaking Changes
- date: due to cc821502, string input without timezone info is now parsed as local time/date
1.0.4 bewildering-hair (2013-01-22)
Bug Fixes
- $compile:
- $injector:
- $resource:
- $route:
- Scope: ensure that a scope is destroyed only once (d6da505f, #1627)
- angular.equals:
- date filter: parse string input as local time unless TZ is specified (cc821502, #847)
- jqLite:
- scenario: don't trigger input events on IE9 (8b9e6c35)
- Directives:
Features
- $compile: support modifying the DOM structure in postlink fn (cdf6fb19)
1.1.1 pathological-kerning (2012-11-26)
Note: 1.1.x releases are considered unstable. They pass all tests but we reserve the right to change new features/apis in between minor releases. Check them out and please give us feedback.
Note: This release also contains all bug fixes available in 1.0.3.
Features
- $cacheFactory: cache.put now returns the added value (168db339)
- $http: Allow setting withCredentials on defaults (209b67df, #1095)
- $resource: support custom headers per action (fbdab513, #736)
- $sanitize: support telephone links (04450c48)
- FormController: add ability to reset a form to pristine state (733a97ad, #856)
- jqLite: add triggerHandler() (650fd933)
- linky filter: allow optional 'target' argument (610927d7, #1443)
- angular-mocks: support mocha in angular mocks (92558fe4)
- ngModel: support ngTrim attribute on input (d519953a)
- scenario: add dblclick method to the ngScenario dsl (8cb9c99e)
- CSP: update to the latest CSP api (af7e0bd0, #1577)
Bug Fixes
- $http:
- config.param should expand array values properly (see breaking change notes below) (79af2bad, #1363)
- prevent CORS preflight checks by removing
X-Requested-With
from header defaults (see breaking change notes below) (3a75b112, #1004) - prevent CORS preflight checks by not setting
X-XSFR-TOKEN
header for cross domain requests (see breaking change notes below) (fce100a4, #1096)
Refactorings
- $evalAsync: have only one global async queue (331cd5a8)
Breaking Changes
-
Due to fix for #1363 it's possible but unlikely that $http will start generating different URLs for requests. This affects only cases when a request is made with a parameter, value of which is an array. If the server relied on the buggy behavior then either the backend should be fixed or a simple serialization of the array should be done on the client before calling the $http service.
-
Due to fix for #1004 the
X-Requested-With
header is not set by $http service any more. If anyone actually uses this header it's quite easy to add it back via:myAppModule.config(['$httpProvider', function($httpProvider) { $httpProvider.defaults.headers.common["X-Requested-With"] = 'XMLHttpRequest'; }]);
-
Due to fix for #1096
X-XSFR-TOKEN
header is no longer send for cross domain requests. This shouldn't affect any known production service. If we are wrong, please let us know ;-)
1.0.3 bouncy-thunder (2012-11-26)
Bug Fixes
- $cacheFactory: return undefined when removing non-existent entry (55d15806, #1497)
- $compile:
- $injector: more conservative annotation parsing
- $location: reset $location.$$replace with every watch call (a32bc40f, #1111) (d9eff86e)
- $parser: string concatenation with undefined model (42c38b29, #988)
- $resource:
- Scope:
- $route: support inline annotation on .resolve (b0a05a75)
- FormController: propagate dirty state to parent forms (04329151)
- a: prevent Opera from incorrectly navigating on link click (c81d8176)
- jqLite:
- Filters
- Directives
- ngClass: works with class interpolation (cebd015f, #1016)
- ngClassOdd/ngClassEven: support shrinking/reordering in repeaters (d859dcec, 6c67719d, #1076)
- ngModel: sync ngModel state with scope state (e6d9bea4, #933)
- ngRepeat: now works better with primitive types (e6d9bea4, #933)
- ngSrc: don't set src if value is empty string (b6e4a711)
- select: select option with a label of 0 is not shown (b3cae4f4, #1401)
- scenario:
Docs
- add plunkr support (7c67b2fb)
- various small documentation fixes and improvements
Refactorings
1.1.0 increase-gravatas (2012-08-31)
Note: 1.1.x releases unlike 1.0.x are considered unstable. More info
This release also contains all bug fixes available in 1.0.2.
Features
- $http: support custom responseType (e0a54f6b, #1013)
- $interpolate:
- $sniffer: auto detect CSP mode (currently requires Chrome on dev channel) (167aa0c2)
1.0.2 debilitating-awesomeness (2012-08-31)
Bug Fixes
- $compile: denormalize directive templates (dfe99836)
- $interpolate: $interpolateProvider.endSymbol() returns startSymbol (20348717)
- jqLite: better support for xhtml (d3fa7a2e, #1301)
- mocks: free up memory after every spec (1a8642aa)
- e2e test runner: Adding meta tag to avoid cache issues (5318588d)
- Directives:
Docs
- Conceptual Overview of AngularJS (high level overview of how things work): http://docs.angularjs.org/guide/concepts (7a5f25f6)
- Lots of spelling, grammar and other fixes: 9a710c78, 847d2da0, dbefd671, cab5e1d9, f00b6cca, 2e365168, 536de148, a1107e81, 5ef9ed87, 8c81a0f3, bde931af, 6553fe68, 13b5fd1b, 17209d5b, 31c82560, ab6937e2, fbfda241, 206371b7, b6b92bd8, 79f2d843, 64a9cd8f, 7f6e1326, 1fd2b3d4, d56d69cc, 01e726b2, 16136216, 92a3d282, 4c585019, c076fe08, 2473412b, 1f2d5000, 5026315d, f0a090dd, 6d9313a6) and more!
1.0.1 thorium-shielding (2012-06-25)
Bug Fixes
- $location: don't throw exception while url rewriting if element was removed (3da4194f, #1058)
- $location: prevent ie from getting into redirect loop (ffb27013, #1075, #1079, #1085)
1.0.0 temporal-domination (2012-06-13)
Bug Fixes
- $location:
1.0.0rc12 regression-extermination (2012-06-12)
Bug Fixes
Cleanup
1.0.0rc11 promise-resolution (2012-06-10)
Features
- $route:
- $compile: simplify isolate scope bindings and introduce true two-way data-binding between parent scope and isolate scope (c3a41ff9)
- $injector: provide API for retrieving function annotations (4361efb0)
- $location: add $locationChange[start|success] event - since events are cancelable, it's now possible to cancel route and location changes. (92a2e180)
- $rootElement: expose application root element as $rootElement service (85632cb4)
Bug Fixes
- $compile: correctly merge class attr for replace directives (contributed by Max Martinsson, fb99b539, #1006)
- $http: add utf-8 to default Content-Type header (post/put) (10f80d7d)
- $timeout: allow calling $timeout.cancel() with undefined (contributed by Ali Mills, 1904596e)
- jqLite: don't eat event exceptions (416a7830)
Breaking Changes
-
$beforeRouteChange and $afterRouteChange events were renamed to $routeChangeStart and $routeChangeSuccess
This was done to make the naming consistent with $location events and also get events to categorize and order nicely just by alphabetical sorting.
(7c242821)
-
template
option in $route definition was renamed totemplateUrl
The
template
options in $route definition now represents the actual template string. To provide the template url usetemplateUrl
option instead. This was done to unify the directive and $route definitions.To migrate just rename
template
totemplateUrl
. (0a6e464a) -
isolate scope bindings definition has changed
To migrate the code follow the example below:
Before:
scope: { myAttr: 'attribute', myBind: 'bind', myExpression: 'expression', myEval: 'evaluate', myAccessor: 'accessor' }
After:
scope: { myAttr: '@', myBind: '@', myExpression: '&', // myEval - usually not useful, but in cases where the expression is assignable, you can use '=' myAccessor: '=' // in directive's template change myAccessor() to myAccessor }
-
the inject option for the directive controller injection was removed
The removed
inject
wasn't generally useful for directives so there should be no code using it. (c3a41ff9)
1.0.0rc10 tesseract-giftwrapping (2012-05-23)
Features
- $timeout: add
$timeout
service that supersedes$defer
(4511d39c, #704, #532) - scope: add
event.preventDefault()
andevent.defaultPrevented
(84542d24)
Bug Fixes
- ngRepeat: expose
$first
,$middle
and$last
instead of$position
(1d388676, #912) - jqLite: use the same expando store structure as jQuery (acf095d1)
- $rootScope: infinite digest exception does not clear $$phase (5989a1ed, #979)
Breaking Changes
-
ngRepeat -
$position
is not exposed in repeater scopes any moreTo update, search for
/\$position/
and replace it with one of$first
,$middle
or$last
. (1d388676) -
scope event's
cancel
method was renamed tostopPropagation
The name was corrected in order to align better with DOM terminology. To update, search for
/\.\s*cancel\s*(/
and replace it with.stopPropagation(
or.preventDefault(
(or both) depending on what you actually need. (91db9920)
Deprecation Warnings
-
$defer
service has been deprecated in favor of$timeout
serviceThe
$defer
service will be removed before 1.0 final, so please migrate your code. (4511d39c)
1.0.0rc9 eggplant-teleportation (2012-05-14)
Bug Fixes
- $location:
- docs app: get docs app to work on IE8 (aa025348)
1.0.0rc8 blooming-touch (2012-05-06)
Features
- jqLite: support data() getter and data(obj) setter (ee579a07)
Bug Fixes
- $compile:
- have $observe return registration function (7f0eb151)
- ignore ws when checking if template has single root (9c0418cf, #910)
- fix replaceWith (b431ee38)
- attach scope to the directive element when templateUrl and replace=true (705f4bbf)
- prevent duplicate directive controller instantiation (843f762c, #876)
- $parse: support methods on falsy primitive types (499a76a0)
- ngModel: use keydown/change events on IE9 instead of input (49dfdf8f, #879)
- ngSrc,ngHref: binding should set element prop as well as attr (b24cc63b, #935)
- scenario: make browser().location() working if ng-app on other than <html> (5bcb749a)
- select: don't interfere with selection if not databound (3bd3cc57, #926)
Docs
- Brand new bootstrap-based skin for api docs: http://docs.angularjs.org/
1.0.0rc7 rc-generation (2012-04-30)
Features
Bug Fixes
- jqlite:
Docs
- Tutorial has been finally updated to AngularJS v1.0! Check it out and provide feedback to make it even better: http://docs.angularjs.org/tutorial
- http://docs-next.angularjs.org now redirects to http://docs.angularjs.org
v1.0.0rc6 runny-nose (2012-04-20)
Bug Fixes
- select: properly handle empty & unknown options without ngOptions (904b69c7)
- compiler: reading comment throws error in ie (46bb08a9)
- document: accidental clobbering of document.getAttribute (eafe15f5, #877)
- script: Incorrectly reading script text on ie (94dd6857)
Features
1.0.0rc5 reality-distortion (2012-04-12)
Bug Fixes
- $location: properly rewrite urls in html5 mode with base url set + don't rewrite links to different base paths (6d7e7fde, 0a5050eb)
- e2eRunner: $browser.location should delegate to apps $location (df72852f)
- input.radio: support 2-way binding in a repeater (93d62860, #869)
- ngBindHtml: clear contents when model is falsy (10daefc6, #864)
- lots of doc fixes
Features
- $http: expose the defaults config as $http.defaults (dceafd32)
- docs: steps 0-4 of the Tutorial have been updated and improved
Breaking Changes
-
ng-ext-link
directive was removed because it's unnecessary (6d7e7fde)apps that relied on ng-ext-link should simply replace it with
target="_self"
-
$browser.addCss
was removed - it was never meant to be a public api (13d5528a)apps the depend on this functionality should write a simple utility function specific to the app (see this diff for hints).
-
$browser.addJs
method was removed - it was never meant to be a public api (fbaa1968)apps that depended on this functionality should either use many of the existing script loaders or create a simple helper method specific to the app.
-
$sanitize
service,ngBindHtml
directive andlinky
filter were moved to thengSanitize
module (5bcd7198)apps that depend on any of these will need to load
angular-sanitize.js
and includengSanitize
in their dependency list:var myApp = angular.module('myApp', ['ngSanitize']);
1.0.0rc4 insomnia-induction (2012-04-05)
Bug Fixes
- $compile: relax the restriction that directives can not add siblings (7e86eacf)
- $location: search setter should not double-encode the value (59fa40ec, #751)
- $q: $q.reject should forward callbacks if missing (c0b78478, #845)
- build: move
'use strict';
flag into the angular closure (637817e3) - Directives:
- ngModel: update model on each key stroke (revert ngModelInstant) (06d09550)
- booleanAttrs: always convert the model to boolean before setting the element property (dcb8e076)
- form: properly clean up when invalid widget is removed (21b77ad5)
- ngHref: copy even if no binding (2f5dba48)
- ngInclude: fire $includeContentLoaded on proper (child) scope (199ac269)
Features
- $http: add
withCredentials
config option (86182a94) - $route: allow chaining of whens and otherwise (15ecc6f3)
- ngInclude: allow ngInclude as css class (428f2b56)
Docs
- reintroduced the tutorial docs - currently only steps 0-3 are up to date and the code is not split up into step specific commits yet. See this branch instead.
- various other doc fixes
Breaking Changes
We removed two useless features:
- $routeProvider.when used to return the route definition object but now it returns self (15ecc6f3)
- ngInclude does not have scope attribute anymore (5f70d615)
- ngModelInstant directive is no more and ngModel behaves just as ngModelInstant used to. This doesn't really break anything, just remember to remove all ngModelInstant references from your template as they serve no purpose now. (06d09550)
1.0.0rc3 barefoot-telepathy (2012-03-29)
Bug Fixes
- $compile:
- angular.forEach: should ignore prototypically inherited properties (8d7e6948, #813)
- initialization: use jQuery#ready for initialization if available (cb2ad9ab, #818)
- $q: resolve all of nothing to nothing (ac75079e)
Features
- $compile: do not interpolate boolean attribute directives, rather evaluate them (a08cbc02)
- $controller: support controller registration via $controllerProvider (d54dfecb)
- $http:
- TzDate: add support for toISOString method (da9f4dfc)
- jqLite: make injector() and scope() work with the document object (5fdab52d)
- ngValue: directive that allows radio inputs to have non string values (09e175f0, #816)
Breaking Changes
$resource
,$cookies
and$cookieStore
services are now distributed as separate modules, seeangular-resource.js
andangular-cookies.js
. (798bca62, 7b22d59b)- angular.fromJson doesn't deserialize date strings into date objects. (ac4318a2)
- angular.toJson always use native JSON.parse and JSON.stringify - this might break code that consumes the output in whitespace-sensitive way (35125d25)
- IE7 and older have are now required to polyfill the JSON global object (87f5c6e5)
- boolean attr directives (ng-disabled, ng-required, etc) are evaluated rather than interpolated (a08cbc02)
ng-bind-attr
directive removed (55027132)- any app that depends on $sniffer service should use Modernizr instead (aaedefb9)
1.0.0rc2 silence-absorption (2012-03-20)
Features
- $route: when matching consider trailing slash as optional (a4fe51da)
- jqLite: add .controller() method (6c5a05ad)
- scope.$eval: allow passing locals to the expression (192ff61f)
- input[type=radio]: allow the value attribute to be interpolated (ade6c452)
Bug Fixes
- $http: don't send Content-Type header when no data (1a5bebd9, #749)
- $resource: support escaping of ':' in resource url (6d6f8753)
- $compile:
- $log: avoid console.log.apply calls in IE (15213ec2, #805)
- json: added support for iso8061 timezone (5ac14f63)
- e2e runner: fix typo that caused errors on IE8 (ee5a5352, #806)
- directives:
1.0.0rc1 moiré-vision (2012-03-13)
$compile rewrite
The compiler was completely rewritten from scratch using ideas from this design document. Please check out the $compile and $compileProvider.directive docs. The biggest improvements and changes are listed below.
-
the compiler now transparently supports several directive syntaxes. For example while before there was just one way to use
ng:include
directive:<ng:include src="someSrc"></ng:include>
. The new compiler treats all of the following as equivalent:<ng:include src="someSrc"></ng:include>
<ng-include src="someSrc"></ng-include>
<x-ng-include src="someSrc"></x-ng-include>
<div ng:include src="someSrc"></div>
<div ng-include src="someSrc"></div>
<div data-ng-include src="someSrc"></div>
<div ng:include="someSrc"></div>
<div ng-include="someSrc"></div>
<div data-ng-include="someSrc"></div>
<div class="ng-include: someSrc"></div>
This will give template creators great flexibility to consider the tradeoffs between html code validity and code conciseness and pick the syntax that works the best for them.
-
we are switching all of our code/docs/examples to use
ng-foo
directive name style instead ofng:foo
. The new compiler doesn't distinguish between these and other name styles (all of them are equally supported), the main difference is thatng-foo
is easier to select with css selectors. Check out the Internet Explorer Compatibility doc to learn about various IE-related requirements for different directive naming styles. -
angular.directive
,angular.widget
,angular.attrWidget
were merged into a single concept: adirective
which is registered via myModule.directive or $compileProvider.directive. You can control execution priority of multiple directives on the same element (previously the main difference between a attribute widget and a directive) via a directive priority setting. -
previously the linking functions of directives were called top to bottom following the DOM tree, to enable a linking fn to work child DOM nodes that were already processed by child linking fns the order was changed as follows: compile functions run top to bottom following the DOM tree, but linking functions run bottom-up following the DOM tree. In some rare cases it is desirable for linking fns to be called top to bottom and for these it is possible to register "prelinking" functions (check out the docs for the return value of the compile function).
-
angular.markup
andangular.attrMarkup
were replaced with interpolation via$interpolate
service.-
In the past
{{foo}}
markup was getting translated to<span ng-bind="foo"></span>
during the early stage of template compilation. Addition of this extra node was in some cases undesirable and caused problems. The new compiler with the help of the $interpolate service removes the need for these artificial nodes. -
As a side-effect of not using artificial nodes available for all bindings, the
html
filter which used to innerHTML (sanitized) html into the artificial node was converted into a directive. So instead of{{ someRawHtml | html }}
use<div ng-bind-html="someRawHtml"></div>
and instead of{{ someRawHtml | html:"unsafe" }}
use<div ng-bind-html-unsafe="someRawHtml"></div>
. Please check out the ng-bind-html and ng-bind-html-unsafe directive docs. -
Custom markup has been used by developers only to switch from
{{ }}
markup to(( ))
or something similar in order to avoid conflicts with server-side templating libraries. We made it easier to do this kind of customization by making the start and end symbol of the interpolation configurable via $interpolateProvider.
-
-
template loader loads template fragments from script elements and populates the $templateCache with them. Templates loaded in this way can be then used with
ng-include
,ng-view
as well as directive templates (see thetemplateUrl
property of the directive config object).
Forms / input controls / two-way data binding
The implementation of forms and input bindings was modified to address issues around composability, ease of adding custom validation and formatting. Please check out the forms dev guide article to learn about forms, form control bindings and input validation. The biggest changes are listed below.
-
any directive can add formatter/parser (validators, convertors) to an input type. This allows better composability of input types with custom validators and formatters. So instead of creating new custom input type for everything, it's now possible to take existing input type and add an additional formatter and/or validator to it via a custom directive.
-
inputs propagates changes only on the blur event by default (use new
ng-model-instant
directive if you want to propagate changes on each keystroke). -
no more custom input types, use directives to customize existing types.
-
removed $formFactory.
-
removed parallel scope hierarchy (forms, widgets).
-
removed
list
input type (useng-list
directive instead). -
removed integer input type.
Controller-scope separation
Controllers are now standalone objects, created using the "new" operator, and not mixed with scope object anymore. This addresses many issues including: #321 and #425.
The design doc explains the reasoning for this major change and how it solves many issues.
Before:
function MyCtrl() { var self = this; this.model = 'some model of any type'; this.fnUsedFromTemplate = function() { someApiThatTakesCallback(function callbackFn() { self.model = 'updatedModel'; }); }; }
After:
function MyCtrl($scope) { $scope.model = 'some model of any type'; $scope.fnUsedFromTemplate = function() { someApiThatTakesCallback(function() { $scope.model = 'updatedModel'; }); } }
Temporary backwards compatibility: Load the following module in your app to recreate the previous behavior and migrate your controllers one at a time: https://gist.github.com/1649788
$route service changes
-
As advertised in the past we moved the $route configuration from the run phase of the application to the config phase. This means that instead of defining routes via
$route.when
/$route.otherwise
you should use$routeProvider.when
/$routeProvider.otherwise
instead. -
route scope is now being created by the
ng-view
rather than by$route
, this resolved many issues we've previously faced. For more info, read the commit message. -
removed
$route.parent()
- it's unnecessary because the scope is properly created in the scope hierarchy byng-view
. -
new
$viewContentLoaded
and$includeContentLoaded
events which directives can use to be notified when a template content is (re)loaded. -
ng-view
now hasonload
attribute which behaves similarly to the one onng-include
.
Directives
ng-model
binding on select[multiple] element should support binding to an array (commit)- event object is now accessible as
$event
inng-click
and other directives (commit, issue #259 ng-class
directive now support map of classnames and conditions e.g.<div ng-class="{'hide': !visible, 'warning': isAlert()}"...
(contributed by Kai Groner) (commit)
Scope changes
-
scope.$emit
/$broadcast
return the event object, add cancelled property (commit) -
scope.$new()
takes one argument - a boolean indicating if the newly-created child scope should be isolated (not prototypically inheriting from the current scope). Previously the first argument was reference to the controller constructor, but because of the scope/controller separation the controllers should be instantiated via the$controller
service. (commit) -
fn signature change for change listener functions registered via
scope.$watch
- this means that the scope object can be listed in the arguments list only if it's needed and skipped otherwise. (commit)- before:
scope.$watch('someModel', function(scope, newVal, oldVal) {})
- after:
scope.$watch('someModel', function(newVal, oldVal, scope) {})
- before:
-
scope.$watch
now compares object by reference and only if extra boolean flag is passed comparison by equality is used. This was done to avoid unintended performance issues. (commit)- before:
scope.$watch('expression', function(scope, newVal, oldVal) {})
- after:
scope.$watch('expression', function(newVal, oldVal, scope) {}, true)
- before:
-
scope.$destroy
doesn't cause the$destroy
event to be emitted any more - this event was primarily used by the old forms implementation and is not needed any more. We are considering broadcasting this event in the future, which could then be used by directives and child scopes to be notified of their scope destruction.
New directives:
$injector / modules
$injector.instantiate
should return the object returned from constructor if one was returned (commit)$injector.instantiate
should support array annotations for Type argument (e.g. instantiate(['dep1', 'dep2', Type])) (commit)- quickly fail if circular dependencies are detected during instantiation (commit)
- added $provide.constant to enable registration of constants that are available in both the config and run phase (commit)
$provide.service
was renamed to $provide.provider (commit)$provide.service
takes a constructor fn and creates a service instance by using $injector.instantiate
New services:
jqLite (angular.element)
- added
contents()
(commit) - added
wrap()
(commit) - fix memory leaking in IE8 (remove monkey patched methods on Event) (commit, commit)
Docs
Small bug fixes
- fix incorrect comparison of dates by angular.equals (commit)
scope.$watch
support watching functions (commit, commit)$http
should not json-serialize File objects, instead just send them raw (commit)$compile
should ignore content of style and script elements (commit, commit)TzDate#getDay()
should take into account the timezone offset (contributed by Stephane Bisson) (commit)
Small features
$parse
service now supports local vars in expressions (commit)
0.10.6 bubblewrap-cape (2012-01-17)
Features:
- Dependency injection subsystem rewrite. This is a huge change to the Angular core that was necessary for many reasons. Please read the full design doc to understand the changes and reasoning behind them.
- Added angular.bootstrap for manual bootstrapping of the app. Also see Initializing Angular App doc.
- Helper functions inject and module that make testing with DI and jasmine a lot easier.
- jqLite and jQuery were extended with helper method
injector()
that simplifies the access to the application injector during debugging. - Rewrite of $xhr service and its dependencies, which was replaced with $http service. The $browser.xhr and its mock were replaced by $httpBackend and its unit testing and end-to-end testing mocks. The $resource service api and functionality was preserved, with the exception of caching, which is not happening automatically as it used it in the past (verifyCache has no effect).
- $q - Q-like deferred/promise implementation (commit)
- Transparent data-binding to promises in templates. Example (commit)
- New $anchorScroll service that watches url hash and navigates to the html anchor even if the content was loaded via ng:view (for ng:include you have to opt into this behavior using autoscroll attribute)
- New LRU cache factory - $cacheFactory service
- jQuery 1.7 compatibility
Bug Fixes:
- Directive names are now case insensitive (commit)
- $location#url setter fix (Issue #648)
- ng:include - prevent race conditions by ignoring stale http callbacks (commit)
- ng:repeat - support repeating over array with null (commit)
- angular.copy - throw Error if source and destination are identical (commit)
- Forms should not prevent POST submission if the action attribute is present (commit)
Breaking Changes:
- App bootstrapping works differently (see angular.bootstrap and ng:app and bootstrapping)
- scope.$service is no more (because injector creates scope and not the other way around), if you really can't get services injected and need to fetch them manually then, get hold of $injector service and call $injector.get('serviceId')
- angular.service style service registration was replaced with module system, please see angular.module api and DI documentation for more info.
- the $xhr service was replaced with $http with promise based apis.
- unit-testing $httpBackend's expect method (the replacement for $browser.xhr.expect) is stricter - the order of requests matters and a single request expectation can handle only a single request.
- compiler
- compiler is a service, so use $compile instead of angular.compile to compile templates
- $compile (nee angular.compile) returns the linking function which takes one mandatory argument - the scope. previously this argument was optional and if missing, the compiler would create a new root scope, this was a source of bugs and was removed
- filters
- filters need to be registered either via moduleName.filter or $filterProvider.filter
- filters don't have access to the dom element
- currency filter doesn't make negative values red
- json filter doesn't print out stuff in monospace
- type augmentation via angular.Array, and angular.Object is gone. As a replacement use filters (filter, limitTo, orderBy), ES5 apis (e.g. Array#indexOf), or create custom filters (e.g. as a replacement for $count and $sum).
- $browser.defer.flush now throws an exception when queue is empty (commit)
- scope.$apply and scope.$digest throws an exception if called while $apply or $digest is already in progress (this is a programming error, you should never need to do this) (commit)
0.10.5 steel-fist (11-11-08)
Features:
- ng:autobind: drop angular.js file name restrictions (commit)
- Scope: better logging of infinite digest error (commit, issue #621)
- enable widget styling in IE8 and below using html5shiv-like approach (commit, issue #584)
- ng:style: compatibility + perf improvements (commit)
Bug Fixes:
- ng:view: ignore stale xhr callbacks - fixes issues caused by race-conditions which occurred when user navigated to a new route before the current route finished loading (issue #619)
- ng:form should always be a block level (css) element (commit)
- Fixes for e2e test runner's
$location
dsl (commit) - ng:repeat when iterating over arrays ignore non-array properties + when iterating over objects sort keys alphabetically (commit)
Docs:
- experimental disqus.com integration for all docs-next.angularjs.org pages (commit, contributed by Dan Doyon)
- e2e test runner docs were moved to the dev guide
0.10.4 human-torch (2011-10-22)
Features:
- New validation options for
input widgets:
ng:minlength
andng:maxlength
(commit) (contributed by Konstantin Stepanov) - HTML sanitizer was updated to recognize all safe HTML5 elements (Issue #89)
- ng:options' blank option is now compiled and data-bound as any other template (Issue #562) (contributed by tehek)
- $defer service now exposes
cancel
method for task cancellation (commit)
Bug Fixes:
- ng:options should select correct element when '?'-option (invalid value) was previously selected (Issue #599) (contributed by Tehek)
- Fix data-binding of radio button's value property (Issue #316)
- Input with type
password
should no be turned into a readable text field (commit) (contributed by Konstantin Stepanov) - ng:repeat should ignore object properties starting with
$
(commit) - Correctly parse out inlined regexp from the input field's
ng:pattern
attribute. (commit) - $location service in html5 mode should correctly rewrite links that contain nested elements (commit)
Breaking Changes:
- the date filter now uses 'mediumDate' format if none is specified. This was done to deal with browser inconsistencies (each browser used to use different format) (Issue #605, commit, commit)
- calling the linker function returned by angular.compile doesn't automatically run
$digest
on the linked scope any more. This behavior was briefly introduced in 0.10.3 but was causing issues and inefficiencies in production apps so we reverted it. See: commit
0.10.3 shattering-heartbeat (2011-10-13)
Features:
-
New forms, validation, support for HTML5 input widgets. Please check out:
-
ng:repeat now has element-model affinity, which makes it more friendly to third-party code that is not aware of angular's DOM manipulation. This is also the pre-requisite for supporting animations. (commit)
Bug Fixes:
- The select widget with ng:options directive now correctly displays selected option (regression from 0.10.2).
- Fix for jqLite's removeClass, which under certain circumstances could clobber class names. (commit)
- Other small fixes and documentation improvements.
Breaking Changes:
- Due to changes in how forms and validation works the following were replaced with new apis:
angular.formatter
- useangular.inputType
or form's$createWidget
angular.validator
- useangular.inputType
or form's$createWidget
- changes to
<input>
and<select>
elementsng:model
directive is now required for data-binding to kick in- the
name
attribute is now optional and is used only as an alias when accessing the input widget via the form object. - view can't affect the model without a user interaction, so the
value
attribute of the<input>
element andselected
attribute of the<option>
element if specified in the template is ignored.
- Removed decoration of DOM elements when:
- an exception occurs - when an exception happens, it will be passed to the $exceptionHandler service, which can decide what to do with it.
- an input widget contains invalid input - in this case the forms validation apis can be used to display a customized error message.
- The $hover service was removed (it was needed only for the DOM decoration described above).
0.10.2 sneaky-seagull (2011-10-08)
Features:
Bug Fixes:
- Added support for short-circuiting of && and || operators in in angular expressions (Issue #433)
- Fix for $limitTo to properly handle excessive limits (contributed by tehek) (Issue #571)
- jqLite's css() method now converts dash-separated css property names to camelCase in order to support dash-separated properties on Firefox (Issue #569)
- action defaults for $resources now take precedence over resource defaults (contributed by Marcello Nuccio) (commit)
- Fixed escaping issues in $route matcher (commit)
- Fixed two issues in $browser.defer.cancel mock (commit, commit)
- Fix for ng:options, which under certain circumstances didn't select the right option element (commit)
Docs:
Breaking Changes
- If Angular is being used with jQuery older than 1.6, some features might not work properly. Please upgrade to jQuery version 1.6.4.
Breaking Changes
- ng:repeat no longer has ng:repeat-index property. This is because the elements now have affinity to the underlying collection, and moving items around in the collection would move ng:repeat-index property rendering it meaningless.
0.10.1 inexorable-juggernaut (2011-09-09)
Features
- complete rewrite of the $location service with HTML5 support, many API and semantic changes.
Please see:
- $location service API docs
- $location service dev guide article
- location.js source file
- breaking changes section of this changelog
Bug Fixes
- $xhr should not covert HTTP status 0 to 200 (commit)
- fixed several doc examples that were broken on IE
- ng:change should be called after the new val is set (Issue #547)
- currency filter should return an empty string for non-numbers
Breaking Changes
- $location related changes - for complete list of api changes see:
Migrating from earlier AngularJS releases
-
$location api changes:
- $location.href -> $location.absUrl()
- $location.hash -> $location.url()
- $location.hashPath -> $location.path()
- $location.hashSearch -> $location.search()
- $location.search -> no equivalent, use $window.location.search (this is so that we can work in hashBang and html5 mode at the same time, check out the docs)
- $location.update() / $location.updateHash() -> use $location.url()
- n/a -> $location.replace() - new api for replacing history record instead of creating a new one
-
$location semantic changes:
- all url pieces are always in sync ($location.path(), $location.url(), $location.search(), ...) - this was previously true only if you used update* methods instead of direct assignment ($location.hashPath = 'foo')
- we now use (window.history.pushState || onHashChange event || polling) for detecting url changes in the browser (we use the best one available).
-
0.10.0 chicken-hands (2011-09-02)
Features
- complete rewrite of the Scope implementation with several API and semantic changes. Please see:
- angular.scope API docs
- scopes dev guide article
- scope.js source file
- breaking changes section of this changelog
- added event system to scopes (see $on, $emit and $broadcast)
- added i18n and l10n support for date, currency and number filters see i18n docs for more info
- added localizable ng:pluralize widget
- added ng:cloak directive for hiding uncompiled templates
Bug Fixes
- make ng:class friendly towards other code adding/removing classes (commit)
- several jqLite bugfixes and improvements
- ng:href, ng:src and friends now work properly when no expression is present in the attribute value. (Issue #534)
- expose missing lowercase, uppercase and isDate APIs.
Docs
- many (but not all just yet) api docs were proof-read and improved
Breaking Changes:
- many scope related changes:
- $onEval is no more (use $watch with a fn as the only param if you really miss it)
- $eval without params doesn't trigger model mutation observations (use $apply/$digest instead)
- $digest propagates through the scope tree automatically (this is the desired behavior anyway)
- $watch various API changes
- scope is now the first argument passed into the $watch listener
this
in the $watch listener is undefined instead of current scope- objects and arrays are watched and compared by equality and not just identity
- the initial execution of the $watch listener now executes asynchronously with respect to the code registering it via $watch
- exceptionHandler argument is no more
- initRun argument is no more
- angular.scope does not create child scopes by taking parent as the first argument - use $new instead
- scope.$set and scope.$get were removed, use direct property assignment instead or $eval
- $route.onChange was removed and replaced with $beforeRouteChange, $afterRouteChange and $routeUpdate events that can be used together with the new $routeParams service
angular.equals()
now uses===
instead of==
when comparing primitives
0.9.19 canine-psychokinesis (2011-08-20)
Features
- added error handling support for JSONP requests (see error callback param of the $xhr service) (commit)
- exposed http response headers in the $xhr and $resource callbacks (commit contributed by Karl Seamon)
- added
reloadOnSearch
$route param support to prevent unnecessary controller reloads and resulting flicker (commit)
Bug Fixes
- fixed memory leak found in ng:options directive (commit)
- make ng:class-even/odd compatible with ng:class (Issue #508)
- fixed error handling for resources that didn't work in certain situations (commit contributed by Karl Seamon)
Docs
- jsFiddle integration for all docs.angularjs.org examples (contributed by Dan Doyon).
Breaking Changes
- removed jqLite show/hide support. See the
commit
message for details. Developers should use jquery or jqLite's
css('display', 'none')
andcss('display', 'block'/'inline'/..)
instead
0.9.18 jiggling-armfat (2011-07-29)
Features
- ECMAScript 5 Strict Mode compliance
- jqLite
- added
show()
,hide()
andeq()
methods to jqlite (commit)
- added
- added $defer.cancel to support cancellation of tasks defered via the $defer service
- date filter
- added support for
full
,long
,medium
andshort
date-time format flags (commit) - added support for
z
flag, which stands for short string timezone identifier, e.g. PST - internal improvements to enable localization of date filter output
- added support for
- number filter
- internal improvements to enable localization of number filter output
- currency filter
- support for custom currency symbols via an optional param
- internal improvements to enable localization of number filter output
- added angular.version for exposing the version of the loaded angular.js file
- updated angular.js and angular.min.js file headers with angular version and shorter & updated license info
- ng:options
- $xhr and $resource support for per-request error callbacks (Issue #408) (contributed by Karl Seamon)
Bug Fixes
- make injector compatible with Rhino (HtmlUnit) (contributed by Mårten Dolk) commit
ie-compat.js
fixes and improvements related to fetching this file on the fly on legacy browsers- jqLite
- improved implementation of ng:show and ng:hide directives by using jqLite/jQuery hide and show methods
- ng:options
- fix incorrect re-growing of options on datasource change (Issue #464)
Docs
- added full offline support for docs (click on the link in the footer of docs.angularjs.org)
- many content improvements and corrections across all docs (reference api, tutorial, dev guide)
- many small design improvements
Other
- doubled our e2e test suite by running all angular e2e tests with jqLite in addition to jQuery
Breaking changes
- commit
removed support for the
MMMMM
(long month name), useMMMM
instead. This was done to align Angular with Unicode Technical Standard #35 used by Closure, as well as, future DOM apis currently being proposed to w3c. $xhr.error
'srequest
argument has nocallback
property anymore, usesuccess
instead
0.9.17 vegetable-reanimation (2011-06-30)
New Features
- New ng:options directive to better bind a model to
<select>
and<option>
elements. - New ng:disabled, ng:selected, ng:checked, ng:multiple and ng:readonly directives.
- Added support for string representation of month and day in date filter.
- Added support for
prepend()
to jqLite. - Added support for configurable HTTP header defaults for the $xhr service.
Bug Fixes
- Number filter would return incorrect value when fractional part had leading zeros.
- Issue #338: Show error when template with with multiple DOM roots is being compiled.
- Issue #399: return unsorted array if no predicate.
- Fixed issues with incorrect value of $position in ng:repeat when collection size changes.
- Fixed JSONP support in $xhr which didn't work without jquery since v0.9.13.
Documentation
- various small fixes and improvements
Breaking changes
- $service now has $service.invoke for method injection ($service(self, fn) no longer works)
- injection name inference no longer supports method curry and linking functions. Both must be explicitly specified using $inject property.
- Dynamic iteration (ng:repeat) on
<option>
elements is no longer supported. Use ng:options - Removal of index formatter (
ng:format="index"
) since its only use was with repeated<options>
(see above). - Calling $orderBy without a predicate now returns the original unsorted array, instead of ordering by natural order.
0.9.16 weather-control (2011-06-07)
Features
- JsTD Scenario Adapter for running scenario tests with jstd (from command line and in multiple browsers)
Documentation
- brand new template for http://docs.angularjs.org/
- brand new tutorial that describes how to build a typical angular app http://docs.angularjs.org/#!/tutorial
- lots of new content for the dev guide (still work in progress) http://docs.angularjs.org/#!/guide
Bug Fixes
- ng:href produces unclickable links on IE7 #352
- IE 8 in compatibility mode breaks routing #353
- IE translates a 204 response code to 1223 #357
- Fixed unit test in IE7 #360
- Fixed unit tests on FF4, Opera #364
- Fixed opera date.toISOString issue #367
Breaking changes
- html scenario runner requires ng:autotest script attribute to start tests automatically (example)
0.9.15 lethal-stutter (2011-04-11)
Features
- IE9 support
Bug Fixes
- reverted ng:view sync cache fix due to regression in the order of initialization of parent and child controllers. (commits 9bd2c396 and 3d388498)
- $resource success callback is now executed whenever the http status code is
<200,300>
Docs
- fixed intentation code that caused some of the snippets on docs.angularjs.org to be mangled.
- many small improvements of the api docs.
0.9.14 key-maker (2011-04-01)
Performance
- ng:repeat grows (adds children) significantly faster. (commit 15ec78f5)
- $xhr.cache optionally executes callbacks synchronously. (commit c06c5a36)
- ng:view and ng:include use sync $xhr.cache
Bug Fixes
- Fixed $resource encoding of query params. (commits e1d122a4, 78a0f410)
House cleaning
- code cleanup
- better minification (min is now 2.5% or almost 1kb smaller)
- minor documentation fixes
- JsTestDriver 1.3.2 upgrade with fixed coverage support
0.9.13 curdling-stare (2011-03-13)
New Features
- Added XSRF protection for the $xhr service. (commit c578f8c3)
- Targeted auto-bootstrap – ng:autobind now takes an optional value which specifies an element id to be compiled instead of compiling the entire html document. (commit 9d5c5337)
Bug Fixes
- Fixed IE7 regression which prevented angular from bootstrapping in this browser.
- Cookies which contain unescaped '=' are now visible via the $cookies service. (commit 26bad2bf)
- $xhr service now executes "success" callback for all 2xx responses, not just 200. (commit 5343deb3)
- Always remove the script tag after successful JSONP request. (commit 0084cb5c)
- Removal of all
document.write
statements to make angular compabile with async script loaders. (commit 3224862a)
Breaking changes
- The
post
parameter of [$browser.xhr][$browser] is now non-optional. Since everyone should be using the $xhr service instead of $browser.xhr, this should not break anyone. If you do use $browser.xhr then just add null for the post value argument where post was not passed in.
0.9.12 thought-implanter (2011-03-03)
API
- Added a delay parameter to the $defer service. (commit edbe9d8c)
- Added
scope()
method to angular.element (jQuery) instances to retrieve a scope associated with a given DOM element. (commit 0a5c00ab) - Added inference of DI dependencies from function signature. This feature is experimental, check out dependency injection docs. (commit 7d4aee31)
New Features
- Angular now correctly recognizes and uses jQuery even if it was loaded after angular's script. More info at angular.element. (commit a004d487)
- All built-in angular services are now lazy-loaded. (commit a070ff5a)
- To make styling of custom html tags created via widgets and directives
easier, all of these elements now contain a css class with name in form of
<namespace>-<directive/widget name>
, e.g.<ng:include class="ng-include">
. (commit c7998f5f) - $xhr service now automatically detects and strips google-style JSON security prefix from http responses. (commit cd139f57)
Bug Fixes
- Rewrite of JQuery lite implementation for better supports operations on multiple nodes when matched by a selector and remove other bugs. (commit 00cc9eb3)
- Corrected an issue where properties inherited from __proto__ show up in ng:repeat. (commit 9e67da42)
- Fixed url encoding issue affecting $resource service. (commits e9ce2259 + 9e30baad)
- Removed
$eval()
call from the $cookies factory function, which was causing duplicate instances of singleton services to be created. (commit 65585a2d)
Docs
- New docs contribution guidelines.
- New description of release artifacts.
- Lots of improvements and other new content.
Breaking changes
-
Removed the
$init()
method that used to be called after compilation of a template. This should affect only fraction of angular apps because the api was primarily being used by low level widgets tests.The old way of compiling the DOM element was angular.compile(element).$init(); The $init was there to allow the users to do any work to the scope before the view would be bound. This is a left over from not having proper MVC. The new recommended way to deal with initializing scope is to put it in the root constructor controller. To migrate simply remove the call to $init() and move any code you had before $init() to the root controller.
(commit 23b255a8)
-
Changed angular.compile API from
angular.compile(element[, scope])
toangular.compile(element)([scope], [cloneAttachFn])
(commits ef4bb28b + 945056b1) -
Removed ng:watch directives since it encourages logic in the UI. (commit 87cbf9f5)
0.9.11 snow-maker (2011-02-08)
Documentation
- completed migration of docs from the wiki site to http://docs.angularjs.org/
- many, but by far not all, docs were updated, improved and cleaned up
Features
- $route service now supports these features:
- route not found handling via
#otherwise()
- redirection support via
#when('/foo', {redirectTo: '/bar'})
(including param interpolation) - setting the parent scope for scopes created by the service via
#parent()
- reloading the current route via
#reload()
- route not found handling via
API
- added
angular.element(...).scope()
method to retrieve scope for a given element.
Bug Fixes
- value attribute gets clobbered when the element contains new line character(s).
- ng:view widget now works when nested inside an ng:include widget
- other various small fixes
Breaking changes
- mock
$browser
now throws an exception if theflush()
method is called when there are no requests to be flushed. If you experienceNo xhr requests to be flushed!
errors in your tests, it's because you called$browser.xhr.flush()
unexpectedly. To make the error go away, either make sure your code makes a request via the$xhr
service or remove all unneededflush()
calls.
0.9.10 flea-whisperer (2011-01-26)
Features
- new
ng:view
widget to simplify integration with the$route
service - the content of all standard HTML widgets is now being processed
(e.g.
<button>{{foo}}</button>
works now) (commit 1d7b9d56) - new
$log
and$exceptionHandler
service mocks now part ofangular-mocks.js
(commit f5d08963)
Bug Fixes
<select>
(one/multiple) could not chose from a list of objects (commit 347be5ae)- null and other falsy values should not be rendered in the view (issue #242)
Docs
- rewrite of several major portions of angular.service., angular.Array., angular.Object.* docs
- added support for sitemap 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
0.9.9 time-shift (2011-01-13)
Security
- Added a just in case security check for JSON parsing. (commit 5f080193)
- Completed security review with the Google Security Team.
Performance
- $location and $cookies services are now lazily initialized to avoid the polling overhead when not needed.
- $location service now listens for
onhashchange
events (if supported by browser) instead of constant polling. (commit 16086aa3) - input widgets known listens on keydown events instead of keyup which improves perceived performance (commit 47c454a3)
- angular boots significantly sooner by listening for DOMContentLoaded event instead of window.load when supported by browser (commit c79aba92)
- new service $updateView which may be used in favor of $root.$eval() to run a complete eval on the entire document. This service bulks and throttles DOM updates to improve performance. (commit 47c454a3)
Docs
- Major improvements to the doc parser (commit 4f22d686)
- Docs now offline enabled (all dependencies are bundled in the tarball) (commit 4f5d5029)
- Added support for navigating the docs app with keyboard shortcuts (tab and ctrl+alt+s)
Bugfixes
angular.Object.equals
now properly handless comparing an object with a null (commit b0be87f6)- Several issues were addressed in the
$location
service (commit 23875cb3) - angular.filter.date now properly handles some corner-cases (issue #159 - fix contributed by Vojta)
Breaking changes
-
API for accessing registered services —
scope.$inject
— was renamed toscope.$service
. (commit b2631f61) -
Support for
eager-published
services was removed. This change was done to make explicit dependency declaration always required in order to allow making relatively expensive services lazily initialized (e.g. $cookie, $location), as well as remove 'magic' and reduce unnecessary scope namespace pollution. (commit 3ea5941f)Complete list of affected services:
- $location
- $route
- $cookies
- $window
- $document
- $exceptionHandler
- $invalidWidgets
To temporarily preserve the 'eager-published' status for these services, you may use
ng:init
(e.g.ng:init="$location = $service('$location'), ...
) in the view or more correctly create a service like this:angular.service('published-svc-shim', function($location, $route, $cookies, $window, $document, $exceptionHandler, $invalidWidgets) { this.$location = $location; this.$route = $route; this.$cookies = $cookies; this.$window = $window; this.$document = $document; this.$exceptionHandler = $exceptionHandler; this.$invalidWidgets = $invalidWidgets; }, {$inject: ['$location', '$route', '$cookies', '$window', '$document', '$exceptionHandler', '$invalidWidgets'], $eager: true});
-
In the light of the
eager-published
change, to complete the cleanup we renamed$creation
property of services to$eager
with its value being a boolean. To transition, please rename all$creation: 'eager'
declarations to$eager: true
. (commit 1430c6d6) -
angular.foreach
was renamed toangular.forEach
to make the api consistent. (commit 0a6cf70d) -
The
toString
method of theangular.service.$location
service was removed. (commit 23875cb3)
0.9.8 astral-projection (2010-12-23)
Docs/Getting started
- angular-seed project to get you hacking on an angular apps quickly https://github.com/angular/angular-seed
Performance
- Delegate JSON parsing to native parser (JSON.parse) if available
Bug Fixes
- Ignore input widgets which have no name (issue #153)
0.9.7 sonic-scream (2010-12-10)
Bug Fixes
- $defer service should always call $eval on the root scope after a callback runs (issue #189)
- fix for failed assignments of form obj[0].name=value (issue #169)
- significant parser improvements that resulted in lower memory usage (commit 23fc73081feb640164615930b36ef185c23a3526)
Docs
- small docs improvements (mainly docs for the $resource service)
Breaking changes
- Angular expressions in the view used to support regular expressions. This feature was rarely used and added unnecessary complexity. It not a good idea to have regexps in the view anyway, so we removed this support. If you had any regexp in your views, you will have to move them to your controllers. (commit e5e69d9b90850eb653883f52c76e28dd870ee067)
0.9.6 night-vision (2010-12-06)
Security
- several improvements in the HTML sanitizer code to prevent code execution via
href
s and other attributes. Commits:- 41d5938883a3d06ffe8a88a51efd8d1896f7d747
- 2bbced212e2ee93948c45360fee00b2e3f960392
Docs
- set up http://docs.angularjs.org domain, the docs for the latest release will from now on be deployed here.
- docs app UI polishing with dual scrolling and other improvements
Bug Fixes
select
widget now behaves correctly when itsoption
items are created viang:repeat
(issue #170)- fix for async xhr cache issue #152 by adding
$browser.defer
and$defer
service
Breaking Changes
- Fix for issue #152 might break some tests that were relying on the incorrect behavior. The
breakage will usually affect code that tests resources, xhr or services/widgets build on top of
these. All that is typically needed to resolve the issue is adding a call to
$browser.defer.flush()
in your test just before the point where you expect all cached resource/xhr requests to return any results. Please see 011fa39c2a0b5da843395b538fc4e52e5ade8287 for more info. - The HTML sanitizer is slightly more strict now. Please see info in the "Security" section above.
0.9.5 turkey-blast (2010-11-25)
Docs
- 99% of the content from the angular wiki is now in the docs
Api
- added
angular.Array.limitTo
to make it easy to select first or last few items of an array
0.9.4 total-recall (2010-11-18)
Docs
- searchable docs
- UI improvements
- we now have ~85% of the wiki docs migrated to ng docs
- some but not all docs were updated along the way
Api
- ng:include now supports
onload
attribute (commit cc749760)
Misc
- Better error handling - compilation exception now contain stack trace (commit b2d63ac4)
0.9.3 cold-resistance (2010-11-10)
Docs
- prettier docs app with syntax highlighting for examples, etc
- added documentation, examples and scenario tests for many more apis including:
- all directives
- all formatters
- all validators
- some widgets
Api
- date filter now accepts strings that angular.String.toDate can convert to Date objects
- angular.String.toDate supports ISO8061 formatted strings with all time fractions being optional
- ng:repeat now exposes $position with values set to 'first', 'middle' or 'last'
- ng:switch now supports ng:switch-default as fallback switch option
Breaking changes
- we now support ISO 8601 extended format datetime strings (YYYY-MM-DDTHH:mm:ss.SSSZ) as defined
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
- JSON serialization and deserialization (used by json filter, $xhr and $resource)
- removed SSN validator. It's unlikely that most people will need it and if they do, it can be added simple RegExp validator.
0.9.2 faunal-mimicry (2010-11-03)
Docs
- created documentation framework based on jsdoc syntax (commit 659af29a)
- jsdoc parser
- template generator
- json generator
- angular doc viewer app
- scenario runner for all example code
- documentation for all angular filters (commits 1fe7e3a1 & 1ba8c2a33)
- docs
- example code
- scenario tests for example code
Testability
Scenario Runner
- binding DSL in Scenario can now match bindings without specifying filters
- dsl statements now accept a label argument to make test output more readable (issue #94)
- dsl element() statement now implements most of the jQuery API (issue #106)
- new browser() dsl statement for getting info about the emulated browser running the app (issue #109)
- scenario runner is now compatible with IE8 (issue #93)
- scenario runner checks if URL would return a non-success status code (issue #100)
- binding() DSL now accepts regular expressions
- new textarea() scenario runner DSL for entering text into textareas
Misc
- lots of small bugfixes
Breaking changes
Scenario Runner
- navigating to about:blank is no longer supported. It results in a sandbox error
- navigateTo() is now browser().navigateTo(). Old code must be updated
- file:// URLs are no longer supported for running a scenario. You must use a web server that implements HEAD
0.9.1 repulsion-field (2010-10-26)
Security
- added html sanitizer to fix the last few known security issues (issues #33 and #34)
API
- new ng:submit directive for creating onSubmit handlers on forms (issue #76)
- the date filter now accepts milliseconds as well as date strings (issue #78)
- the html filter now supports 'unsafe' option to bypass html sanitization
Testability
- lots of improvements related to the scenario runner (commit 40d7e66f)
Demo
- added a new demo application: Personal Log (src example/personalLog)
Chores
- lots of fixes to get all tests pass on IE
- added TzDate type to allow us to create timezone independent tests (issue #88)
Breaking changes
- $cookieStore service is not globally published any more, if you use it, you must request it via $inject as any other non-global service
- html filter now sanitizes html content for XSS attacks which may result in different behavior
0.9.0 dragon-breath (2010-10-20)
Security
- angular.fromJson not safer (issue #57)
- readString consumes invalid escapes (issue #56)
- use new Function instead of eval (issue #52)
Speed
- css cleanup + inline all css and images in the main js (issue #64)
Testability
- initial version of the built-in end-to-end scenario runner (issues #50, #67, #70)
API
- allow ng:controller nesting (issue #39)
- new built-in date format filter (issue #45)
- $location needs method you call on updates (issue #32)
Chores
- release versioning + file renaming (issue #69)
Breaking changes
- $location.parse was replaced with $location.update
- all css and img files were inlined into the main js file, to support IE7 and older app must host angular-ie-compat.js file
Big Thanks to Our Community Contributors
- Vojta Jina