K
K
Konstantin2021-03-01 19:50:20
Angular
Konstantin, 2021-03-01 19:50:20

How to share an instance among the entire Angular application?

The root component <app-root>has an input property `@Input() props`.

In the component's constructor, this property is read and the third-party map (class) is initialized:

export class MapComponent implements AfterContentInit {

     public map: Map;
    @Input() props: MapProps = {};

     constructor() {
         this.map = new Map(this.props)
    }
}


How to share the resulting map this.map = new Map()among the entire Angular application?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question