npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngx-layout-outlet

v9.100.0

Published

> Describe your layout and zoning separately from routing and herarchical structure

Downloads

6

Readme

LayoutOutlet

Describe your layout and zoning separately from routing and herarchical structure

Usage

The bread & butter of ngx-layout-outlet are the two directives lo-display and lo-outlet.

  • <lo-outlet name="foo"></lo-outlet> Indicate a place in HTML markup that you reserve for content labeled "foo"
  • <lo-display name="foo"> Some Content </lo-displat> Labels the content Some Content with "foo"

An outlet listens for content for its name and displays it. The content can be dynamic.

For example, this template

<div class="column-left">
  <lo-outlet name="left"></lo-outlet>
</div>
<div class="column-right">
  <lo-outlet name="right"></lo-outlet>
</div>

<lo-display name="left">I am left!</lo-display>
<lo-display name="right">I am right!</lo-display>

results in the following output

<div class="column-left">
  <lo-outlet name="left"></lo-outlet>
  I am left!
</div>
<div class="column-right">
  <lo-outlet name="right"></lo-outlet>
  I am right!
</div>

<lo-display name="left"></lo-display>
<lo-display name="right"></lo-display>

You can think of it as if the content is teleported into the outlet.

Here are some rules :

  • The name of an outlet is global to your application.
  • The name can be any string
  • lo-outlets and lo-displays needn't be from the same content or hierarchy
  • Content from an lo-display with no corresponding lo-outlet is not displayed, nor rendered
  • name can be dynamic. you then have to bind it with [name]="variable"
  • when no name is found, id is used instead if it is specified

If there are several contents available for a given outlet, the default behaviour is to render them all in order in which their parent component was rendered. This can be useful when combined with routing.

<!-- breadcrumb.component.html -->
<div class="breadcrumb">
  <lo-outlet name="breadcrumb"></lo-outlet>
</div>

<!-- app.component.html -->
<lo-display name="breadcrumb"> Home </lo-display>

<!-- deeper.component.html -->
<lo-display name="breadcrumb"> Deep </lo-display>

If you need to only display at most one content for an outlet, juste <lo-outlet name="foo" [exclusive]="true"></lo-outlet>. This will only display the latest content.

*loZone

You can use the structural directive *loZone if you need wrapping markup to rendered only when there is content to display.

<section>
  <aside *loZone name="sidebar">
    Here is some related information: <lo-outlet></lo-outlet>
  </aside>

  <main>
    This is the the primary content
    <lo-display name="sidebar">
      I am rendered in the sidebar
    </lo-display>
  </main>
</section>

Will only add an <aside> element into the dom if there is content to be display in the outlet "sidebar".

Note that inside a *loZone the name attribute of a lo-outlet is optional.

*loInstead

Similarly, you can use the structural directive *loInstead to display markup only when no content is available for a given outlet.

<section>
  <section *loZone name="notifications">
    <lo-outlet></lo-outlet>
  </section>
  <section *loInstead name="notifications" class="empty">
    No notifications to display
  </section>
</section>

Development server

Run once npm link --prefix projets/NgxLayoutOutlet Run once npm link

Run ng build NgxLayoutOutlet --watch and ng serve concurrently