我正在尝试旁边菜单的示例。我在我的例子中使用旁边菜单时收到错误。
我为此编写了代码,如果我编写多个控制器并注入$aside
,我收到错误$uibModalProvider <- $uibModal <- $aside
,我在下面添加了代码。
<!DOCTYPE html>
<html ng-app="asideApp">
<head>
<link data-require="bootstrap-css@3.2.0" data-semver="3.2.0" rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" />
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" />
<link rel="stylesheet" href="https://rawgit.com/dbtek/angular-aside/master/dist/css/angular-aside.css" />
<link rel="stylesheet" href="style.css" />
<script src="https://code.angularjs.org/1.2.21/angular.js"></script>
<script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.14.3.min.js"></script>
<script src="https://rawgit.com/dbtek/angular-aside/master/dist/js/angular-aside.js"></script>
<script src="script.js"></script>
</head>
<body ng-controller="MainCtrl">
<div class="jumbotron">
<h1>Angular Aside</h1>
<p>
<button type="button" class="btn btn-default btn-lg" ng-click="openAside('left', true)">
<span class="glyphicon glyphicon-align-justify"></span> Left
</button>
<a href="https://github.com/dbtek/angular-aside" class="btn btn-primary btn-lg"><span class="glyphicon glyphicon-download"></span> Download</a>
<button type="button" class="btn btn-default btn-lg pull-right" ng-click="openAside('right')">
Menu <span class="glyphicon glyphicon-align-justify"></span>
</button>
</p>
</div>
</body>
</html>
<div class="modal-header">
<h3 class="modal-title">ngAside</h3>
</div>
<div class="modal-body">
Look i'm in aside.
</div>
<div class="modal-footer">
<button class="btn btn-primary">OK</button>
<button class="btn btn-warning">Cancel</button>
</div>
angular.module('asideApp', ['ui.bootstrap', 'ngAside'])
.controller('MainCtrl', function($scope, $aside) {
var asideInstance = $scope.openAside = function openAside(position) {
$aside.open({
placement: position,
templateUrl: 'aside.html',
size: 'lg'
});
};
});
我的问题是,如果我写了多个控制器,htmls和我注入$aside
,我收到以下错误:
Error: [$injector:unpr] Unknown provider: $uibModalProvider <-
$uibModal <- $aside
http://errors.angularjs.org/1.4.1/$injector/unpr?p0=%24uibModalProvider%20%3C-%20%24uibModal%20%3C-%20%24aside
at angular.js:68
at angular.js:4255
at Object.getService [as get] (angular.js:4402)
at angular.js:4260
at getService (angular.js:4402)
at Object.invoke (angular.js:4434)
at Object.enforcedReturnValue [as $get] (angular.js:4296)
at Object.invoke (angular.js:4443)
at angular.js:4261
at getService (angular.js:4402)
可能是什么问题?
答案 0 :(得分:0)
我认为您当前的角度版本不支持 ngAside
指令。请将您的版本更改为稳定版本。我之前遇到过同样的问题。