A public channel for the Angular community to come talk about Scully and JAMStack strategies in Angular.
:slug
route match another component called BlogPostComponent
npm run build
-> npm run scully
-> npm run scully serve
highlight: (code, lang) => {
if (!Prism.languages[lang]) {
console.error(`Language '${lang}' is not available in Prism.js, ignoring syntax highlighting for this code block.`);
return code;
}
Hello. I have a strange and annoying post list disappearing on my home page where I list all blog posts.
Can someone explain why I have such behavior and how to fix it?
in a component i have
$blogPosts = this.scully.available$.pipe(
map((routes) =>
routes.filter(
(route) =>
route.route.startsWith('/blog/') && route.sourceFile.endsWith('.md')
)
)
);
in a template i have
<div *ngFor="let post of $blogPosts | async">
<div class="uk-card uk-card-default uk-card-hover uk-card-small" routerLink="/blog/{{post.slug}}">
<div class="uk-card-media-top">
<img src={{post.thumbnail}} alt="">
</div>
<div class="uk-card-body">
<h3 class="uk-card-title">{{post.title}}</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
</div>
</div>
</div>
@SanderElias I fixed my issue thanks to your suggestion.
used this code instead of simple get data observable:
this.blogPosts$ = this.transferStateService.useScullyTransferState(
'allPosts',
this.scully.available$.pipe(
map((routes) =>
routes.filter(
(route) =>
route.route.startsWith('/blog/') &&
route.sourceFile.endsWith('.md')
)
)
)
);
BTW useScullyTransferState is not included and described in the official documentation,
I would suggest to add it there as well as a few examples of how to use it for async operations.