Angular Configure Es6 Syntax
Im trying to get angular google maps to work in my es6 syntax. In es5 it looks like this: .config(function(uiGmapGoogleMapApiProvider) { uiGmapGoogleMapApiProvider.configure({
Solution 1:
You need to inject your dependency.
angular.module('yourApp')
.config(mapConfig);
mapConfig.$inject = ['uiGmapGoogleMapApiProvider'];
functionmapConfig(uiGmapGoogleMapApiProvider) {
uiGmapGoogleMapApiProvider.configure({
// key: 'your api key',
v: '3.20',
libraries: 'weather,geometry,visualization'
});
}
To 'use' es6 i think you mean classes. If you wanted to use a class, use the constructor.
mapConfig.$inject = ['uiGmapGoogleMapApiProvider'];
exportdefaultclassmapConfig {
constructor(uiGmapGoogleMapApiProvider) {
uiGmapGoogleMapApiProvider.configure({
// key: 'your api key',v: '3.20',
libraries: 'weather,geometry,visualization'
});
}
}
Post a Comment for "Angular Configure Es6 Syntax"