【发布时间】:2016-06-26 09:27:40
【问题描述】:
当我在一个主页上工作时,我真的需要一个简单的地图,比如我的 angular2 应用程序中的谷歌地图。应该有地图的地方什么也没有显示。当然,我只是错过了一些东西。
下面是我的 System.config
<!-- Configure SystemJS -->
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
},
'ng2-map': {
main: 'index.js',
defaultExtension: 'js'
}
},
map: {
'ng2-map': 'node_modules/ng2-map'
}
});
System.import('app/js/main').then(null, console.error.bind(console));
</script>
然后是组件尝试使用 map 指令。
import { NG2_MAP_DIRECTIVES } from "ng2-map";
@Component({
selector: 'contact',
templateUrl: '../../../html/contact.html',
directives: [NG2_MAP_DIRECTIVES]
})
最后是 html 部分:
<div class="ContentRow-Paralax" id="secondAbout">
<div class="topstripe">
</div>
<div class="stripe">
<h2>Trollolol</h2>
</div>
<div class="ContentRow-Paralax">
<ng2-map id="map" [center]="[40.74, -74.18]" default-style="false"></ng2-map>
我认为没有太多其他事情发生,也没有错误日志可以告诉我哪里出错了。希望你能帮帮我! =)
【问题讨论】:
标签: google-maps angular2-directives