如何在角度5中使用第三方组件?

时间:2017-11-23 10:36:14

标签: angular

该库包含两个文件(在node_modules / my-lib中):

  1. 一些-component.js
  2. 一些-component.metadata.json
  3. ngc创建了一个工厂:

    {
        "compilerOptions": {
            "target": "es5",
            "module": "es2015",
            "moduleResolution": "node",
            "sourceMap": true,
            "emitDecoratorMetadata": true,
            "experimentalDecorators": true,
            "declaration": false,
            "outDir": "tmp/aot-js",
            "allowJs": true,
            "lib": [
                "es2015",
                "dom"
            ],
            "noImplicitAny": true,
            "suppressImplicitAnyIndexErrors": true,
            "typeRoots": [
                "./node_modules/@types/"
            ]
        },
        "files": [
            "src / app / app.module.ts"
        ],
        "angularCompilerOptions": {
            "skipMetadataEmit": false,
            "strictMetadataEmit": false
        },
        "exclude": [
            "node_modules",
            "tmp/**/*",
            "src/main.ts"
        ]
    }
    

    汇总找不到" ./ some-component"文件,因为它位于node_modules / my-lib。

    早些时候,在Angular 4中,工厂是这样创建的:

    containment: "#table1",

    我的tsconfig.json:

    import facebook
    def main():
        graph = facebook.GraphAPI(access_token='your_user_access_token', 
           version='2.8')
        #if version 2.8 shows error use 2.6
        attachment =  {
            'name': 'Link name'
            'link': 'https://www.example.com/',
            'caption': 'Check out this example',
            'description': 'This is a longer description of the attachment',
            'picture': 'https://www.example.com/thumbnail.jpg'
        }
    
        graph.put_wall_post(message='Check this out...', 
           attachment=attachment, profile_id='your_page_id')
    
    if __name__ == "__main__":
        main()
    

    现在如何使用第三方库?

1 个答案:

答案 0 :(得分:0)

你要在“scripts”数组下的.angular-cli.json文件中声明JS组件的路径