Angular 组件未在 Internet Explorer 11 上显示
Angular component not showing on Internet Explorer 11
我写了一个 Angular 4 Material 2 应用程序,在 chrome 中一切正常,但在 Internet Explorer 上页面是空的。我已经在显示的 index.html 中添加了一个 <h1>
,但是在我的 content.component.html 中添加了一个不起作用,即使是整个代码组件未添加到 DOM。
index.html(<h1>Test</h1>
出现在 IE 中):
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<title>ITEM Projekte</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic">
</head>
<body>
<h1>Test</h1>
<app-root></app-root>
</body>
</html>
app.component.html(<h1>Test</h1>
在IE中不显示):
<h1>Test</h1>
<md-card>
<md-card-title>ITEM Projekt anlegen</md-card-title>
<md-card-subtitle>PROJEKTDATEN</md-card-subtitle>
<md-card-content>
<div style="width: 100%; ">
<md-input-container *ngFor="let item of projektdaten" style="margin-right: 15px; display: inline-block; ">
<label style="width: 120px; display: block;">{{item.identifier}}:</label><input mdInput name={{item.identifier}} style="width: 150px; " (keyup)="setProjectData(item, $event.target.value)">
</md-input-container>
</div>
<div style="margin-top: 20px;">
<md-radio-group>
<md-radio-button value="1" style="margin-right: 30px; ">Neubau</md-radio-button>
<md-radio-button value="2">Umbau</md-radio-button>
</md-radio-group>
</div>
</md-card-content>
<md-card-subtitle>MATERIALKOSTEN</md-card-subtitle>
<md-card-content>
<md-input-container><label>Test</label><input mdInput></md-input-container>
</md-card-content>
<md-card-subtitle>PERSONALKOSTEN</md-card-subtitle>
<md-card-content>
</md-card-content>
</md-card>
顺便说一句:在 Edge 中,一切都工作得很好,但我需要它在 IE 中工作...
如果您需要任何其他代码,请告诉我。
提前致谢
我找到了解决方案 here。
只需删除 polyfills.ts 中此行下方的评论:
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
我写了一个 Angular 4 Material 2 应用程序,在 chrome 中一切正常,但在 Internet Explorer 上页面是空的。我已经在显示的 index.html 中添加了一个 <h1>
,但是在我的 content.component.html 中添加了一个不起作用,即使是整个代码组件未添加到 DOM。
index.html(<h1>Test</h1>
出现在 IE 中):
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<title>ITEM Projekte</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic">
</head>
<body>
<h1>Test</h1>
<app-root></app-root>
</body>
</html>
app.component.html(<h1>Test</h1>
在IE中不显示):
<h1>Test</h1>
<md-card>
<md-card-title>ITEM Projekt anlegen</md-card-title>
<md-card-subtitle>PROJEKTDATEN</md-card-subtitle>
<md-card-content>
<div style="width: 100%; ">
<md-input-container *ngFor="let item of projektdaten" style="margin-right: 15px; display: inline-block; ">
<label style="width: 120px; display: block;">{{item.identifier}}:</label><input mdInput name={{item.identifier}} style="width: 150px; " (keyup)="setProjectData(item, $event.target.value)">
</md-input-container>
</div>
<div style="margin-top: 20px;">
<md-radio-group>
<md-radio-button value="1" style="margin-right: 30px; ">Neubau</md-radio-button>
<md-radio-button value="2">Umbau</md-radio-button>
</md-radio-group>
</div>
</md-card-content>
<md-card-subtitle>MATERIALKOSTEN</md-card-subtitle>
<md-card-content>
<md-input-container><label>Test</label><input mdInput></md-input-container>
</md-card-content>
<md-card-subtitle>PERSONALKOSTEN</md-card-subtitle>
<md-card-content>
</md-card-content>
</md-card>
顺便说一句:在 Edge 中,一切都工作得很好,但我需要它在 IE 中工作... 如果您需要任何其他代码,请告诉我。
提前致谢
我找到了解决方案 here。
只需删除 polyfills.ts 中此行下方的评论:
/** IE9, IE10 and IE11 requires all of the following polyfills. **/