单选按钮模型的奇怪问题

时间:2016-02-27 21:49:34

标签: angularjs radio-button

我很难弄清楚用于收音机按钮的模型有什么问题。当我选择第二个单选按钮时,之前的选择就会消失。

请帮忙。提前谢谢。

 $scope.editor = {

                descriptionEditor: {
                    name: $window.localStorage.descriptionEditor || 'markdown', // options are ['markdown','normal']
                    selected: true
                },

                setDescriptionEditorPreference: function (name) {
                    $window.localStorage.descriptionEditor = name;
                },

                sampleQueryEditor: {
                    name: $window.localStorage.sampleQueryEditor || 'markdown', // options are ['markdown','normal']
                    selected: true
                },
                setSampleQueryEditorPreference: function (name) {
                    $window.localStorage.sampleQueryEditor = name;
                }

            }

http://plnkr.co/edit/ShIQx3CTtbkNcfk8mlzc?p=preview

1 个答案:

答案 0 :(得分:0)

找出问题所在。所有单选按钮都有name。将每对更改为不同的名称可以解决问题。

例如:name="check_normal_editor1 name="check_normal_editor2