using paper-tabs in a component in dart angular2

I’m trying to utilize polymer paper-tabs in a dart angular2 component, but am unable. What am I missing in the code below?

In the following code, the paper-tabs specified in the index.html template work fine, but the paper-tabs in the main-app.html are not formatted correctly and disappear when clicked without any proper animation.

pubspec.yaml

name: tabs_test
version: 0.0.1
description: Test Paper Tabs
environment:
  sdk: '>=1.13.0 <2.0.0'
dependencies:
  angular2: ^2.0.0-beta.13.1
  polymer: ^1.0.0-rc.16
  polymer_elements: ^1.0.0-rc.8
transformers:
- polymer:
    entry_points: web/index.html
- angular2:
    platform_directives:
    - 'package:angular2/common.dart#COMMON_DIRECTIVES'
    - 'package:angular2/common.dart#FORM_DIRECTIVES'
    platform_pipes:
    - 'package:angular2/common.dart#COMMON_PIPES'
    entry_points: web/main.dart

index.html

<!DOCTYPE html>
<html>
  <head>
    <title>Tab Test</title>
    <script defer src="main.dart" type="application/dart"></script>
  </head>
  <body>
    <main-app></main-app>
    <paper-tabs selected="0"> <!-- THESE WORK -->
      <paper-tab>INDEX ITEM ONE</paper-tab>
      <paper-tab>INDEX ITEM TWO</paper-tab>
      <paper-tab>INDEX ITEM THREE</paper-tab>
    </paper-tabs>
  </body>
</html>

main.dart

import 'package:polymer/polymer.dart';
import 'package:angular2/platform/browser.dart';
import 'package:tabs_test/views/main_app/main_app.dart';

main() async {
  await initPolymer();
  bootstrap(MainApp, []);
}

main_app.dart

import 'package:angular2/angular2.dart';
import 'package:polymer_elements/paper_tabs.dart';
import 'package:polymer_elements/paper_tab.dart';

@Component(selector: 'main-app',
    templateUrl: 'main_app.html',
    providers: const[],
    directives: const []
)
class MainApp {
  MainApp() { }
}

main_app.html

<paper-tabs selected="0"> <!-- THESE DO NOT WORK -->
  <paper-tab>MA ITEM ONE</paper-tab>
  <paper-tab>MA ITEM TWO</paper-tab>
  <paper-tab>MA ITEM THREE</paper-tab>
</paper-tabs>

1
Leave a Reply

avatar
1 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Jason Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Jason
Guest

As usual when Polymer is used with Angular2 you need to enable full shadow DOM

Add this before other script tags

<script src="packages/web_components/webcomponents.js"></script>
<script>
   /* this script must run before Polymer is imported */
   window.Polymer = {
     dom: 'shadow',
     lazyRegister: true
   };
 </script>

For more details about this topic see https://dart.academy/dart-angular-2-and-polymer-together/

Repo project on GitHub