I have this directive agreementDialog that in turn uses the generic dialog directive myapp-dialog-window-modal:
angular.module('myapp.common.extra').directive('agreementDialog', function () {
return {
restrict: 'E',
replace: true,
template: '<div><myapp-dialog-window-modal window-title="Agreements" dialog-visible="agreementDialogVisible">'
+ '<p>You need to accept the new terms.</p>'
+ '<p><label><input type="checkbox" ng-model="variableInTranscludedChildScope"/>I accept the agreement</label></p>'
+ '<p><button ng-click="submitAgreement(didAgree)">Submit</button></p>'
+ '</myapp-dialog-window-modal></div>',
controller: function ($scope) {
$scope.submitAgreement = function (didAgreeLocal) {
console.log(`submitAgreement`, didAgreeLocal);
};
$scope.didAgree = false;
$scope.agreementDialogVisible = true;
}
};
});
I need access to the variable variableInTranscludedChildScope mentioned in the code (the checkbox), but since it's inside the transcluded content, it has a separate scope (it's a child to agreementDialog’s scope and a sibling to myapp-dialog-window-modal’s scope). What's the best way of accessing it?