【发布时间】:2018-01-29 14:51:53
【问题描述】:
我为我的 AngularJS 应用程序创建了一个简单的 PHP 函数。我想选择默认选项,它应该是可见的。不幸的是,它没有选择我想要的值。
我的功能如下:
function qtyList($selectName, $selectQty){
$str = '<select ng-model="qty" ng-change="updateCart('.$selectName.',qty)">';
for($i=1; $i<=100; $i++){
if($selectQty == $i)
$str .= '<option ng-selected="selected">'.$i.'</option>';
else
$str .= '<option>'.$i.'</option>';
}
$str .= '</select>';
return $str;
}
请提供任何建议。
【问题讨论】:
-
@Mosh Feu,感谢格式化。
-
我的荣幸 :) 顺便说一下,请accept 回答,以便对其他人有所帮助。
标签: javascript php html angularjs