【问题标题】:`plnkr` - getting error as `Unexpected token export` while export a typescript `interface``plnkr`-在导出打字稿`interface`时出现`Unexpected token export`错误
【发布时间】:2016-03-20 22:41:16
【问题描述】:

我在http://plnkr.co/edit 中创建了一个angular2 应用程序。一切正常。我试图导出一个interface,我收到错误Uncaught SyntaxError: Unexpected token export - 我不知道这里到底发生了什么错误。

任何人都可以帮我解决这个问题。我提供的路径是正确的importlist-item

Live Demo

【问题讨论】:

    标签: typescript angular plunker


    【解决方案1】:

    添加

    meta: { 'src/list-item.ts': { format: 'es6' }},
    

    到你的 SystemJS 配置

    Plunker

    也可能与https://phabricator.babeljs.io/T1151有关

    【讨论】:

      【解决方案2】:

      Look at this working demo - is this what you want???

      我希望你现在可以继续解决你想要的解决方案。

      export class ShoppingListComponent {
      
        listItems = new Array<ListItem>();
      
        selectedItem = ListItem;  //problem is here.
      
        selectedItem:ListItem;   // this is solution
      
        onItemAdded(item:ListItem) {
          console.log(item);
          this.listItems.push({name:item.name,amount:item.amount});
      
        }
      
      };
      

      【讨论】:

        猜你喜欢
        • 2018-08-22
        • 1970-01-01
        • 2017-12-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多