Angular 4 Meta:动态添加http-equiv

时间:2018-02-07 20:10:33

标签: angular meta

使用Angular 4(5), 我正在尝试动态添加元标记,特别是此标记:

<meta http-equiv="X-UA-Compatible" content="IE=edge">

所以在Angular,我这样做:

constructor(private meta: Meta) {
    this.meta.addTag({ httpEquiv: 'X-UA-Compatible', content: 'IE=edge' });
}

但是,上面的'http-equiv'没有连字符,如下所示:

<meta httpequiv="X-UA-Compatible" content="IE=edge">

如何让Angular呈现正确的http-equiv元标记属性?

3 个答案:

答案 0 :(得分:1)

试试

this.meta.addTag({ name: 'http-equiv', content: 'IE=edge' });

答案 1 :(得分:1)

试试这个

import os
THIS_FOLDER = os.path.dirname(os.path.abspath(__file__))
my_file = os.path.join(THIS_FOLDER, 'copy.txt')

答案 2 :(得分:0)

似乎正确的方法是:

meta.addTag({httpEquiv: 'Content-Type', content: 'text/html'}); 

https://www.concretepage.com/angular/angular-meta-service-for-meta-tags