I have this dropdown in my page
<select
ng-options="col.col_id as col.col_name for col in meta_data.x_cols"
ng-model="obj.x">
</select>
Since the model is set to obj.x
, I can access it using $scope.obj.x
in any $scope
function.
Naturally, it gives the value
of the selected option. Is there any way by which I can get selected text as well? for e.g. bind obj.x
to and obj.x_text
to the text of selected option.
ng-options="col.col_name for col in meta_data.x_cols"
. then your model will be the whole object. Here is an example - jsfiddle.net/devitate/LKeQz – Campinas