依赖性问题Angular.js ngroute ngsanitize



嘿,我在一个角页上工作,并且一旦尝试通过像这样的URL接受数据

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开始丢弃此错误:

Error: Unknown provider: $routeProviderProvider <- $routeProvider 

我搜索了错误,Stackoverflow告诉我添加ngroute并将Ngsanitize作为依赖关系。在补充说我有三个新错误之后:

Error: Unknown provider: $sceProvider <- $sce <- $route <- ngViewDirective
Error: Circular dependency: ngViewDirective
Error: Circular dependency: ngViewDirective

我感觉自己缺少更多依赖性,但我无法弄清楚哪些依赖。

信息:ngroute和ngsanitize是我唯一包含的依赖项。

尝试以下:

app.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
//code

$ locationProvider.html5mode(true); })

用上述更改配置。并从html视图中的eg中删除 #<a href="/watch"></a>

最新更新