angular 2 missing domsanitizer when try to start

2020-07-06 06:12发布

问题:

im running angular2 rc 5 all doing fine until im restart my pc and doing npm start again, before restart pc everything working fine

when im try to start my project again there is an error saying that ,

node_modules/@angular/platform-browser/index has no exported member 'DomSanitizer'

im already try to reinstall the package and copy paste the @angular file from another quickstart that working but still fail with the same error

i guess its something wrong with my @angular/platform-browser but i still cant figure it out

回答1:

If you are using angular2 RC5 use this-

  • DomSanitizationService

If you are moving to angular2 RC6 use this-

  • DomSanitizer

Reference: https://github.com/angular/angular/pull/11085

See if this helps.