-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(injectors): Spanish translation for injectRouteFragment
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "Sergi Dote Teixidor", | ||
"linkedin": "https://www.linkedin.com/in/sergidote/", | ||
"github": "https://github.com/sergidt" | ||
} |
39 changes: 39 additions & 0 deletions
39
docs/src/content/docs/es/utilities/Injectors/inject-route-fragment.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
title: injectRouteFragment | ||
description: ngxtension/inject-route-fragment | ||
entryPoint: inject-route-fragment | ||
contributors: ['sergi-dote'] | ||
--- | ||
|
||
`injectRouteFragment` es una función auxiliar que nos permite inyectar el fragmento url de la ruta actual, como signal. | ||
|
||
```ts | ||
import { injectRouteFragment } from 'ngxtension/inject-route-fragment'; | ||
``` | ||
|
||
## Uso | ||
|
||
`injectRouteFragment` cuando se invoca, devuelve una signal con el fragmento url actual. | ||
|
||
```ts | ||
@Component(...) | ||
class TestComponent { | ||
fragment = injectRouteFragment(); | ||
} | ||
``` | ||
|
||
Podemos pasar una función de transformación o un inyector personalizado. | ||
|
||
```ts | ||
@Component() | ||
class TestComponent implements OnInit { | ||
injector = inject(Injector); | ||
|
||
ngOnInit() { | ||
const isFragmentAvailable: Signal<boolean> = injectRouteFragment({ | ||
transform: (fragment) => !!fragment, | ||
injector: this.injector, | ||
}); | ||
} | ||
} | ||
``` |