Yevhenii Zhdan
Yevhenii Zhdan

Reputation: 57

google maps api 3: how to solve error of "unexpected token <"?

I am trying to put my working code of google maps initialization inside meteor project and get two errors which are Unexpected token < and initMap is not a function. The code of html file I am giving below:

<head>
  <title>simple</title>
</head>

<body>
  <h1>Welcome to Meteor!</h1>

  {{> hello}}
  {{> info}}
    <script src="main.js"></script>
    <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBNRzOGCsGk5u0VHjDOh_4QyJf4K-Hz5Bw&signed_in=true&libraries=places&callback=initMap"
    async defer></script>
</body>

<template name="hello">
  <button>Click Me</button>
  <p>You've pressed the button {{counter}} times.</p>
</template>

<template name="info">
  <h2>Learn Meteor!</h2>
  <ul>
    <li><a href="https://www.meteor.com/try">Do the Tutorial</a></li>
    <li><a href="http://guide.meteor.com">Follow the Guide</a></li>
    <li><a href="https://docs.meteor.com">Read the Docs</a></li>
    <li><a href="https://forums.meteor.com">Discussions</a></li>
  </ul>
</template>

Upvotes: 0

Views: 824

Answers (2)

GUISSOUMA Issam
GUISSOUMA Issam

Reputation: 2582

Use this package from atmospherejs dburles:google-maps

The documentation is well explained.

You don't need to add main.js, meteor will take care for that.

You can see this sample too example

Upvotes: 1

Faysal Ahmed
Faysal Ahmed

Reputation: 1542

you cannot add google maps api like that in meteor applications. There is a package available which will help you integrate maps into your application

dburles:google-maps

Upvotes: 0

Related Questions