JSFiddle - React, Tailwind, and code Playground

HTML

<div ng-app="mainApp" ng-controller="testCtrl">
    <months-year-dropdown value="fromMonthYear"></months-year-dropdown>
    <months-year-dropdown value="toMonthYear"></months-year-dropdown>
    <button ng-click="checkValue()">Save</button>
</div>

JavaScript

var APP = angular.module('mainApp', []);

APP.controller('testCtrl', function($scope){
    $scope.fromMonthYear = '';
    $scope.toMonthYear = '';
    $scope.checkValue = function(){
        console.log($scope.fromMonthYear); //working now
        console.log($scope.toMonthYear); //working now
    };
});

APP.directive('monthsYearDropdown', function () {
    
    var controller = function($scope) {
        $scope.months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
        $scope.years = ['2009','2010','2011','2012','2013','2014']
    };
    var template = '<select ng-model="month" ng-change="formatMonthYear()" ng-options="month for month in months"></select>' +
        '<select ng-model="year" ng-change="formatMonthYear()" ng-options="year for year in years">';
    return {
        restrict: 'E',
        template: template,
        controller: controller,
        scope: {
            value:'='
        },
        link: function (scope, el, attr) {                               
            scope.formatMonthYear = function() {
                scope.value = scope.month + "," + scope.year;                
            };
        }
    };
});