Angularjs Error: [$location:nobase] -


y try create simple web angular project asp.net mvc 5 have js

var app = angular.module("app", ["ngroute"])     .config(function ($routeprovider, $locationprovider) {         $routeprovider.when('/', {             templateurl: '/angularjs/templates/inicio.html',             controller: 'bienvenidocontroller'         });         $locationprovider.html5mode(true);     }); 

and this:

app.controller("bienvenidocontroller", function ($scope) {  }); 

view: layout:

<!doctype html> <html> <head>     <meta charset="utf-8" />     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <title>@viewbag.title - asp.net application</title> </head> <body ng-app="app">     @renderbody()     <!--librerias angular-->     <script src="~/scripts/angular.min.js"></script>     <script src="~/scripts/angular-route.min.js"></script>      <!---librerias app-->     <script src="~/angularjs/registrationmodule.js"></script>     <script src="~/angularjs/bienvenidocontroller.js"></script> </body> </html> 

index:

<div ng-view>  </div> 

and:

<h1>hola mundo!</h1> 

error:

error: [$location:nobase]

error see in firebug mozilla

as stated on angularjs documentation

if configure $location use html5mode (history.pushstate), need specify base url application tag or configure $locationprovider not require base tag passing definition object requirebase:false $locationprovider.html5mode()

https://docs.angularjs.org/error/$location/nobase

you missing <base href="/"> in document or can disable check setting

$locationprovider.html5mode({   enabled: true,   requirebase: false }); 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -