Comments (13)
You need to install typings for google.maps
. Please look at typings.json
in this repo.
from map.
Thanks, I will look into ASAP. Meanwhile, if you provide me a plunker example, that makes me a lot easier to debug your issue.
from map.
Can I push code into my git?
from map.
Here is my github https://github.com/rockways3002/example-ng2-map.git
from map.
Thanks for trying this map. af far as I see , your git does not have systemjs.config.js
, which points where ng2-map
is and how to use it.
from map.
Hi allenhwkim,
I'm updated systemjs.config.js now. Can you help me check one more time. :)
from map.
Here are the things made to make your git repo to work.
diff --git a/app/app.component.ts b/app/app.component.ts
index d79bc51..a59ad5f 100644
--- a/app/app.component.ts
+++ b/app/app.component.ts
@@ -7,7 +7,7 @@ import { NG2_MAP_DIRECTIVES } from "ng2-map";
selector: 'my-app',
template: `
<div id="map">
- <ng2-map [center]="Brampton, Canada"></ng2-map>
+ <ng2-map center="Brampton, Canada"></ng2-map>
</div>
`,
directives: [NG2_MAP_DIRECTIVES],
@@ -15,4 +15,4 @@ import { NG2_MAP_DIRECTIVES } from "ng2-map";
export class AppComponent {
-}
\ No newline at end of file
+}
diff --git a/index.html b/index.html
index 32e29ce..e24c3a6 100644
--- a/index.html
+++ b/index.html
@@ -10,6 +10,8 @@
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
+ <script src="https://npmcdn.com/[email protected]/lib/typescript.js"></script>
+
<!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script>
<script>
@@ -20,4 +22,4 @@
<body>
<my-app>Loading...</my-app>
</body>
-</html>
\ No newline at end of file
+</html>
diff --git a/systemjs.config.js b/systemjs.config.js
index 7b37afd..e458308 100644
--- a/systemjs.config.js
+++ b/systemjs.config.js
@@ -13,10 +13,10 @@
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
- 'app': { main: 'main.js', defaultExtension: 'js' },
+ 'app': { main: 'main.ts', defaultExtension: 'ts' },
'rxjs': { defaultExtension: 'js' },
'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },
- 'ng2-map': { main: 'index.js', defaultExtension: 'js' }
+ 'ng2-map': { main: 'dist/index.js', defaultExtension: 'js' }
};
var ngPackageNames = [
'common',
@@ -43,6 +43,10 @@
// Add package entries for angular packages
ngPackageNames.forEach(setPackageConfig);
var config = {
+ transpiler: 'typescript', //use typescript for compilation
+ typescriptOptions: { //typescript compiler options
+ emitDecoratorMetadata: true
+ },
map: map,
packages: packages
};
You may not need all of them, but at least it would be helpful for you.
Please follow README and don't forget to add api key if your domain is new or test on localhost.
NOTE: if you domain is new, and you are having api key error, please specify your api key like the following
import { NG2_MAP_DIRECTIVES, Ng2MapComponent } from "ng2-map"; // <--- this
// Ng2MapComponent.apiUrl = "https://maps.google.com/maps/api/js?key=YOUR_KEY"; // ???
@Component({ ... })
export class AppComponent {
constructor() {
Ng2MapComponent.apiUrl = "https://maps.google.com/maps/api/js?key=YOUR_KEY";
}
}
from map.
You are very kind! :)
Thank you so much!
from map.
You are welcome. If you don't mind, please add a star on this repo, so that other developer can use it.
from map.
I'm changed to the same of you, but not working :(
from map.
I think you are doing strict type checking. change .apiUrl
to ['apiUrl']
. That may work
from map.
HOw about Cannot find namespace 'google'.
from map.
Now it uses .umd.js, typescript errors shouldn't be matter any more
from map.
Related Issues (20)
- Marker Limit? - Error finding location for ... HOT 3
- For development purposes only HOT 1
- How to achieve navigation for a given route?
- How to only refresh the markers on map without refreshing the whole map..?
- Problem with adding a new component with svg HOT 2
- ngui-map, error finding the location from 28.577282, 77.3264023 HOT 2
- map.setCenter doesn't do anything HOT 3
- Map doesn't respect "aria-hidden="true"
- Custom labels on Polygon or Custom labels on maps
- Error: fitBounds: latLngBounds must be of type LatLngBounds.
- mapClick and click events works like they set with useCapture on touch screen
- Cant update my map with my gps data via a mqtt channel, it complains on this "js?v=3.exp&key=&callback=initialize:63 InvalidValueError: at index 0: not a LatLng or LatLngLiteral with finite coordinates: in property lat: NaN is not an accepted value"
- Autocomplete not initialising on route change.
- Is this repo being maintained anymore? HOT 1
- How to disable "Know your location" popup?
- How to disable moving to your current location on loading?
- Source Code vs. NPM
- Error: node_modules/@ngui/map/ngui-map.module.d.ts:4:44 - error TS2314: Generic type 'ModuleWithProviders<T>' requires 1 type argument(s).
- You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors. HOT 1
- How To Style Marker
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from map.