使用Angular2的聚合物纸张菜单

时间:2016-02-12 07:19:40

标签: angular polymer-1.0

我试图使用Angular2 beta3使用Polymer v1.0元素,但我遇到了问题。一些元素工作正常,例如输入框。

然而,当我尝试使用纸质菜单或纸张下拉菜单时,它无法正常工作。

如何让这个plnkr工作?

http://plnkr.co/edit/2n7xWH0MViPtO8AwZwq2?p=preview

<!DOCTYPE html>
<html>
  <head>
    <title>Angular 2 QuickStart</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">    

    <script src="https://cdn.rawgit.com/download/polymer-cdn/1.1.4/lib/webcomponentsjs/webcomponents-lite.js"></script>

    <script>
      window.Polymer = window.Polymer || {};
      window.Polymer.dom = 'shadow';
    </script>

    <!-- 1. Load libraries -->
    <!-- IE required polyfills, in this exact order -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.33.3/es6-shim.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.16/system-polyfills.js"></script>

    <script src="https://code.angularjs.org/2.0.0-beta.3/angular2-polyfills.js"></script>
    <script src="https://code.angularjs.org/tools/system.js"></script>
    <script src="https://code.angularjs.org/tools/typescript.js"></script>
    <script src="https://code.angularjs.org/2.0.0-beta.3/Rx.js"></script>
    <script src="https://code.angularjs.org/2.0.0-beta.3/angular2.dev.js"></script>

    <link rel="import" href="https://cdn.rawgit.com/download/polymer-cdn/1.1.4/lib/paper-menu/paper-menu.html" />
    <link rel="import" href="https://cdn.rawgit.com/download/polymer-cdn/1.1.4/lib/paper-dropdown-menu/paper-dropdown-menu.html" />

    <!-- 2. Configure SystemJS -->
    <script>
      System.config({
        transpiler: 'typescript', 
        typescriptOptions: { emitDecoratorMetadata: true }, 
        packages: {'app': {defaultExtension: 'ts'}} 
      });
      System.import('app/main')
            .then(null, console.error.bind(console));
    </script>

  </head>

  <!-- 3. Display the application -->
  <body>
    <my-app>Loading...</my-app>
  </body>

</html>

1 个答案:

答案 0 :(得分:0)

您必须导入您正在使用的所有元素。

缺少进口
  • 纸项目
  • 纸列表框

我还认为导入完整的polyfill非常重要

SELECT   * 
FROM     golden_leaves.forms 
WHERE    input_date >= '2016-02-01 00:00:35' AND 
         -- Here ----------^
         input_date <= '2016-02-11 23:08:39' 
ORDER BY id DESC;

而不是精简

<script src="https://cdn.rawgit.com/download/polymer-cdn/1.1.4/lib/webcomponentsjs/webcomponents.js"></script>
固定示例的

Plunker example