简体   繁体   中英

google angular module don't work

I add this to my proyect: https://angular-ui.github.io/angular-google-maps/#!/

i follow the suggestion and add this files to my proyect mvc in the BundleConfig (Downloaded by Nuget):

        bundles.Add(new ScriptBundle("~/bundles/map").Include(
                  "~/Scripts/lodash.min.js",
                  "~/Scripts/angular-google-maps-street-view.min.js",
                  "~/Scripts/angular-google-maps.min.js"));

in the app.js have this:

 (function () { "use strict"; angular .module('app', ['ngRoute', 'ngAnimate', 'ui.bootstrap', 'uiGmapgoogle-maps']).config(configRoute); configRoute.$inject = ['$routeProvider', '$locationProvider']; function configRoute($routeProvider, $locationProvider) { $routeProvider .when('/', { templateUrl: 'scripts/app/partials/Home.html', controller: 'productosPrincipalCtrl', controllerAs: 'vm' }) .when('/mapa', { templateUrl: 'scripts/app/partials/mapa.html' }) .when('/ofertas/:type', { templateUrl: 'scripts/app/partials/productos.html', controller: 'listProductsCtrl', controllerAs: 'vm' }) .when('/oferta-detalle/:type', { templateUrl: 'scripts/app/partials/producto-detalle.html', controller: 'productDetailCtrl', controllerAs: 'vm' }) .otherwise({ redirectTo: '/' }); $locationProvider.html5Mode(false); } })(); 

in the layout i load the scripts:

 <!DOCTYPE html> <html data-ng-app="app"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>@ViewBag.Title - Ofertas al Toque</title> @Styles.Render("~/Content/css") @*@Scripts.Render("~/bundles/modernizr")*@ <script src='//maps.googleapis.com/maps/api/js'></script> </head> <body> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a href="#/home" class="navbar-brand">MyPagina</a> . . . . </div> </div> </div> <div class="container body-content"> @RenderBody() <hr /> <footer> <p>&copy; @DateTime.Now.Year - My ASP.NET Application</p> </footer> </div> @Scripts.Render("~/bundles/angular") @Scripts.Render("~/bundles/bootstrap") @Scripts.Render("~/bundles/map") @RenderSection("scripts", required: false) </body> </html> 

and when run the app this throw a error and nothing load in the page, if i errase the 'uiGmapgoogle-maps' all works good, but i need the maps.

Note: I dont use map in the main page but i have the error too

the error throw angular is this: https://docs.angularjs.org/error/ $injector/modulerr?p0=app&p1=Error:%20%5B$injector:modulerr%5D%20http:%2F%2Ferrors.angularjs.org%2F1.4.8%2F$injector%2Fmodulerr%3Fp0%3DuiGmapgoogle-maps

if somebody can help me please.

Thanks in advance!

I needed add this scripts for don't throw more the error:

https://github.com/nmccready/angular-simple-logger

Note: Nuget don't download this automatically.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM