Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SockId - sockId from path param & navigate to next sock #29

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

timbo-92
Copy link

No description provided.

@timbo-92 timbo-92 changed the title SockId SockId - sockId from path param & navigate to next sock May 31, 2024

@Component({
selector: 'app-sock',
standalone: true,
imports: [NgIf, AsyncPipe, TitleCasePipe],
templateUrl: './sock.component.html'
})
export class SockComponent {
export class SockComponent implements OnInit {
sockId: number = -1;
Copy link
Member

@Laoujin Laoujin May 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in plaats van fields, use the power of RXJS ;)

<a [routerLink]="['/socks', sock.id + 1]">Next Sock</a>

ctor(private route: ActivatedRoute) {}

sock$ = this.route.paramMap.pipe(
  switchMap(params => this.socksService.getById(+(params.get('id') ?? 1)))
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants