I'm fiddling around with a homegrown tabset style directive that works
okay, except I have to do some weird voodoo on the scope. To wit:

http://plnkr.co/edit/PI8ghu?p=preview

If my directive template includes a ng-show on the ng-transclude item in
the template, everything works fine: the scope inside the transclude ends
up having the relevant stuff on it.

If my directive template uses ng-if to show-hide itself, the scope inside
doesn't have the right kind of contents. Instead, I have to manually say in
my linking function, scope.view = scope.$parent.view (to get access to the
stuff i've stashed on view in the transcluded content).

I feel like this is kind of a hack.

There's discussion of it here:
http://stackoverflow.com/questions/22434122/scope-generation-in-directive-template-doest-work-with-transclude

and the SO answer pretty much works as well in the general sense (it will
push all the stuff I need into the transclusion scope).

So: is this all intended behavior? I really want ng-if to handle my
show-hide routines, because the whole point is that some of the hidden
content on the page is expensive to render (roundtripping the API server),
and it would be nice to break that work up into logical chunks. Of course,
I could instead just do all of this with named views in ui-router, but I
already have a couple of views and I feel like having some sub-routes just
for tabs on certain logical pages of my SPA is bad form.

Eric

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to