Suppose you launch a modal window using $modal.open from within an angular directive.
Does the modal window have access to functions defined with the parent directive?
Directive controller code
..
function parentFunction()
{
return 5;
}
$scope.showDialog = function()
{
var dialog = $modal.open({
controller: 'modalController',
...
}
'modalController' code
var val = parentFunction();
It won't have lexical scope access, but there are 2 ways (that I know of) to "pass data" to the controller, depending on what makes more sense to you:
1) via
$scope
:2) via
resolve
:then you could get
parentFn
as a local injectable into themodalController
:Or...
if you defined your controller inline, then it would have lexical scope access: