AngularJS .bootstrap() y Módulos

I'm having a problem, I need to load a module in the angular.boostrap and not before it but angular keeps loading it before I tell to load it.

Here I call the angular.boostrap method, this function is called as a callback of GMaps api so I know this is working because of the console.log

function onGoogleReady() {
  console.log("GMaps api initialized.");
  angular.bootstrap(document.getElementById('map', ['']));

and this is my module:

angular.module('myAppModule', [''])
.controller('CtrlGMap', ['$scope', function($scope) {
    $scope.mapOptions = {
        center: new google.maps.LatLng(35.500, -78.500),
        zoom: 11,
        mapTypeId: google.maps.MapTypeId.ROADMAP

and finally my app HTML

<html ng-app="myAppModule">

<section id="map">
    <div ui-map="myMap" ui-options="mapOptions" class="map-canvas"></div>

preguntado el 12 de septiembre de 13 a las 00:09

1 Respuestas

Programas de ng-app directive bootstraps your application. If you want to bootstrap it manually, you should not use ng-app. angular.bootstrap also takes the raíz module to bootstrap; in this case, this is your myAppModule module (which already depends on debido a la angular.module definition). Thus, your code would look more like the following:

function onGoogleReady() {
  console.log("GMaps api initialized.");
  var body = document.getElementsByTagName('body')[0];
  angular.bootstrap(body, ['myAppModule'])

Respondido el 12 de Septiembre de 13 a las 00:09

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.