Probably something super easy, but I seem unable to find the answer.
I would like to replace the properties in the <content>
section. But I don't understand how to push the title
(with content hola
) to the <content>
section.
demo-app.html
<dom-module id="demo-app">
<template>
<style>
:host {
display: block;
}
</style>
<my-el>
[[title]] or {{title}}
</my-el>
</template>
...
my-el.html
<link rel="import" href="../../bower_components/polymer/polymer.html">
<dom-module id="my-el">
<template>
<style>
:host {
display: block;
}
</style>
<content></content>
</template>
<script>
Polymer({
is: 'my-el',
properties: {
title: {
type: String,
value: 'hola',
},
}
})
</script>
</dom-module>
PS:
I'm 99% sure there are some docs that I'm missing... Any link is welcome :-P
That's technically possible if <demo-app>
had its own title
property that you bound to <my-el>.title
like this:
<dom-module id="demo-app">
<template>
<my-el title="{{title}}">
[[title]] or {{title}}
</my-el>
...
HTMLImports.whenReady(() => { Polymer({ is: 'my-el', properties: { title: { type: String, value: 'Hello world!', notify: true } } }); Polymer({ is: 'demo-app' }); });
<head> <base href="https://polygit.org/polymer+1.7.0/components/"> <script src="webcomponentsjs/webcomponents-lite.min.js"></script> <link rel="import" href="polymer/polymer.html"> </head> <body> <demo-app></demo-app> <dom-module id="demo-app"> <template> <style> h1 { color: blue; } </style> <my-el title="{{title}}"> <h1>[[title]]</h1> </my-el> </template> </dom-module> <dom-module id="my-el"> <template> <content></content> <section> <input type="text" value="{{title::input}}"> </section> </template> </dom-module> </body>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.