ngx-star-port
v0.0.12
Published
<br> <br> <p align="center"> <img height="200" src="https://github.com/kasual1/ngx-star-port/blob/a41804396aca203f28b43df935a64080e790e42b/projects/demo/src/assets/ngx-star-port-logo.png" alt="Ngx Starport"> </p>
Downloads
5
Maintainers
Readme
Introduction
Ngx-star-port enables you to seamlessly transition shape and position of a component from one route to the other. While this might be a common task in native apps, the architectural design of frontend frameworks such as Angular makes this more difficult to achieve. The main concept of this library is inspired by VueStarport.
Install
npm i ngx-star-port
Usage
- Add
NgxStarPortModule
to your imports in your app.module.ts
import { NgxStarPortModule } from 'ngx-star-port';
@NgModule({
declarations: [],
imports: [
NgxStarPortModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
- Add the
<ngx-star-port-carrier>
component to the bottom of yourapp.component.html
. The<ngx-star-port-carrier>
component is a layer in which the animations between route changes are beeing performed in.
<!--app.component.html-->
<router-outlet></router-outlet>
<ngx-star-port-carrier></ngx-star-port-carrier>
- Wrap components that should be transitioned between route changes inside the
<ngx-star-port>
component and set a unique id. The id helps<ngx-star-port>
to identify the origin and the destination of the transitioned component.
<!-- page-a.component.html -->
<ngx-star-port id="my-id">
<my-component></my-component>
</ngx-star-port>
Make sure to use the same id when wrapping the destionation component
<!-- page-b.component.html -->
<ngx-star-port id="my-id">
<my-component></my-component>
</ngx-star-port>