Giter Site home page Giter Site logo

ngx-teleport's Introduction

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 SourceReport BugRequest 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_ - [email protected]

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

(back to top)

ngx-teleport's People

Contributors

dependabot[bot] avatar nivrith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ngx-teleport's Issues

Teleporting one component to many components

Hello,
To teleport a single component to another component the following is seen in the demo:

<ngx-teleport to="hero">
   <!-- markup component -->
<ngx-teleport to="hero">

How do I teleport 'markup component' to more than one component without duplicating the inserted markup.

For example, the following contains the duplicated markup component

<ngx-teleport to="heroine">
   <!-- markup component -->
<ngx-teleport to="heroine">

How do I prevent duplicating the markup?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    馃枛 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 馃搳馃搱馃帀

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google 鉂わ笍 Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.