ng select

by manoj

HTML

<div ng-app="animateApp">
    <div ng-controller="tst">
        <div ng-repeahttp://jsfiddle.net/qY2Zz/#forkt="item in data">
            <input type="radio" name="somename" value={{item.id}} ng-click="clicker(item.id)"
            />{{item.name}}</div>
        <select ng-model="$scope.selectedOption" ng-options="option.id as option.name for option in selectedOption"></select>
    </div>
</div>

JavaScript

var animateAppModule = angular.module('animateApp', []);
animateAppModule.service('data', function () {
    var data = [{
        "id": "113000",
            "name": "Size",
            "values": [{
            "id": "92029",
                "name": "Size A"
        }, {
            "id": "92030",
                "name": "Size B"
        }]
    }, {
        "id": "113002",
            "name": "Color",
            "values": [{
            "id": "94029",
                "name": "Blue"
        }, {
            "id": "94030",
                "name": "Black"
        }]
    }]
    return {
        getData: function () {
            return data;
        },
        getSelectedData: function (id) {
            for (var i = 0; i < data.length; i++) {
                if (id == data[i].id) {
                    return data[i].values;
                }
            }
        }
    }
})

animateAppModule.controller('tst', function ($scope, data) {
    $scope.data = data.getData();
    $scope.clicker = function (id) {
        console.log($scope)
        $scope.selectedOption = data.getSelectedData(id);
    }
})