简体   繁体   中英

Angular form select option value equals option text

I'm using this example of nested cascading selects http://jsfiddle.net/jhsousa/Mekhy/ ... I've got it in a form which when submits emails the values of the select options through. I've added NAME="" and ID="" to achieve this. However only a number is sent through.

How can I get the selected option .value to equal the .text which it is populated by?

This is my first experience with Angular so not having any joy.

I tried adding: obj.value as obj.text for obj in array to the ng-options. But the entire thing stopped working because ng-options already has a value.

Thanks.

There is no NICE way to get the text.

The only way is to activate a function call that loop through the Dropdown options elements and find the correct ID and extract the text from the optons.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM