0

I am trying to use angular ui-bootstrap on my project. After adding the required script dependencies in my layout.cshtml, I get the following error;

Error: [$injector:unpr] http://errors.angularjs.org/1.4.8/$injector/unpr?p0=%24modalProvider%20%3C-%20%24modal%20%3C-%20app.views.teachersWorkSchdules.index
    at http://localhost:6634/Scripts/angular.min.js:6:416
    at http://localhost:6634/Scripts/angular.min.js:41:121
    at Object.d [as get] (http://localhost:6634/Scripts/angular.min.js:39:92)
    at http://localhost:6634/Scripts/angular.min.js:41:195
    at d (http://localhost:6634/Scripts/angular.min.js:39:92)
    at Object.e [as invoke] (http://localhost:6634/Scripts/angular.min.js:39:362)
    at M.instance (http://localhost:6634/Scripts/angular.min.js:80:336)
    at D (http://localhost:6634/Scripts/angular.min.js:61:362)
    at g (http://localhost:6634/Scripts/angular.min.js:55:105)
    at http://localhost:6634/Scripts/angular.min.js:54:249 <div ui-view="" class="shuffle-animation col-xs-12 ng-scope" data-ng-animate="1">

This is a part of the head section of the layout.cshtml;

<!-- SignalR scripts -->
    <script src="~/signalr/hubs"></script>
    @Html.IncludeScript("~/Abp/Framework/scripts/libs/abp.signalr.js")

    @Scripts.Render("~/Bundles/App/Main/js")

    <!-- UIGrid References -->
    @*<script src="~/Scripts/ui-grid.min.js"></script>*@
    @*<script type="text/javascript" src="~/Scripts/bootstrap-datetimepicker.min.js"></script>*@
    <script type="text/javascript" src="~/Scripts/angular.min.js"></script>
    <script type="text/javascript" src="~/Scripts/angular-animate.min.js"></script>
    <script type="text/javascript" src="~/Scripts/angular-sanitize.min.js"></script>
    <script type="text/javascript" src="~/Scripts/ui-bootstrap-tpls-2.4.0.min.js"></script>

Here is the controller in which I wanna use the ui-bootstrap;

(function () {
    angular.module('app').controller('app.views.workSchdules.createDialog', [
        '$scope', '$log', '$modalInstance', 'abp.services.app.workDay', 
        function ($scope, $log, $modalInstance, workDayService) {
            var vm = this;

            $scope.mytime = new Date();
            $scope.ismeridian = true;

            $scope.changed = function () {
                $log.log('Time changed to: ' + $scope.mytime);
            };

            vm.workDays = [];

            function getWorkDays() {
                workDayService.getAllWorkDaysList().success(function (data) {
                    vm.workDays = data.items;
                });
            }


        }
    ]);


})();

Please I don't know what I'm doing wrong. I've been on this for several hours. Please help.

9
  • Have you added 'ui.bootstrap' into the app module? Commented Jan 11, 2017 at 17:58
  • @AlonEitan where exactly do I add it to? Commented Jan 11, 2017 at 18:07
  • In the part of your code where you created the module: angular.module("app", ['ui.bootstrap', ......]); Commented Jan 11, 2017 at 18:08
  • @AlonEitan I did as you asked and got this new error; Error: [ng:areq] http://errors.angularjs.org/1.4.8/ng/areq?p0=app.views.layout&p1=not%20a%20function%2C%20got%20undefined at angular.js:38 at qb (angular.js:1815) at Qa (angular.js:1825) at angular.js:9158 at w (angular.js:8228) at D (angular.js:8270) at g (angular.js:7731) at g (angular.js:7734) at angular.js:7611 at angular.js:1681 Commented Jan 11, 2017 at 18:18
  • I'll give you a nice tip to debug it: Don't use the minified angular, instead of including ~/Scripts/angular.min.js, change it to ~/Scripts/angular.js - Then you'll see more detailed description of the error. When you figured it out you can change back to the minified file Commented Jan 11, 2017 at 18:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.