Commit bc93c957 authored by Olivier Robin's avatar Olivier Robin Committed by Commit Bot

[AF iOS] Do not set angular model value for element without scope.

When elements don't have scope, setting the model value throws an
undefined element exceptions, causing autofill to fail.
Test existence of scope before updating model.

Bug: 846730
Change-Id: Ia1119604252829d2012bfc728de297607aa92883
Reviewed-on: https://chromium-review.googlesource.com/1072473Reviewed-by: default avatarMoe Ahmadi <mahmadi@chromium.org>
Commit-Queue: Moe Ahmadi <mahmadi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#562015}
parent 57759fab
...@@ -178,14 +178,15 @@ function setInputElementAngularValue_(value, input) { ...@@ -178,14 +178,15 @@ function setInputElementAngularValue_(value, input) {
} }
angular_element.val(value); angular_element.val(value);
var angular_model = angular_element.data && angular_element.data('ngModel'); var angular_model = angular_element.data && angular_element.data('ngModel');
if (!angular_model) { var angular_scope = angular_element.scope();
if (!angular_model || !angular_scope) {
return; return;
} }
angular_element.injector().invoke([ angular_element.injector().invoke([
'$parse', '$parse',
function(parse) { function(parse) {
var setter = parse(angular_model); var setter = parse(angular_model);
setter.assign(angular_element.scope(), value); setter.assign(angular_scope, value);
} }
]); ]);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment