This project is a generator for make the static directives to build the polymer elements with angular2-cli.
There is already some elements that have been generated here you can use.
- Install all dependencies.
npm install
bower install
- Check src/index.html and bower.json if there is already including the polymer element you want. If not, add them just like the way you use in your app.
- in src/index.html:
<link rel="import" href="assets/bower_components/paper-input/paper-input.html">
- in bower.json, run:
bower install --save paper-input
- Run the server
ng serve
- See "http://localhost:4200/" , input the name of the element and press button "Generate Code".
- If the include is not correct, there may be a error message looks like
The Polymer element "xxxx" has not been registered....
- Copy the code to save a file named "xxxxx.directives.ts", just like the first line suggested.
- Include the directive file to your module.ts.
import { PaperInput } from './polymer/paper-input-directives';
and add the directive as
declarations: [
...
PaperInput,
...
see the whole sample project of how to use static directives