Angular UI-Bootstrap Injector Error

时间:2017-01-11 17:56:02

标签: javascript angularjs twitter-bootstrap angular-ui-bootstrap

我正在尝试在我的项目中使用角度ui-bootstrap。在layout.cshtml中添加所需的脚本依赖项后,出现以下错误;

using System;
using System.Configuration;
using System.IO;
using System.Linq;
using MyProejct.monitor.WmiEventMonitors;
using MyProject.core.interfaces;

namespace MyProject.monitor
{
    public interface IFileMonitorService : IDisposable
    {
        void Initialize();
    }

    public class FileMonitorService : IFileMonitorService
    {
        private bool _disposed;

        private readonly IEventListenerManager _eventListenerManager;
        private readonly IFileMonitorEventRegistrar _eventRegistrar;
        private readonly IFileProcessService _fileProcessService;
        private string _parentDirectory;

        public FileMonitorService(IFileMonitorEventRegistrar eventRegistrar, IFileProcessService fileProcessService)
        {
            _eventRegistrar = eventRegistrar;
            _fileProcessService = fileProcessService;
            _eventListenerManager = new EventListenerManager(_eventRegistrar);
        }


        public void Initialize()
        {
            if (string.IsNullOrEmpty(_parentDirectory))
                _parentDirectory = ConfigurationManager.AppSettings["SFTPDirectory"].Trim();

            if (!_eventListenerManager.RegisteredEvents.Any())
            {
                GenerateFileEventListeners();
                GenerateParentFolderListener();
            }
        }

        public void GenerateFileEventListeners()
        {
            if (!Directory.Exists(_parentDirectory))
                return;

            var foldersToMonitor = Directory.EnumerateDirectories(_parentDirectory);

            foreach (var folderPath in foldersToMonitor)
            {
                // Create a listener
                var fileMonitor = new FileMonitor(folderPath, _fileProcessService);
                _eventListenerManager.Add(fileMonitor);
            }
        }

        public void GenerateParentFolderListener()
        {
            var folderMonitor = new FolderMonitor(_parentDirectory, _eventListenerManager, _fileProcessService);
            _eventListenerManager.Add(folderMonitor);
        }

        public virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    _eventListenerManager.Dispose();
                    _parentDirectory = null;
                }

                _disposed = true;
            }
        }

        public void Dispose()
        {
            Dispose(true);
        }
    }
}

这是layout.cshtml;

的head部分的一部分
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">

这是我想使用ui-bootstrap的控制器;

<!-- 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>

请不要知道我做错了什么。我已经在这几个小时了。请帮忙。

0 个答案:

没有答案