<head>
41 | ....
42 | <script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
43 | <link rel="import" href="bower_components/google-map/google-map.html">
44 | </head>
45 | some code
38 | inline
39 | An example of <google-codelab-survey>
[[json(a)]]56 | 57 | google-codelab-survey-answer detail: 58 | 59 | 60 | answers-changed detail: 61 | 62 | 63 | 64 | 65 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /analytics-behavior.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 93 | -------------------------------------------------------------------------------- /test/survey.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 |
An example of <google-codelab-step>
The Google Web Components provide the <google-map> element for declaratively rendering a Google Map. To use it, you first need to install it using Bower.
The first time you run Chrome Dev Editor it will ask you to setup your workspace environment.
Fire up Chrome Dev Editor and start a new project:
to start a new project.
Chrome Dev Editor creates a basic scaffold for your Polymer app. In the background, it also uses Bower to download and install a list of dependencies (including the Polymer core library) into the bower_components/ folder. Fetching the components make take some time if your internet connection is slow. You'll learn more about using Bower in the next step.
PolymerMapsCodelab/
76 | bower_components/ <!-- installed dependencies from Bower -->
77 | bower.json <!-- Bower metadata files used for managing deps -->
78 | index.html <!-- your app -->
79 | main.js
80 | styles.css
81 |
82 | Normally, you'd run bower install GoogleWebComponents/google-map --save on the command line to install <google-map> and save it as a dependency. However, Chrome Dev Editor does not have a command line for running Bower commands. Instead, you need to manually edit bower.json to include google-map, then run Chrome Dev Editor's Bower Update feature. Bower Update checks the dependencies in bower.json and installs any missing ones.
bower.json and add google-map to the dependencies object:"dependencies": {
86 | "iron-elements": "PolymerElements/iron-elements#^1.0.0",
87 | "paper-elements": "PolymerElements/paper-elements#^1.0.1",
88 | "google-map": "GoogleWebComponents/google-map#^1.0.3"
89 | }
90 |
91 | bower.json filename in the editor.
The download may take few seconds. You can verify that <google-map> (and any dependencies) were installed by checking that bower_components/google-map/ was created and populated.
To employ <google-map>, you need to:
index.html.In index.html, remove all other HTML imports in the <head> and replace them with a single import that loads google-map.html:
<head>
103 | ....
104 | <script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
105 | <link rel="import" href="bower_components/google-map/google-map.html">
106 | </head>
107 |
108 |
109 | Next, replace the contents of <body> with an instance of <google-map>:
<body unresolved>
113 | <google-map latitude="37.779" longitude="-122.3892" zoom="13"></google-map>
114 | </body>
115 |
116 | Here's a pre block without code:
117 |$ node client.js list wdfasdf asdf asdf asdf asdf asdf asdf asdf asdf asdfa sdf asdfa sdf asdfa sdfasdfasdfasdf
118 | { books:
119 | [ { id: 123,
120 | title: 'A Tale of Two Cities',
121 | author: 'Charles Dickens' } ] }
122 |
123 | As you can see, using <google-map> is completely declarative! The map is centered using the latitude and longitude attributes and its zoom level is set by the zoom attribute.
If you run the app right now, nothing will display. In order for the map to properly display itself, you need to set its container (in this case, <body>) to have a fixed height.
Open styles.css and replace its contents with default styling:
body, html {
129 | font-family: 'Roboto', Arial, sans-serif;
130 | height: 100%;
131 | margin: 0;
132 | }
133 |
134 | <google-map> supports adding map markers to the map by declaring <google-map-marker> elements as children. The marker locations are also set using latitude and longitude attributes.
Back in index.html, add a draggable <google-map-marker> to the map:
<google-map latitude="37.779" longitude="-122.3892" zoom="13" disable-default-ui>
139 | <google-map-marker latitude="37.779" longitude="-122.3892"
140 | title="Go Giants!" draggable="true"></google-map-marker>
141 | </google-map>
142 |
143 | Notice that we've also disabled the map's controls by setting disableDefaultUi to true. Since it's a boolean property, its presence as an HTML attribute makes it truthy.
If you haven't already done so, hit the
button. At this point, you should see a map that takes up the entire viewport and has a single marker pin.


In this codelab, You'll create a fully working Google Maps app using elements in Polymer's Google Web Components collection. The app will be responsive, include driving directions, and transit a mode. Along the way, you'll also learn about Polymer's data-binding features and iron element set.
53 |A paper-button wrapped into anchor element:
77 | 78 | 79 | 80 |The first time you run Chrome Dev Editor it will ask you to setup your workspace environment.
Fire up Chrome Dev Editor and start a new project:
to start a new project.
Chrome Dev Editor creates a basic scaffold for your Polymer app. In the background, it also uses Bower to download and install a list of dependencies (including the Polymer core library) into the bower_components/ folder. Fetching the components make take some time if your internet connection is slow. You'll learn more about using Bower in the next step.
PolymerMapsCodelab/
89 | bower_components/ <!-- installed dependencies from Bower -->
90 | bower.json <!-- Bower metadata files used for managing deps -->
91 | index.html <!-- your app -->
92 | main.js
93 | styles.css
94 |
95 | At any point, select the index.html file and hit the
button in the top toolbar to run the app. Chrome Dev Editor fires up a web server and navigates to the index.html page. This is great way to preview changes as you make them.

At this point the app doesn't do much. Let's add a map!
99 | 100 |The Google Web Components provide the <google-map> element for declaratively rendering a Google Map. To use it, you first need to install it using Bower.
Normally, you'd run bower install GoogleWebComponents/google-map --save on the command line to install <google-map> and save it as a dependency. However, Chrome Dev Editor does not have a command line for running Bower commands. Instead, you need to manually edit bower.json to include google-map, then run Chrome Dev Editor's Bower Update feature. Bower Update checks the dependencies in bower.json and installs any missing ones.
bower.json and add google-map to the dependencies object:"dependencies": {
111 | "iron-elements": "PolymerElements/iron-elements#^1.0.0",
112 | "paper-elements": "PolymerElements/paper-elements#^1.0.1",
113 | "google-map": "GoogleWebComponents/google-map#^1.0.3"
114 | }
115 | bower.json filename in the editor.
The download may take few seconds. You can verify that <google-map> (and any dependencies) were installed by checking that bower_components/google-map/ was created and populated.
To employ <google-map>, you need to:
index.html.In index.html, remove all other HTML imports in the <head> and replace them with a single import that loads google-map.html:
<head>
127 | ....
128 | <script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
129 | <link rel="import" href="bower_components/google-map/google-map.html">
130 | </head>
131 |
132 |
133 | Next, replace the contents of <body> with an instance of <google-map>:
<body unresolved>
137 | <google-map latitude="37.779" longitude="-122.3892" zoom="13"></google-map>
138 | </body>
139 | As you can see, using <google-map> is completely declarative! The map is centered using the latitude and longitude attributes and its zoom level is set by the zoom attribute.
If you run the app right now, nothing will display. In order for the map to properly display itself, you need to set its container (in this case, <body>) to have a fixed height.
Open styles.css and replace its contents with default styling:
body, html {
145 | font-family: 'Roboto', Arial, sans-serif;
146 | height: 100%;
147 | margin: 0;
148 | }
149 |
150 | <google-map> supports adding map markers to the map by declaring <google-map-marker> elements as children. The marker locations are also set using latitude and longitude attributes.
Back in index.html, add a draggable <google-map-marker> to the map:
<google-map latitude="37.779" longitude="-122.3892" zoom="13" disable-default-ui>
155 | <google-map-marker latitude="37.779" longitude="-122.3892"
156 | title="Go Giants!" draggable="true"></google-map-marker>
157 | </google-map>
158 | Notice that we've also disabled the map's controls by setting disableDefaultUi to true. Since it's a boolean property, its presence as an HTML attribute makes it truthy.
If you haven't already done so, hit the
button. At this point, you should see a map that takes up the entire viewport and has a single marker pin.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur quis dolor vel arcu blandit tristique. Proin vestibulum nec felis non fringilla. Pellentesque vulputate dui ut risus bibendum, sed egestas arcu ullamcorper. Quisque eget eros pellentesque, aliquet tortor placerat, vehicula lectus. Fusce sit amet mattis turpis, et tempus orci. Vestibulum mauris velit, vulputate a risus quis, imperdiet hendrerit ante. Nunc sollicitudin risus tortor, ac venenatis sem volutpat malesuada. Mauris neque metus, ornare eget porta id, tincidunt vitae magna. In scelerisque quam auctor maximus pellentesque. Sed laoreet ex mi, vel lacinia urna consectetur id. Sed est quam, finibus eget orci in, vulputate tempus diam
62 | 63 |
In this codelab, You'll create a fully working Google Maps app using elements in Polymer's Google Web Components collection. The app will be responsive, include driving directions, and transit a mode. Along the way, you'll also learn about Polymer's data-binding features and iron element set.
75 |The first time you run Chrome Dev Editor it will ask you to setup your workspace environment.
Fire up Chrome Dev Editor and start a new project:
to start a new project.
Chrome Dev Editor creates a basic scaffold for your Polymer app. In the background, it also uses Bower to download and install a list of dependencies (including the Polymer core library) into the bower_components/ folder. Fetching the components make take some time if your internet connection is slow. You'll learn more about using Bower in the next step.
PolymerMapsCodelab/
106 | bower_components/ <!-- installed dependencies from Bower -->
107 | bower.json <!-- Bower metadata files used for managing deps -->
108 | index.html <!-- your app -->
109 | main.js
110 | styles.css
111 |
112 | At any point, select the index.html file and hit the
button in the top toolbar to run the app. Chrome Dev Editor fires up a web server and navigates to the index.html page. This is great way to preview changes as you make them.

At this point the app doesn't do much. Let's add a map!
116 | 117 |The Google Web Components provide the <google-map> element for declaratively rendering a Google Map. To use it, you first need to install it using Bower.
Normally, you'd run bower install GoogleWebComponents/google-map --save on the command line to install <google-map> and save it as a dependency. However, Chrome Dev Editor does not have a command line for running Bower commands. Instead, you need to manually edit bower.json to include google-map, then run Chrome Dev Editor's Bower Update feature. Bower Update checks the dependencies in bower.json and installs any missing ones.
bower.json and add google-map to the dependencies object:"dependencies": {
128 | "iron-elements": "PolymerElements/iron-elements#^1.0.0",
129 | "paper-elements": "PolymerElements/paper-elements#^1.0.1",
130 | "google-map": "GoogleWebComponents/google-map#^1.0.3"
131 | }
132 | bower.json filename in the editor.
The download may take few seconds. You can verify that <google-map> (and any dependencies) were installed by checking that bower_components/google-map/ was created and populated.
To employ <google-map>, you need to:
index.html.In index.html, remove all other HTML imports in the <head> and replace them with a single import that loads google-map.html:
<head>
144 | ....
145 | <script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
146 | <link rel="import" href="bower_components/google-map/google-map.html">
147 | </head>
148 |
149 |
150 | Next, replace the contents of <body> with an instance of <google-map>:
<body unresolved>
154 | <google-map latitude="37.779" longitude="-122.3892" zoom="13"></google-map>
155 | </body>
156 | As you can see, using <google-map> is completely declarative! The map is centered using the latitude and longitude attributes and its zoom level is set by the zoom attribute.
If you run the app right now, nothing will display. In order for the map to properly display itself, you need to set its container (in this case, <body>) to have a fixed height.
Open styles.css and replace its contents with default styling:
body, html {
162 | font-family: 'Roboto', Arial, sans-serif;
163 | height: 100%;
164 | margin: 0;
165 | }
166 |
167 | <google-map> supports adding map markers to the map by declaring <google-map-marker> elements as children. The marker locations are also set using latitude and longitude attributes.
Back in index.html, add a draggable <google-map-marker> to the map:
<google-map latitude="37.779" longitude="-122.3892" zoom="13" disable-default-ui>
172 | <google-map-marker latitude="37.779" longitude="-122.3892"
173 | title="Go Giants!" draggable="true"></google-map-marker>
174 | </google-map>
175 | Notice that we've also disabled the map's controls by setting disableDefaultUi to true. Since it's a boolean property, its presence as an HTML attribute makes it truthy.
If you haven't already done so, hit the
button. At this point, you should see a map that takes up the entire viewport and has a single marker pin.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur quis dolor vel arcu blandit tristique. Proin vestibulum nec felis non fringilla. Pellentesque vulputate dui ut risus bibendum, sed egestas arcu ullamcorper. Quisque eget eros pellentesque, aliquet tortor placerat, vehicula lectus. Fusce sit amet mattis turpis, et tempus orci. Vestibulum mauris velit, vulputate a risus quis, imperdiet hendrerit ante. Nunc sollicitudin risus tortor, ac venenatis sem volutpat malesuada. Mauris neque metus, ornare eget porta id, tincidunt vitae magna. In scelerisque quam auctor maximus pellentesque. Sed laoreet ex mi, vel lacinia urna consectetur id. Sed est quam, finibus eget orci in, vulputate tempus diam
187 | 188 |Step {{_storedStep.step}}: {{_storedStep.label}}
169 | 173 |