DomSanitizationService is not a function
You have to import and provide the BROWSER_SANITIZATION_PROVIDERS
:
import { BROWSER_SANITIZATION_PROVIDERS,
SafeResourceUrl,
DomSanitizationService } from '@angular/platform-browser';
and in your providers
array:
providers: [ParcelsService, BROWSER_SANITIZATION_PROVIDERS]
UPDATE: for the final release things changed a little
import { __platform_browser_private__,
SafeResourceUrl,
DomSanitizer } from '@angular/platform-browser';
and add it to the providers like so:
providers: [ParcelsService, __platform_browser_private__, BROWSER_SANITIZATION_PROVIDERS]
UPDATE FOR ANGULAR 4+: since Angular 4, there's some changes:
Now, you don't have to pass DomSanitizer
to providers
. You can import directly in your component and grab it in the component's constructor
. Same goes for SafeResourceUrl
.
Also:
__platform_browser_private__
is no longer in@angular/platform-browser
.BROWSER_SANITIZATION_PROVIDERS
is no longer in@angular/platform-browser
. It is now implemented [as a provider] intoBrowserModule
which can be imported from@angular/platform-browser
.- P.S.
BrowserModule
is usually added into yourapp.module
module's imports array.