Error :
Unknown Provider : $locationProviderProvider <- $locationProvider <- myCtrl
also got this error.
You're allowed to inject a $location into a controller, but not a $locationProvider.
Instead, the $locationProvider can be injected into a config method:
Solution :
And since I made this additional mistake: it's not just that you should add an app.config bit, but also remember to remove $locationProvider from the controller arguments, or you'll keep getting this error.
Also you have to add <base> tag in your html file <head> tag
Unknown Provider : $locationProviderProvider <- $locationProvider <- myCtrl
also got this error.
You're allowed to inject a $location into a controller, but not a $locationProvider.
Instead, the $locationProvider can be injected into a config method:
Solution :
var app = angular.module("myApp", []); app.config(function($locationProvider) { $locationProvider.html5Mode(true); }); app.controller("myCtrl", function($location) { $location.path("/some/path"); });
And since I made this additional mistake: it's not just that you should add an app.config bit, but also remember to remove $locationProvider from the controller arguments, or you'll keep getting this error.
Also you have to add <base> tag in your html file <head> tag
<base href="/myDemoProject/">
No comments:
Post a Comment