Browse Source

Change sample language in docs

pull/17054/head
Masum ULU 3 years ago
committed by Mahmut Gundogdu
parent
commit
64ee7ce750
  1. 11
      docs/en/UI/Angular/Internet-Connection-Service.md

11
docs/en/UI/Angular/Internet-Connection-Service.md

@ -3,15 +3,14 @@
### internet-connection-service.ts ### internet-connection-service.ts
```js ```ts
import { DOCUMENT } from '@angular/common'; import { DOCUMENT } from '@angular/common';
import { Injectable, computed, inject, signal } from '@angular/core'; import { Injectable, computed, inject, signal } from '@angular/core';
import { BehaviorSubject } from 'rxjs'; import { BehaviorSubject } from 'rxjs';
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
}) })
export class InternetConnectionService{ export class InternetConnectionService{
protected readonly window = inject(DOCUMENT).defaultView; protected readonly window = inject(DOCUMENT).defaultView;
protected readonly navigator = this.window.navigator; protected readonly navigator = this.window.navigator;
@ -54,18 +53,18 @@ As you can see from the code above, `InternetConnectionService` is providing 2 a
İt's easy just inject the service and get network status İt's easy just inject the service and get network status
**You can get via signal** **You can get via signal**
```js ```ts
class someComponent{ class someComponent{
internetConnectionService = inject(InternetConnectionService); internetConnectionService = inject(InternetConnectionService);
isOnline = this.internetConnectionService.networkStatus isOnline = this.internetConnectionService.networkStatus
} }
``` ```
**or you can get as observable** **or you can get as observable**
```js ```ts
class someComponent{ class someComponent{
internetConnectionService = inject(InternetConnectionService); internetConnectionService = inject(InternetConnectionService);
isOnline = this.internetConnectionService.networkStatus$ isOnline = this.internetConnectionService.networkStatus$
} }
``` ```
That's all, feel free to try on your template That's all, feel free to try on your template

Loading…
Cancel
Save