嘿,我正在做一个有角度的页面,当我试图通过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是我所包含的唯一依赖项。
发布于 2014-04-24 10:53:09
试试这个:
app.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
//code$locationProvider.html5Mode(true);}
用上面的配置来改变你的配置。并将#从html视图中的例如:<a href="/watch"></a>中删除。
https://stackoverflow.com/questions/21317715
复制相似问题