Can Polymer's paper-dialog be used with Angular2 Dart? The only discussion I could find was a question here.
I tried incorporating the code into my angular component. It didn't like $['dialogArtist']
on the dialog open. I then create a new class
class ArtistDialog extends PolymerElement {...
The $['dialogArtist]
worked there. Then I had problems with form data. It kept looking for it in the component and not the dialog. The dialog html is in the same file as the component html so that may have something to do with it. When I commented out the form. It complained about a missing intializer for the dialog class. Are there any examples of opening a Polymer paper-dialog from a Angular2 Dart component?
I think all I need to know is what I need to put in the component to open a dialog and get data from it. I presume the example in the link above is good one for a dialog class. Also where does the dialog html go?
Pertinent parts of my angular component:
@Component(selector: 'my-artists',
templateUrl: 'artists_component.html',
//encapsulation: ViewEncapsulation.Native, // added for polymer
styleUrls: const['artist.css']
)
class ArtistsComponent implements OnInit {
...
ArtistDialog editDialog;
void ngOnInit() {
getArtists();
editDialog = new ArtistDialog.created();
}
void onEditArtist() {
editArtist = selectedArtist;
editDialog.open;
}
My polymer component:
//@CustomTag('dialogArtist'); //uncomment this cause and error
class ArtistDialog extends PolymerElement {
String birth_year;
ArtistDialog.created() : super.created();
//@observable int selected = 0; // uncommenting this causes and error
void open() {
$['dialogArtist'] as PaperDialog..open();
}
}
index.html:
<!DOCTYPE html>
<html>
<head>
<title>Jazz Cat</title>
<script>
window.Polymer = window.Polymer || {};
window.Polymer.dom = 'shadow';
</script>
<!-- For testing using pub serve directly use: -->
<base href="/">
<!-- For testing in WebStorm use: -->
<!-- <base href="/dart/web/"> -->
<link rel="import" href="packages/polymer/polymer.html">
<link rel="import" href="packages/polymer_elements/iron_flex_layout.html">
<link rel="import" href="packages/polymer_elements/paper_header_panel.html">
<link rel="import" href="packages/polymer_elements/paper_toolbar.html">
<link rel="import" href="packages/polymer_elements/paper_menu.html">
<link rel="import" href="packages/polymer_elements/paper_item.html">
<link rel="import" href="packages/polymer_elements/paper_menu_button.html">
<link rel="import" href="packages/polymer_elements/paper_input.html">
<link rel="import" href="packages/polymer_elements/paper_dialog.html">
<link rel="import" href="packages/polymer_elements/iron_list.html">
<link href="master.css" rel="stylesheet" type="text/css" />
<style is="custom-style">
This is my html for the diaglog box. It's in the same file as the component html.
<polymer-element name="dialogArtist">
<paper-dialog id="dialog">
<p>This is a dialog.</p>
</paper-dialog>
</polymer-element>