【发布时间】:2014-02-22 18:43:20
【问题描述】:
我正在使用 Angular Maps UI,并已使用我的 API 密钥通过脚本加载从 Google API 成功将其加载回来,Google 正在正确调用我发送的回调函数。
'use strict';
angular.module('rszmeApp', [
'ngCookies',
'ngResource',
'ngSanitize',
'ngRoute',
'ui.map'
])
.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
controller: 'MainCtrl'
})
.otherwise({
redirectTo: '/'
});
});
function onGoogleReady() {
angular.bootstrap(document.getElementById("rszmeApp"), ['rszmeApp']);
}
但是,我想从 GoogleOnReady 函数在我的 Angular Scope 控制器中运行一个函数,但我不确定如何从该函数访问它。
编辑________
我这样传递回调:
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=mykey&sensor=false&callback=onGoogleReady&libraries=geometry,drawing "></script>
perhaps there is a way to pass the scoped function in there?
【问题讨论】:
标签: angularjs google-maps google-maps-api-3 angular-ui