
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
angular-pharkas-leaflet
Advanced tools
An Observable focused Angular base component for working with Leaflet
This library provides Angular base component for working with Leaflet, based on the angular-pharkas Component Framework.
It's benefits are:
ChangeDetectionStrategy.OnPush
disables Angular's more active change detection which is unnecessary
around vanilla controls like LeafletResizeObserver
to watch container size changes and notifies Leaflet, which is useful
for smarter updating in complex reflowing CSS layouts such as CSS GridLibrary version | Supported Angular |
---|---|
3.0.0 | Angular 15 |
<=2.0.0 | Angular 13 |
Import PharkasLeafletModule
and use LeafletMapComponent
as a replacement base component like
PharkasComponent
. The this.useMap()
"hook" takes Leaflet options and returns and Observable<LeafletMap>
.
A basic example:
@Component({
// …
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MyExampleComponent extends LeafletMapComponent<MyExampleComponent> {
constructor(ref: ChangeDetectorRef, element: ElementRef) {
super(ref, element)
const exampleLayer = new L.GeoJSON()
const map = this.useMap({
layers: [exampleLayer],
})
}
}
An example of using a bindEffect
with combineLatest
to perform an imperative effect on the map based
on an input Observable:
@Component({
// …
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MyExampleComponent extends LeafletMapComponent<MyExampleComponent> {
@Input() set zoomControlPosition(
value: L.ControlPosition | Observable<L.ControlPosition>
) {
this.setInput('zoomControlPosition', value)
}
constructor(ref: ChangeDetectorRef, element: ElementRef) {
super(ref, element)
const exampleLayer = new L.GeoJSON()
const map = this.useMap({
layers: [exampleLayer],
})
var zoomControlPosition = this.useInput('zoomControlPosition')
this.bindEffect(
combineLatest([zoomControlPosition, map]),
([position, map]) => {
map.zoomControl.remove()
L.control.zoom({ position }).addTo(map)
}
)
}
}
FAQs
An Observable focused Angular base component for working with Leaflet
The npm package angular-pharkas-leaflet receives a total of 2 weekly downloads. As such, angular-pharkas-leaflet popularity was classified as not popular.
We found that angular-pharkas-leaflet demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.