Skip to content

Instantly share code, notes, and snippets.

@rakia
Created May 22, 2024 20:12
Show Gist options
  • Save rakia/d4db5372460e6521cf859fd1620ba71b to your computer and use it in GitHub Desktop.
Save rakia/d4db5372460e6521cf859fd1620ba71b to your computer and use it in GitHub Desktop.
Angular: default content
@Component({
selector: 'main-layout',
template: `
<ng-content select="header">Hello again</ng-content>
<ng-content><p>Default content if none is provided.</p></ng-content>
<ng-content select="footer"></ng-content>
`
})
export class MainLayoutComponent {}
@Component({
template: `
<main-layout>
<p>Custom main content</p>
<footer>All rights reserved</footer>
</main-layout>
`
})
class AppComponent {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment