🚨 Latest Research:Tanstack npm Packages Compromised in Ongoing Mini Shai-Hulud Supply-Chain Attack.Learn More →
Socket
Book a DemoSign in
Socket

ng-teleport

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-teleport

Move a section of the DOM and inherit the scope of the target node.

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

ngTeleport

 

All in all, ngTeleport has similar functionality to ngTransclude, but ngTeleport allows you to uproot a piece of the DOM and place it elsewhere. However, ngTeleport is entirely Angular.js aware and therefore sets up the scope and interpolation for you.

Getting Started

First of all you need to define the ng-teleport attribute with a unique identifier for the scope on any DOM element you wish to teleport – this allows ngTeleport to take a note of the precompiled HTML. Once you've defined the ng-teleport you're free to move it around wherever you wish. Simply add teleport to your directive, and invoke it with the source (DOM node with the ng-teleport attribute), target, and any additional options.

<section ng-teleport="myElement">

</section>

With the above code section is now all ready to be teleported anywhere in the DOM where there is a valid Angular scope.

teleport(sectionElement, someOtherNode);

Options

OptionTypeDefaultResult
duplicateBooleanfalseInstead of removing the source DOM it instead creates a copy of it.
retainScopeBooleanfalseRetain the original scope of the node even though it's a child of another scope – not recommended due to complexity).
insertionStringappendCan either be append or prepend depending on what you're looking for.

FAQs

Package last updated on 14 Jan 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts