Skip to content

Commit

Permalink
docs(injectors): Spanish translation for injectRouteFragment
Browse files Browse the repository at this point in the history
  • Loading branch information
sergidt committed May 23, 2024
1 parent 211a00d commit 944f9c2
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/src/content/contributors/sergi-dote.json
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"
}
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,
});
}
}
```

0 comments on commit 944f9c2

Please sign in to comment.