简体   繁体   English

离子不导入ngx-mathjax模块

[英]Ionic not importing ngx-mathjax module

I'm trying to install Mathjax in an ionic app using ngx-mathjax ( https://www.npmjs.com/package/ngx-mathjax )我正在尝试使用 ngx-mathjax ( https://www.npmjs.com/package/ngx-mathjax ) 在离子应用程序中安装 Mathjax

I imported the module in app.module.ts and pasted the config method as shown.我在 app.module.ts 中导入了模块并粘贴了配置方法,如图所示。 I added tags in the component I want to use Mathjax in, but the "import MathJaxModule" line is failing.我在要使用 Mathjax 的组件中添加了标签,但“import MathJaxModule”行失败。

The given import statement fails with runtime error: "Cannot find module "./src/app/math-jax/math-jax.module". VSCode underlines it in red actually.给定的导入语句失败并出现运行时错误:“找不到模块“./src/app/math-jax/math-jax.module”。VSCode 实际上用红色强调了它。

I've tried a few different paths:我尝试了几种不同的路径:

'ngx-mathjax/src/app/math-jax/math-jax.module';

'../../node_modules/ngx-mathjax/src/app/math-jax/math-jax.module';

and I get the same error just with the paths changed.只是路径改变了,我得到了同样的错误。 I'm not sure if the package has problems or I'm just an idiot.我不确定包裹是否有问题,或者我只是个白痴。 I'm assuming the latter.我假设是后者。

Here's the relevant code from my app.module.ts file:这是我的 app.module.ts 文件中的相关代码:

import {MathJaxModule} from './src/app/math-jax/math-jax.module';


@NgModule({
  imports: [
    MathJaxModule.config({
      version: '2.7.5',
      config: 'TeX-AMS_HTML',
      hostname: 'cdnjs.cloudflare.com'
    })
  ],
  declarations: [
    MyApp,
    HeaderComponent,
    ...pages,
  ],
  entryComponents: [
    MyApp,
    ...pages,
  ],
  providers: [
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler},
    CourseService,
    StorageService,
    AppRate
  ],
  bootstrap: [IonicApp]
})
export class AppModule {}

Here's my HTML这是我的 HTML


  <div mathjax>
$$
f\\left(-2\\right)
$$
</div>

Any help with the issue would be appreciated.任何有关该问题的帮助将不胜感激。 Thanks!谢谢!

像这样导入

import { MathJaxModule } from 'ngx-mathjax';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM