I have to make use of innerHtml directive but it ignores the styling of the elements so I created a custom safeHtml pipe to render the CSS of the element basically, I am injecting HTML elements to my dom using innerHtml. But the pip doesn't work.
app.module.ts
import { ViewComponent } from './view/view.component';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component';
import { CategoryComponent } from './category/category.component';
import { AboutComponent } from './about/about.component';
import { ContactComponent } from './contact/contact.component';
import { UserComponent } from './user/user.component';
import { SafeHtmlPipe } from './view/post.pipe';
@NgModule({
  declarations: [
    AppComponent,
    HomeComponent,
    ViewComponent,
    CategoryComponent,
    AboutComponent,
    ContactComponent,
    UserComponent,
    SafeHtmlPipe
  ],
  imports: [BrowserModule, AppRoutingModule],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule {}
post.pipe.ts
import { DomSanitizer } from "@angular/platform-browser";
import { Pipe, PipeTransform } from "@angular/core";
@Pipe({ name: "safeHtml" })
export class SafeHtmlPipe implements PipeTransform {
  constructor(private sanitized: DomSanitizer) {}
  transform(value: string) {
    return this.sanitized.bypassSecurityTrustHtml(value);
  }
}
view.component.ts
import { Component, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router";
@Component({
  selector: "app-view",
  templateUrl: "./view.component.html",
  styleUrls: ["./view.component.scss"]
})
export class ViewComponent implements OnInit {
  id: number;
  card = {
    title: `Title here`,
    shortDesc: `Short desc`,
    author: `Author`,
    thumbnail: `Thumbnail URL`,
    datePublished: `date`,
    content: `card content`
  };
  constructor(private route: ActivatedRoute) {}
  showPostContent() {
    document.getElementById("postContent").innerHTML = this.card.content;
  }
  ngOnInit() {
    this.route.params.subscribe(params => {
      this.id = params.id;
    });
    // this.showPostContent();
  }
}
view.component.html
<div [innerHtml]="card.content | safeHtml"></div>
How can I resolve this issue?
 
     
    