我试图列出一个包含ÆØÅcharacthers的单词的数组。我可以列出带有 for 循环的数组,并且数组中的单词出来,但不能显示ÆØÅcharacthers - 而是显示一个问号。该数组的类型为string[]
我已经尝试将charset =“utf-8”的元标记添加到我的index.html文件的head部分,但这个剂量似乎有所帮助。
还有什么我可能会尝试使ÆØÅ使用Angular 2,通过在数组中添加包含æøå的单词不应该有任何问题吗?
我循环数组的Html文件
<div class="col-md-6 col-sm-6" *ngFor="let heatingType of heatingTypes; let i=index">
<div class="col-md-1 col-sm-1">
<input type="checkbox" value="{{ i }}" class="form-control"
formControlName="heating" [checked]="heating.indexOf(heatingType) > -1"
(click)="toggleSelection(heatingType)">
</div>
<div class="col-md-11 col-sm-11">
<label for="heating">{{ heatingType }}</label>
</div>
</div>
的index.html
<!DOCTYPE html>
<html>
<head>
<base href="/" />
<title>Some app</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('src/app').catch(function (err) { console.error(err); });
</script>
</head>
<body>
<app>
<span class="apploader">
Laster inn applikasjonen<br />
Vennligst vent ...
</span>
</app>
</body>
</html>
阵列
heatingTypes: string[] = [
'Elektriske ovner', 'Varmepumpe', 'Vannbåren varme',
'Varmekabler', 'Sentralfyr/Fjernvarme', 'Vedfyring', 'Annet'
];
答案 0 :(得分:0)
如果您已经设置了元标记,请确保HTML文件也以UTF-8格式保存,一些编辑者以不同的编码保存文件(如Sublime for Mac OS X)。要验证是否执行以下操作