ล่าสุดการพัฒนาเว็บบทเรียน
 

AngularJS Directive NG-เลือก


ตัวอย่าง

ทำให้ช่องใส่อ่านได้อย่างเดียว:

Click here to select BMW as your favorite car:
<input type="checkbox" ng-model="mySel">

<p>My Favourite car:</p>

<select>
<option>Volvo</option>
<option ng-selected="mySel">BMW</option>
<option>Ford</option>
</select>
ลองตัวเอง»

ความหมายและการใช้งาน

ng-selected สั่งชุดแอตทริบิวต์ที่เลือกของ <ตัวเลือก> องค์ประกอบใน <เลือก> รายชื่อ

ตัวเลือกที่จะถูกเลือกถ้าการแสดงออกภายใน ng-selected แอตทริบิวต์ผลตอบแทนจริง

ng-selected สั่งเป็นสิ่งที่จำเป็นเพื่อให้สามารถที่จะเปลี่ยนค่าระหว่าง true และ false ใน html คุณไม่สามารถตั้งค่า selected แอตทริบิวต์ false (การปรากฏตัวของแอตทริบิวต์ที่เลือกทำให้องค์ประกอบที่เลือกโดยไม่คำนึงถึงว่ามันคุ้มค่า)


วากยสัมพันธ์

<option ng-selected=" expression "></option>

สนับสนุนโดย <ตัวเลือก> องค์ประกอบ


ค่าพารามิเตอร์

Value Description
expression An expression that will set the element's selected attribute if it returns true.