Multiple binding expressions in radio button 'name' fields causes incorrect default values to be set #15656
Description
openedon Jan 31, 2017
I'm submitting a ...
[X] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
Dynamically creating radio buttons with dynamic 'name' fields which contain more than one binding expression will not have the correct default values set.
e.g. within a nested ng-repeat:
<input type="radio" name="{{ expression1 }} {{ expression2 }}" ng-model="vm.radioModel[$index]" ... />
(Only the last radio button is selected.)
While using a combined expression will function correctly:
<input type="radio" name="{{ expression1 + expression2 }}" ng-model="vm.radioModel[$index]" ... />
Expected behavior
The default values for the radio options should be set according to the initially bound ng-model.
Minimal reproduction of the problem with instructions
Here's an example plunker demonstrating the issue: Incorrect default values set (plunker)
Here is an example plunker demonstrating the correct functioning of the same example, but using only one combined expression (e.g. name="{{ expression1 + expression2 }}):
Correct default values set (plunker)
Please tell us about your environment:
Windows 10 64bit
-
Angular version: 1.5.x, 1.6.x
-
Browser: Chrome 55
-
Language: ES5