Reputation: 694
Hey I am working on a Angular page and as soon as I tried to accept data through the URL like this
app.config(function ($routeProvider, $locationProvider) {
$routeProvider.
when('/watch/:videoID', { // <-- Like this
templateUrl: 'partials/watchSingle',
controller: 'watchSingle'
}).
when('/', {
templateUrl: 'partials/index',
controller: 'mainPage'
}).
otherwise({
redirectTo: '/'
});
$locationProvider.html5Mode(true);
});
JS started throwing this error:
Error: Unknown provider: $routeProviderProvider <- $routeProvider
I searched the error and Stackoverflow told me to add ngRoute and ngSanitize as a Dependency. After adding that I got three new errors:
Error: Unknown provider: $sceProvider <- $sce <- $route <- ngViewDirective
Error: Circular dependency: ngViewDirective
Error: Circular dependency: ngViewDirective
I have the feeling that I am missing some more dependencies but I can not figure out which ones.
Info: ngRoute and ngSanitize are the only dependencies I have included.
Upvotes: 3
Views: 1801
Reputation: 102
Try this:
app.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
//code
$locationProvider.html5Mode(true); })
change your config with above.
and remove #
from the eg :<a href="/watch"></a>
in html view
Upvotes: 0