Last active
July 19, 2017 06:53
-
-
Save Vheissu/29a2b60296007b948c82e16ad5c4528b to your computer and use it in GitHub Desktop.
Checking for user provided slots
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<require from="./modal"></require> | |
<modal> | |
<div slot="modalHeader">This is user provided header content.</div> | |
</modal> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class App { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Aurelia</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body aurelia-app> | |
<h1>Loading...</h1> | |
<script src="https://jdanyow.github.io/rjs-bundle/node_modules/requirejs/require.js"></script> | |
<script src="https://jdanyow.github.io/rjs-bundle/config.js"></script> | |
<script src="https://jdanyow.github.io/rjs-bundle/bundles/aurelia.js"></script> | |
<script src="https://jdanyow.github.io/rjs-bundle/bundles/babel.js"></script> | |
<script> | |
require(['aurelia-bootstrapper']); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="modal__header" show.bind="$slots.modalHeader.children.length"> | |
<h1>Header:</h1> | |
<slot name="modalHeader"></slot> | |
</div> | |
<div class="modal__body"> | |
<h1>Body:</h1> | |
<slot></slot> | |
</div> | |
<div class="modal__footer" show.bind="$slots.modalFooter.children.length"> | |
<h1>Footer:</h1> | |
<slot name="modalFooter"></slot> | |
</div> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class ModalCustomElement { | |
static inject = [Element]; | |
constructor(element) { | |
this.element = element; | |
} | |
attached() { | |
this.$slots = this.element.au.controller.view.slots; | |
console.log(this.$slots); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment