I have some values saved in ng-options
, when you selec the element it doesn't give the proper value to the box, I want to change height and width of that element using <option>
element.
My HTML:
<div ng-app="myapp">
<fieldset ng-controller="FirstCtrl">
<select
ng-options="p.first + ' x ' + p.last for p in people"
ng-model="selectedPerson"></select>
{{ selectedPerson.first }} x {{ selectedPerson.last }}
</fieldset>
<div class="box" ng-style="{'width' : selectedPerson.first}">
</div>
</div>
The JS:
var myapp = angular.module('myapp', []);
myapp.controller('FirstCtrl', function ($scope) {
$scope.people = [
{ id: 1, first: 100, last: 200 },
{ id: 2, first: 200, last: 300 },
{ id: 3, first: 300, last: 400 },
{ id: 4, first: 400, last: 500 }
];
});
A Fiddle used for the example: http://jsfiddle.net/a6p1fL7m/