ng-country-select占位符未显示

时间:2016-07-18 15:24:08

标签: angularjs

在Angular模板中,我使用ng-country-select包来下载ISO-3166国家/地区代码。我能看到的唯一问题是占位符文本没有按预期显示。

相关代码:

              <div class="col-sm-6">
                <div class="field-holder">
                    <country-select class="form-control"
                    cs-priorities="US,ES,GB,IT,CZ,DE,FR"
                    name="country" validate-on="dirty"
                    ng-model = "contact.country_code"
                    required-message="'Please select country.'"
                    placeholder="Country"
                    cs-required
                    required>
                    </country-select>
                </div>
            </div>

知道我在这里缺少什么吗?

1 个答案:

答案 0 :(得分:4)

See this Plunker I've created for this question.

<强>输出

Output

在您关联的js文件中angular-country-select.js (GIT source)行号#767

更改此行:

template: '<select ng-options="country.code as country.name for country in countries"> <option value="" ng-if="isSelectionOptional"></option> </select>',

template: '<select ng-options="country.code as country.name for country in countries"> <option value="" disabled selected>Please select country</option><option value="" ng-if="isSelectionOptional"></option> </select>',