-
-
Save alvarouribe/e698abf178bfb39f34c8552a0f47fcfd to your computer and use it in GitHub Desktop.
polymer// source http://jsbin.com/boraquw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>polymer</title> | |
<script src="https://rawgit.com/webcomponents/webcomponentsjs/master/webcomponents-lite.js"></script> | |
<link rel="import" href="https://rawgit.com/Polymer/polymer/master/polymer.html"> | |
</head> | |
<body> | |
<dom-module id="my-element"> | |
<template> | |
<h1>HOLA</h1> | |
<div>{{firstName}}</div> | |
<div>{{lastName}}</div> | |
<div>{{fullName}}</div> | |
</template> | |
</dom-module> | |
<script> | |
HTMLImports.whenReady(function() { | |
Polymer({ | |
is: 'my-element', | |
properties: { | |
firstName: { | |
type: String, | |
value: 'Alvaro' | |
}, | |
lastName: { | |
type: String, | |
value: 'Uribe' | |
} | |
, | |
fullName: { | |
type: String, | |
computed: 'computeFullName(firstName, lastName)' | |
} | |
}, | |
computeFullName: function(firstName, lastName) { | |
return firstName + ' ' + lastName; | |
} | |
}); | |
}); | |
</script> | |
<my-element></my-element> | |
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html> | |
<html> | |
<head> | |
<title>polymer</title> | |
<script src="https://rawgit.com/webcomponents/webcomponentsjs/master/webcomponents-lite.js"><\/script> | |
<link rel="import" href="https://rawgit.com/Polymer/polymer/master/polymer.html"> | |
</head> | |
<body> | |
<dom-module id="my-element"> | |
<template> | |
<h1>HOLA</h1> | |
<div>{{firstName}}</div> | |
<div>{{lastName}}</div> | |
<div>{{fullName}}</div> | |
</template> | |
</dom-module> | |
<script> | |
HTMLImports.whenReady(function() { | |
Polymer({ | |
is: 'my-element', | |
properties: { | |
firstName: { | |
type: String, | |
value: 'Alvaro' | |
}, | |
lastName: { | |
type: String, | |
value: 'Uribe' | |
} | |
, | |
fullName: { | |
type: String, | |
computed: 'computeFullName(firstName, lastName)' | |
} | |
}, | |
computeFullName: function(firstName, lastName) { | |
return firstName + ' ' + lastName; | |
} | |
}); | |
}); | |
<\/script> | |
<my-element></my-element> | |
</body> | |
</html> | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment