Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit cdff6d3

Browse files
committed
fix($compile): handle boolean attributes in @ bindings
Commit db5e0ff handles initial values of boolean attributes. The same change needs to be applied inside the attrs.$observe() call.
1 parent 735be18 commit cdff6d3

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/ng/compile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2994,7 +2994,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
29942994
destination[scopeName] = attrs[attrName] = void 0;
29952995
}
29962996
attrs.$observe(attrName, function(value) {
2997-
if (isString(value)) {
2997+
if (isString(value) || isBoolean(value)) {
29982998
destination[scopeName] = value;
29992999
}
30003000
});

test/ng/compileSpec.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2713,6 +2713,25 @@ describe('$compile', function() {
27132713
expect(checkedVal).toEqual(true);
27142714
});
27152715
});
2716+
2717+
it('should handle updates to @ bindings on BOOLEAN attributes', function() {
2718+
var componentScope;
2719+
module(function($compileProvider) {
2720+
$compileProvider.directive('test', function() {
2721+
return {
2722+
scope: { checked: '@' },
2723+
link: function(scope, element, attrs) {
2724+
componentScope = scope;
2725+
attrs.$set('checked',true);
2726+
}
2727+
};
2728+
});
2729+
});
2730+
inject(function($compile, $rootScope) {
2731+
$compile('<input test>')($rootScope);
2732+
expect(componentScope.checked).toEqual(true);
2733+
});
2734+
});
27162735
});
27172736

27182737

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy