Я следую этому примеру, чтобы создать элемент и вызвать его метод. Я делаю:
class streetViewCard extends Polymer.Element {
static get is() {
return 'street-view-card';
}
...
updateLocation(coordinates) {
//empty for now for testing
}
...
customElements.define(streetViewCard.is, streetViewCard);
И затем с помощью этого элемента и присвоения ему идентификатора streetViewCard
, затем получим этот элемент:
this.streetViewCard = document.querySelector("streetViewCard");
console.log(streetViewCard); //this logs the element to the console OK, it's NOT null
streetViewCard.updateLocation(feature.geometry.coordinates);
И это дает ошибку Uncaught TypeError: streetViewCard.updateLocation is not a function
. Есть идеи почему?
UPDATE
Как и требовалось в комментариях, обновление от console.log(streetViewCard)
:
class streetViewCard extends Polymer.Element {
static get is() {
return 'street-view-card';
}
static get properties() {
return {
title: {
type: String,
value: 'Street V…