angularjs 2.0: Can't inject anything through component constructor()

前端 未结 2 1346
忘掉有多难
忘掉有多难 2020-12-12 05:50

I am creating a sample application in angularjs 2.0. While developement I came across with a serious problem - I can\'t inject anything to the component through the construc

2条回答
  •  情话喂你
    2020-12-12 06:36

    You code is fine!

    Here is your updated plunker: https://plnkr.co/edit/6SR8Ibljuy0ElEBU87ox?p=preview

    Did some changes to your system.js.config!

       // ADDED THESE TWO OPTIONS BELOW
    
       //use typescript for compilation
       transpiler: 'typescript',
       //typescript compiler options
       typescriptOptions: {
          emitDecoratorMetadata: true
       },
    

    and this..

    app: {
       main: './main.ts',     // CHANGES HERE
       defaultExtension: 'ts' // CHANGES HERE
    },
    

提交回复
热议问题