0
使用MATHML
我想用MATHML內Ionic2,我加在的index.html mathjax CDN,並在app.module.ts無法在Ionic2
<script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=MML_CHTML"></script>
添加CUSTOM_ELEMENTS_SCHEMA @ NgModule我使用
import { NgModule,CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { IonicApp, IonicModule } from 'ionic-angular';
import { MyApp } from './app.component';
import { HelloIonicPage } from '../pages/hello-ionic/hello-ionic';
import { ItemDetailsPage } from '../pages/item-details/item-details';
import { ListPage } from '../pages/list/list';
import {MathmlComponent} from '../components/mathml-component/mathml-component';
@NgModule({
declarations: [
MyApp,
HelloIonicPage,
ItemDetailsPage,
ListPage,
MathmlComponent
],
imports: [
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HelloIonicPage,
ItemDetailsPage,
ListPage
],
providers: [],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppModule {}
我MATHML-component.ts是
import {Component} from "@angular/core";
@Component({
selector:'mathml-component',
template:`
<math>
<mstyle displaystyle="true">
<mover>
<mrow>
<mi>f</mi>
</mrow>
<mo>→</mo>
</mover>
</mstyle>
</math>
`
})
export class MathmlComponent{
constructor(){
console.log('done')
}
}
但我得到錯誤
polyfills.js:3 Unhandled Promise rejection: Template parse errors:
':math:mi' is not a known element:
1. If ':math:mi' is an Angular component, then verify that it is part of this module.
2. If ':math:mi' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("
<mover>
<mrow>
[ERROR ->]<mi>f</mi>
</mrow>
<mo>→</mo>
"): [email protected]:10
':math:mrow' is not a known element:
plz幫助。
未來的注意事項:cdn.mathjax.org即將結束生命週期,請查看https://www.mathjax.org/cdn-shutting-down/獲取遷移提示。 –