Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

this fiddle represents what i am trying to do: http://jsfiddle.net/d1001001/dwqw6/. The grid directive needs to grab some data from controller, but since it's nested in the modal directive, which has isolated scope, it doesn't have access to controller's scope. If i put it like this

<div ng-controller="MyCtrl">
        <grid data="data" cols="cols"></grid>
</div>

it works.

Is there a solution to this? I don't feel like passing the data and cols variables to the modal directive as well. Thanks

share|improve this question

1 Answer 1

Use

<div ng-transclude></div>

instead of

<ng-transclude></ng-transclude>

in the template of modal directive.

share|improve this answer
    
And what if there was ng-include directive in the modal directive template and I wanted to access controller scope in the included template? –  d1001001 Sep 5 '13 at 21:41
    
@d1001001 Use $parent –  zsong Sep 5 '13 at 21:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.