gpt4 book ai didi

javascript - uiSelect 未知提供者

转载 作者:行者123 更新时间:2023-11-30 10:08:12 25 4
gpt4 key购买 nike

您好,我正在尝试实现 uiSelect https://github.com/angular-ui/ui-select

但是当我添加模块时JS

angular.module('projects').controller('ProjectsCreateController', ['$scope', 'Projects', 'Notify', 'CustomersToId', 'Users', '$http', '$q', 'uiSelect',
function($scope, Projects, Notify,Customers, Users, $http, $q, uiSelect) {

HTML

                        <ui-select-match placeholder="Select person...">
{{customers.name}} &lt;{{customers._id}}&gt;
</ui-select-match>

我在 chrome 控制台中收到此错误

    Error: [$injector:unpr] Unknown provider: uiSelectProvider <- uiSelect
http://errors.angularjs.org/1.2.27/$injector/unpr?p0=uiSelectProvider%20%3C-%20uiSelect
at ...lib/angular/angular.js:78:12
at .../lib/angular/angular.js:3801:19
at Object.getService [as get] (.../lib/angular/angular.js:3929:39)
at .../lib/angular/angular.js:3806:45
at getService (.../lib/angular/angular.js:3929:39)
at invoke (.../lib/angular/angular.js:3956:13)
at Object.instantiate (.../lib/angular/angular.js:3976:23)
at .../lib/angular/angular.js:7307:28
at .../lib/angular/angular.js:6696:34
at forEach (.../lib/angular/angular.js:332:20) <div class="modal-content" modal-transclude="">

最佳答案

您不需要将 uiSelect 注入(inject)到您的 Controller 中,因此请先将其删除。

angular.module('projects').controller('ProjectsCreateController', ['$scope', 'Projects', 'Notify', 'CustomersToId', 'Users', '$http', '$q', 
function($scope, Projects, Notify,Customers, Users, $http, $q) {

ui.select 需要在声明模块时添加到模块中。您还需要包含 ng-sanitize

var module = angular.module('projects', ['ui.select', 'ngSanitize']);

确保您还包括 ng-sanitize javascript 文件:

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.9/angular-sanitize.js"></script>

此信息可在 Getting Started documentation 中找到.

关于javascript - uiSelect 未知提供者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28020706/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com