Using AngularJS, I'm setting HTML form elements with some data inside $scope.
<select style='width:300px' size='10' ng-model='selected' ng-options='k as v for (k,v) in options' />
In this example, size is set to 10. But I would like to set it according to some value inside the $scope. Is there a way?
Use ng-size='10'
instead of size
That look like
<select style='width:300px' ng-size={{size}} ng-model='selected' ng-options='k as v for (k,v) in options' />
js code
$scope.size=10;
Edit
As part of our effort to clean out old issues, this issue is being automatically closed since it has been inactivite for over two months.
Please try the newest versions of Angular (1.0.8 and 1.2.0-rc.1), and if the issue persists, comment below so we can discuss it.
New Edit
or You can do this way
data-ng-attr-size="{{some interpolated expression}}"
Demo : http://plnkr.co/edit/a1xLPGn2YeW0WavH2auD?p=preview
Thanks!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With