Search code examples
angularmeta

Angular 4 Meta: add http-equiv dynamically


Using Angular 4(5), I am trying to add a meta tag dynamically, specifically this tag:

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

So in Angular, I am doing this:

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

However, the above renders 'http-equiv' NOT hyphenated, like this:

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

How do I get Angular to render the proper http-equiv meta tag attribute?


Solution

  • Try that

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