1
我爲AngularJS應用程序創建了一個簡單的PHP函數。我想選擇默認選項,它應該是可見的。不幸的是,它沒有選擇我想要的值。AngularJs Select通過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,感謝格式。 –
我的榮幸:)順便說一句,請[接受](https://meta.stackexchange.com/a/5235/303669)答案,這樣可以幫助其他人。 –