Injectable cannot pass the optional parameter providedIn

In the example of the http section of the Angular6 official document, in heroes.service.ts, @ Injectable ({providedIn: "root"}) has been reporting an error
error message

before export.
ERROR in src/app/hero.service.ts(15,2): error TS2554: Expected 0 arguments, but got 1.

Injectable in api has an optional parameter providedIn

I don"t know why, but who has encountered this problem?


turns out to be a problem with angular. Angular5.x is referenced in the project, and there will be no errors if you upgrade to 6.x.


this providerIn parameter was introduced only in 6.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b22330-2b612.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b22330-2b612.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?