AngularJS environment

HTML

<div ng-app="MyApp" ng-controller="mainController">
    <radio-environment environment="environment" change-environment="environmentChange()"></radio-environment>
    <div style="margin-top: 15px;">App Environment: {{ environment.value }}</div>
</div>

JavaScript

console.clear();

var app = angular.module('MyApp', []);

app.controller('mainController', ['$scope', function (scope) {
    scope.environment = { value: '' };
}]);

app.directive('radioEnvironment', function () {
    return {
        scope: {
            environment: '=' // two-way binding
        },
        restrict: 'E',
        replace: true,
        template: '<div><label ng-repeat="choice in choices">' + '<input type="radio" name="env" ng-model="environment.value" value="{{ choice.id }}" />{{ choice.name }}' + '</label>' + '<div>Directive environment: {{ environment.value }}</div>' + '</div>',
        link: function (scope, element, attributes) {

            scope.choices = [{
                id: 1,
                name: "Testing"
            }, {
                id: 2,
                name: "Production"
            }];
        }
    };
});