I m currently trying to open an AngularUI Bootstrap Modal. Somehow, I keep getting the following error:
Error: [$injector:unpr] Unknown provider: appMainProvider <- appMain
I search online and found several "solution" but none of them seem to work (or perhaps i m doing something wrong). One of the solution i found is this one.
This is my main js controller
:
module.exports = function(appMain, name) {
appMain.controller(name, mainCtrl);
mainCtrl.$inject = ['$state', 'mainDataService', 'dnnVariables', '$uibModal'];
function mainCtrl($state, mainDataService, dnnVariables, $uibModal) {
var vm = this;
function fullAnswer() {
var source = require("../ViewAnswer/viewAnswer.html");
$uibModal.open({
templateUrl: source,
controller: require("../ViewAnswer/viewAnswer.controller.js"),
controllerAs: 'viewAnswerCtrl',
backdrop: 'static'
});
}
}
}
This opens the modal. The modal html is as following (barely anything for testing purpose)
something
The modal js controller
is as following:
module.exports = function (appMain, name) {
appMain.controller(name, viewAnswerCtrl);
viewAnswerCtrl.$inject = ['$state', 'mainDataService', 'dnnVariables', "$uibModalInstance"];
function viewAnswerCtrl($state, mainDataService, dnnVariables, $uibModalInstance) {
var vm = this;
}
}
Note: I'm using angular-ui-bootstrap 2.5
.