timeselector.js

angular.module('homepage').
directive('timeselector', function () {
    return {
        controller: 'timeSelectorController',
        restrict: 'E',
        replace: true,
        // Variables within this scope will be submitted back to server
        scope: {
            time: '=scopeObj'
        },
        transclude: true,
        templateUrl: 'components/common-components/timeselector/timeselector.html'
    }
}).
controller('timeSelectorController', function ($scope) {
    $scope.time.code = 'NONE';
    $scope.selectOption = function (code) {
        $scope.time.code = code;
    }
});