2017-05-03 55 views
0

在Angular CLI項目中包含諸如localForage這樣的外部庫的步驟是什麼!LocalForage和Angular-cli,導入外部庫的步驟

LocalForage:https://github.com/localForage/localForage

繼LocalForage

  1. 安裝包中提供的README.md文件:npm install localforage
  2. 添加腳本到我angular.cli
    "scripts": ["../node_modules/localforage/dist/localforage.min.js"],

    3.現在我不得不進口localForage由打字稿
    "import localForage from" localforage ";

    但承認,我怎麼能導入localForage到我tsconfig.json?

回答

1

對於包含d.ts文件的庫包,您無需任何操作即可獲取打包文件。 Angular包已經包含了它們。

  • :只要使用導入localForage:
    import * as localForage from "localforage";