I'm learning Angular@1.6.4, I try to do a routing with $routeParams.
(() => {
'use strict'
config.$inject = ['$routeProvider','$locationProvider', '$routeParams']
function config ($routeProvider, $locationProvider, $routeParams) {
$routeProvider
.when('/:category', {
template : `<star-wars-component category="'${$routeParams.category}'"></star-wars-component>`
})
.otherwise({
redirectTo : '/'
})
$locationProvider.html5Mode(true)
}
angular
.module('starWarsApp')
.config(config)
})()
It goes perfectly until I inject $routeParams
, then angular throw me this :
Error: $injector:unpr Unknown Provider Unknown provider: $routeParams
I tried to fix it but I don't really understand why angular throw that error if I inject $routeParams and I'm using ngRoute.