0
我试图让我的角度谷歌地图工作在我的ES6语法。 在ES5它看起来像这样:Angular配置ES6语法
.config(function(uiGmapGoogleMapApiProvider) {
uiGmapGoogleMapApiProvider.configure({
// key: 'your api key',
v: '3.20',
libraries: 'weather,geometry,visualization'
});
})
在ES6我这样做,但我拿到“配置”是不是一个函数。
export default function uiGmapGoogleMapApiProvider() {
uiGmapGoogleMapApiProvider.configure({
// key: 'your api key',
v: '3.20',
libraries: 'weather,geometry,visualization'
});
}
我该如何正确写入es6?谢谢!
谢谢。但是如果我已经有一个配置呢?这种情况下的路由提供者。 – user2952238
你可以在多个地方调用.config。使用基于组件的设计,每个组件都应配置自己 – d3l33t
嗯,没有工作。它说$注入是未定义的。 – user2952238