I am new to Angular JS and I am trying to create a set of radio buttons. Creating the buttons was the easy part, but I am having problems figuring out how to default select
HTML
JS
angular.module('demoApp', []).
controller('DemoController', function ($scope) {
//moved init logic to controler
$scope.price_options = [{
qty: 1,
price: 10,
qty_description: 'descrip 1',
discount: '1%',
deal_value: 200
}, {
qty: 2,
price: 7,
qty_description: 'descrip 2',
discount: '5%',
deal_value: 100
}];
$scope.selected_price_option = $scope.price_options[1];
});
Forked fiddle: http://jsfiddle.net/W8KH7/2/
Or you can use the object strategy to avoid having to reference $parent: http://jsfiddle.net/W8KH7/3/