php - How to get custom attribute of select's option in angularjs? -


this how html looks like

<select name="currency_advance" ng-model="currency" ng-change="put_currency()">     <?php foreach ($currency $c) { ?>       <option data-type="<?php echo $c->symbol; ?>" value="<?php echo $c->alphacode; ?>" >        <?php echo $c->alphacode; ?> - <?php echo $c->currency; ?>       </option>      <?php } ?>  </select> 

now can option value in angularjs's controller using put_currency function, need custom attribute "data-type" value.

how can accomplish this? please me?

update

now generating select field javascript. problem need set , value called symbol of currency. using custom tag data-type currency symbol. how can set , custom tag value in angularjs way?

<select name="currency_advance" ng-model="currency" ng-options="data.code data.code + ' - ' + data.currency data in data"> 

in ng-options this:

ng-options="data data.code + ' - ' + data.currency data in data"

notice first thing data instead of data.code. makes entire "data" object available under $scope.currency. way doing before, "code" under $scope.currency. can symbol accessing $scope.currency.symbol.

in general, should never need store data in dom using custom data-* attributes.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -