模板代码是
<select class="input-field form-control" id="story_category_id" name="story_category_id
materialize="material_select" required>
<option value="" disabled selected>Select category</option>
<option *ngFor="let category of categories">{{ category.name }}</option>
</select>
TS代码是
categories = [
{id: 1, name: 'Art and Culture'},
{id: 2, name: 'Science and Technology'},
{id: 3, name: 'Health'},
{id: 4, name: 'Education and Skilling'},
{id: 5, name: 'Environment Sustainability ( including Agriculture, water, Climate)'},
{id: 6, name: 'Governance and Administration'},
{id: 7, name: 'Business and Entrepreneurship'},
{id: 8, name: 'Poverty and Hunger'},
{id: 9, name: 'Religion, Social Justice and Strong Institutions'},
{id: 10, name: 'Rural Development'}
]
选项列表没有显示,即使它没有给出任何错误