Skip to content

nivrith/ngx-teleport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Issues MIT License LinkedIn


Logo

Ngx Teleport

Render content anywhere in your angular app in a declarative manner. Render DOM outside of a component, anywhere in your app!


<!--This can be anwhere in your App-->
<ngx-teleport to="destination"> <stuff>...</stuff></ngx-teleport>

<!--This can be anwhere in your App-->

<ngx-teleport-outlet name="destination"> </ngx-teleport-outlet>

<!--content will be rendered here-->

<stuff>...</stuff>

View Source · Report Bug · Request Feature

🚀   Declarative · 🎉   Very Simple to use · 🍻   No Auxilary Routing · 💚   No Imperative Portal Creation and Lifecycle Management

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Contact

About The Project

Product Name Screen Shot

There are many situations where we would want to break the unidirectional top-down rendering of template/components and render DOM outside of a component, anywhere in your app

Here are few use cases:

  • You want to render different template in your toolbar or sidebar based on different routes but you want to bind properties and events in the child component
  • You want to conditionally show some template in different corners of your application which may not be hierarchically related

Use the NgxTeleport to get started.

(back to top)

Installation

npm install ngx-teleport

or using yarn

yarn add ngx-teleport

Usage Example

<!--This can be anwhere in your App-->
<ngx-teleport to="destination"> <stuff>...</stuff></ngx-teleport>

<!--This can be anwhere in your App-->
<ngx-teleport-outlet name="destination"> </ngx-teleport-outlet>
<!--content will be rendered here-->
<stuff>...</stuff>
  • Just Import NgxTeleportModule in the NgModule of which ever components you are using ngx-teleport and ngx-teleport-outlet in
import { NgxTeleportModule } from 'ngx-teleport';

@NgModule({
  //...
  imports: [
    //..
    NgxTeleportModule,
    //..
  ],
})
export class SomeModule {}

For more examples, please refer to the Documentation

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.md for more information.

(back to top)

Contact

Nivrith - @_Nivrith_ - nivrithgomatam@gmail.com

Project Link: https://github.com/nivrith/ngx-teleport

(back to top)