# Issues using ngSanitize – getting "Uncaught TypeError: Cannot read property ‘$$minErr’" I’ve gone down a lot of rat holes trying to solve what I think is a basic task – I want to call a function that returns HTML and have it displayed in my HTML document – the reason for this is that I have sections of my webpage that have the same basic HTML structure and CSS with just a few text differences that I could simply set as variables and pass into a function: export class BoxComponent implements OnInit { …. outputHtml() { this.the_html = '<h1>test</h1>'; return this.the_html; }  Is in my component which is included in another component that has the following HTML snippet: < div>{{ outputHtml() }}< /div> I realize that isn’t right – that it needs to be “sanitized” so I started to try and get ngSanitize to work so it would look something like: < div ng-bind-html=”outputHtml()”>< /div> The Angular project was created using ng new so it has an app.module.ts, and the various app.* files. All the advise I’ve seen doesn’t seem to map into the command line generated projects. I was told to add ngSanitize but I couldn’t figure out where – I finally put it in the app.module.ts file: import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AppComponent } from './app.component'; import { HeaderComponent } from './header/header.component'; import { ngSanitize } from 'angular-sanitize'; @NgModule({ declarations: [ AppComponent, HeaderComponent ], imports: [ BrowserModule, ngSanitize ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }  Once I did that, ng server seemed to start OK (finally) – but I started to get the following error in the console view of the browser: Uncaught TypeError: Cannot read property ‘$$minErr’

After more digging it appears that the cause of this error is that angular isn’t loaded yet – the advise is to include the angular.js file before the inclusion of angular-sanitize…but I have no idea how to map that advise into a project created with ng new. I looked at the package.json file but didn’t see any way to improve things there…the .angular-cli.json file doesn’t seem to help either.