https://github.com/eufelipemateus/ng-webmanifest-reader
Read web.manifest with angular.
https://github.com/eufelipemateus/ng-webmanifest-reader
angular browser json package service webmanifest
Last synced: about 2 months ago
JSON representation
Read web.manifest with angular.
- Host: GitHub
- URL: https://github.com/eufelipemateus/ng-webmanifest-reader
- Owner: eufelipemateus
- License: mit
- Created: 2023-04-24T05:03:33.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-05-02T15:49:42.000Z (about 2 years ago)
- Last Synced: 2025-03-04T19:41:17.546Z (3 months ago)
- Topics: angular, browser, json, package, service, webmanifest
- Language: TypeScript
- Homepage:
- Size: 249 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ng-webmanifest-reader
This package read the **manifefest.json** file. with angular.
# Example
### app.module.ts
```typescript
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'import { AppComponent } from './app.component'
import { NgWebmanifestReaderModule } from 'ng-webmanifest-reader'@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
NgWebmanifestReaderModule.forRoot()
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
```### app.service.ts
```typescript
import { Injectable } from '@angular/core'
import { NgWebmanifestReader, WebManifest } from 'ng-webmanifest-reader'
@Injectable({
providedIn: 'root',
})export class WebmanifestService {
private manifest: WebManifest = {}constructor (_service: NgWebmanifestReader) {
_service.readCallback((data: WebManifest | null, error: any) => {
this.loadManifest(data, error)
})
}private loadManifest (data: WebManifest | null, error: any) {
if (data) {
this.manifest = data
}
}get version (): string {
if (this.manifest) {
return this.manifest.version || ''
} else {
return ''
}
}
}
```# Store Cache
This packe has store cache disable by default to anable import moldule with **NgWebmanifestReaderModule.forRoot({storeCache: true})**
## Forked
[@easy-pwa/web-manifest-reader](https://github.com/easy-pwa/web-manifest-reader)
## Author
**[Felipe Mateus](https://eufelipemateus.com)** - [eufelipemateus](https://github.com/eufelipemateus)