8000 fix($compile): handle boolean attributes in `@` bindings by jannic · Pull Request #14070 · angular/angular.js · GitHub
[go: up one dir, main page]

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

fix($compile): handle boolean attributes in @ bindings #14070

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ng/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3120,7 +3120,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
destination[scopeName] = attrs[attrName] = void 0;
}
attrs.$observe(attrName, function(value) {
if (isString(value)) {
if (isString(value) || isBoolean(value)) {
var oldValue = destination[scopeName];
recordChanges(scopeName, value, oldValue);
destination[scopeName] = value;
Expand Down
19 changes: 19 additions & 0 deletions test/ng/compileSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2712,6 +2712,25 @@ describe('$compile', function() {
expect(checkedVal).toEqual(true);
});
});

it('should handle updates to @ bindings on BOOLEAN attributes', function() {
var componentScope;
module(function($compileProvider) {
$compileProvider.directive('test', function() {
return {
scope: { checked: '@' },
link: function(scope, element, attrs) {
componentScope = scope;
attrs.$set('checked',true);
}
};
});
});
inject(function($compile, $rootScope) {
$compile('<input test>')($rootScope);
expect(componentScope.checked).toEqual(true);
});
});
});


Expand Down
0