Closed cadentic closed 3 months ago
Hi @cadentic,
You are using provideMarkdown
twice in the appConfig
and are not providing the HttpClient
.
Make sure to use the provideHttpClient()
provider fonction and use provideMarkdown({ loader: HttpClient })
afterward.
You can refer to the demo configuration below:
export const appConfig: ApplicationConfig = {
providers: [provideRouter(routes), provideClientHydration(), provideAnimationsAsync(), provideAnimationsAsync(),
provideAnimations(),
provideHttpClient(),
provideRouter(
routes,
withInMemoryScrolling({
anchorScrolling: 'enabled',
scrollPositionRestoration: 'enabled',
}),
),provideMarkdown({ loader: HttpClient }),]
};
some.componant.html
<markdown [src]="'./assets/texts/privacyPolicy.md'" ngPreserveWhitespaces ></markdown>
resolved my issue
<markdown marmaid katex [src]="'./assets/texts/privacyPolicy.md'" ngPreserveWhitespaces ></markdown>
but it throws a runtime error
NG02801: Angular detected that `HttpClient` is not configured to use `fetch` APIs. It's strongly recommended to enable `fetch` for applications that use Server-Side Rendering for better performance and compatibility. To enable `fetch`, add the `withFetch()` to the `provideHttpClient()` call at the root of the application.
thx @jfcere
I suggest to read the error and Google it...
Here I did it for you: https://stackoverflow.com/questions/77512654/angular-detected-that-httpclient-is-not-configured-to-use-fetch-apis-angul
NG02801
is not an error but an warning that encourage the developers to enable the fetch implementation of theHttpClient
.To do this, just call
provideHttpClient(withFetch())
in yourapp.config.ts
.
Closing the issue.
i also tried this method
but compile and toPromise seems deprecated in the current version.
<div style="padding:100px" markdown [src]="'./assets/texts/null.md'">
ts
package.json
what is the best way to work with makrdown for latest versions?