On trying and error, I found code that works with ngModel and ngChange:
return {
restrict: 'E',
require: 'ngModel',
scope: {},
template: '<div class="toggle-button" ng-class="{true: toggleValue === true, false: toggleValue === false}">'+
'<button class="true" ng-click="toggle(true)">Y</button>'+
'<button class="false" ng-click="toggle(false)">N</button>'+
'</div>',
link: function(scope, element, attrs, ngModel) {
ngModel.$viewChangeListeners.push(function() {
scope.$eval(attrs.ngChange);
});
ngModel.$render = function() {
scope.toggleValue = ngModel.$modelValue;
};
scope.toggle = function(toggle) {
scope.toggleValue = toggle;
ngModel.$setViewValue(toggle);
};
}
};
scope: true ( $scope.toggle, , )