问题
short question: Is it possible to use polymer expressions on a normal html site? So that I could write {{ 1+ 1 }}
somewhere and it would be evaluated to 2.
回答1:
If you mean "without including anything of polymer", than the short answer would be "no". Otherwise here is an example for using a polymer expression outside of a polymer element:
<!doctype html>
<html>
<head>
<script src="/components/platform/platform.js"></script>
<link href="/components/polymer/polymer.html" rel="import">
</head>
<body unresolved>
<template is="auto-binding">
1 + 1 is {{1+1}}
</template>
</body>
</html>
来源:https://stackoverflow.com/questions/24824576/use-polymer-expression-on-main-html-site