angularjs无法为链式下拉列表创建初始值

时间:2013-11-19 14:38:07

标签: angularjs chained

我设法做了一个链式下拉,但我不能让他们有初始价值。我正在做这样的事情:

<select ng-model="check" ng-options="check.name for check in checks"></select>
              <select ng-show="check.params" ng-model="parameter" ng-options="p.name for p in check.params"></select>

这是一个单一检查的例子:

 [0] => Array
        (
            [id] => 1
            [name] => existing_client
            [params] => Array
                (
                    [0] => Array
                        (
                            [id] => 3
                            [name] => IsEnabled
                            [type] => boolean
                            [check_id] => 1
                        )

                    [1] => Array
                        (
                            [id] => 18
                            [name] => country
                            [type] => country_comparison
                            [check_id] => 1
                        )

                    [2] => Array
                        (
                            [id] => 19
                            [name] => affiliate_id
                            [type] => string_comparison
                            [check_id] => 1
                        )

                    [3] => Array
                        (
                            [id] => 14
                            [name] => created_at
                            [type] => date
                            [check_id] => 1
                        )

                    [4] => Array
                        (
                            [id] => 15
                            [name] => muid
                            [type] => string_comparison
                            [check_id] => 1
                        )

                    [5] => Array
                        (
                            [id] => 20
                            [name] => region
                            [type] => string_comparison
                            [check_id] => 1
                        )

                    [6] => Array
                        (
                            [id] => 24
                            [name] => created_at_interval
                            [type] => interval
                            [check_id] => 1
                        )

                )

        )

1 个答案:

答案 0 :(得分:0)

ng-model的{​​{1}}为<select>

您需要为要设置为checked的项目过滤数组,或使用任何可确定此值的逻辑