我们有这个 JSON
{
"Day": "Monday",
"Start_Time": "08:00"
},
{
"Day": "Tuesday",
"Start_Time": "10:00"
},
{
"Day": "Thursday",
"Start_Time": "08:00"
}
所以我试图让这些日子出现在带有这些选项的 html select
项目中。像这样
<select>
<option>Monday 08:00</option>
<option>Tuesday 10:00</option>
<option>Thursday 08:00</option>
</select>
当用户更改选项时,我想打印出他所做的新选项,但我卡住了。
到目前为止我做了什么。
<select ng-if="student.diwro" >
<option ng-repeat="x in modules" ng-selected="student.diwro == x.Anatheseis_Id" >{{x.Day}} {{x.Start_Time}}</option>
</select>
但是html元素option
没有ng-change
。
知道如何通过控制台记录更改的日期吗?
非常感谢!
最佳答案
<select ng-if="student.diwro" ng-change="change()" ng-model="selectedValue">
<option ng-repeat="x in modules" ng-selected="student.diwro == x.Anatheseis_Id" >{{x.Day}} {{x.Start_Time}}</option>
</select>
关于javascript - 带有 ng-change 的 Angular 1.5 选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40217046/