I'm having an issue understanding how Polymer 1.0 handles declared properties, specifically those with the type="object". In order to figure this out I am trying to create a simple element to select a material type and display things about it.
Here is what my element looks like so far
<dom-module id="mat-panel">
<style>
:host {
background: blue;
}
</style>
<template>
<iron-selector attr-for-selected="name" selected="{{material}}">
<div name="polyester">Polyester</div>
<div name="nylon">Nylon</div>
<div name="polypropylene">Polypropylene</div>
<div name="kevlar">Kevlar</div>
</iron-selector>
<h1>{{material}}</h1>
<ul>
<li>{{material.color}}</li>
<li>{{material.price}}</li>
</ul>
</template>
</dom-module>
<script>
(function() {
Polymer({
is: 'mat-panel',
properties: {
material: {
type: Object,
notify: true;
value:{
kevlar: {
color: 'red'
price: 1.25
},
nylon: {
color: 'black'
price: 2.50
},
polypropylene: {
color: 'green'
price: 3.15
},
polyester: {
color: 'purple'
price: 4.25
}
}
}
}
});
})();
</script>
Iron-selector should allow the user to select a material and then display the material name in the h1, and the color and prices in the li's.
So the two things I need to know are:
- Is my material object formatted correctly? If not how should it look? ( I know it isn't because of console errors being thrown for the "{" after "value:")
- Are my bindings set correctly? If not how should it be set up?