Closed littlemtravis closed 9 years ago
Yeah, this seems like a no-brainer, should have done this in the first place. What do you think about the idea of raising an error (or just a warning) if you don't pass a block for which there is no default? You could always pass an empty block. So:
<div class="container">
<div ng-multi-transclude="required"></div>
<div ng-multi-transclude="optional">Some default.</div>
</div>
And then this would work fine:
<div test-directive>
<div name="required">Some thing.</div>
</div>
And this would raise an error about missing required
:
<div test-directive>
<div name="optional">Override the default.</div>
</div>
You could always just pass an empty block to signal your intention and avoid the error/warning:
<div test-directive>
<div name="required"></div>
<div name="optional">Override the default.</div>
</div>
Zach,
I don't think an error is required. I have a template that I am allowing any section to be filled in, if nothing is set then it's just empty.
Thanks,
Sent from my phone.
Travis
On Dec 17, 2014, at 1:06 PM, Zach Snow notifications@github.com wrote:
Yeah, this seems like a no-brainer, should have done this in the first place. What do you think about the idea of raising an error (or just a warning) if you don't pass a block for which there is no default? You could always pass an empty block. So:
Some default.And then this would work fine:
Some thing.And this would raise an error about missing required:
Override the default.You could always just pass an empty block to signal your intention and avoid the error/warning:
Override the default.— Reply to this email directly or view it on GitHub.
I've added this and will make a new release. Cheers!
call empty() on the element that is being transcluded.
This would allow me to have default content in the element, but allow the user to override the content.