Ich versuche $ uibModal in mein Projekt zu injizieren, aber wenn die Steuerung geladen wird, ich die folgende Fehlermeldung erhalten:
Error: [$injector:unpr] Unknown provider: $uibModalProvider <- $uibModal <- abilityListController
I NuGet für mein Paket-Management-bin mit.
AngularJS: 1.4.8
Bootstrap: 3.3.6
Angular-Ui-Bootstrap: 0.14.3
Hier ist der relevante Code:
Index.HTML
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<link href="Content/bootstrap.css" rel="stylesheet" />
<script src="scripts/angular.js"></script>
<script src="scripts/angular-ui/ui-bootstrap.js"></script>
<script src="app/app.js"></script>
<script src="app/homeController.js"></script>
<script src="app/abilityList/abilityListController.js"></script>
</head>
<body>
<div ng-app="tecApp">
<div ng-controller="homeController as vm">
</div>
<div ng-controller="abilityListController as vm" ng-if="true">
<div ng-include="'app/abilityList/abilityList.html'"></div>
</div>
</div>
</div>
</body>
</html>
app.js:
angular.module("tecApp", []);
AbilityListController.js:
angular
.module('tecApp')
.controller('abilityListController', AbilityListController);
AbilityListController.$inject = ['$uibModal'];
function AbilityListController($uibModal) {
var vm = {};
return vm;
}
Ich glaube, ich bin falsch Injektion, aber es könnte mit dem zu tun hat, wie ich meine Quelldateien enthalten habe.
Ich bekomme keine Konsolenfehler abgesehen von dem oben genannten.
Ich bevorzuge diese Syntax für meinen eckigen Code, also hoffe ich auf eine Korrektur zu meinem Code statt ('controllername', ['$ stuff', 'moreStuff']).
Vielen Dank im Voraus für jede Hilfe.
Danke! Zuletzt habe ich gehört, $ modal wird von ui-bootstrap abgelehnt und sie bevorzugen die Verwendung von $ uibModal. Ich bin sicher, dass es einige Unterschiede gibt, aber sie scheinen identisch zu funktionieren. – KoalaFanatic
ja, definitiv – Andrew
Das löste mein Problem. Ich benutze angular 1.4.9 und angular-ui-bootstrap 1.3.2 und auf der offiziellen Seite (https: //angular-ui.github.io/bootstrap /) Sie schreiben, dass Sie $ uibModal verwenden müssen, aber das hat nicht für mich funktioniert. – bonbon