gpt4 book ai didi

angularjs - 我无法使用 bootstrap $uibModal 未定义

转载 作者:行者123 更新时间:2023-12-02 23:20:22 25 4
gpt4 key购买 nike

我正在尝试使用 Bootstrap ,但我不能这是我的 app.js

我想在我的用户模块中使用 bootstrap

  angular.module('Authentication', []);
angular.module('Home', []);
angular.module('menuBar',[])
angular.module('register',[])
angular.module('register',[])
angular.module('UserValidation',[])
angular.module('users',['ui.bootstrap'])
angular.module('smart-table',[])
angular.module('ui.bootstrap',[])

angular.module('mb', [
'Authentication',
'Home',
'ngRoute',
'ngCookies',
'menuBar',
'register',
'UserValidation',
'users',
'smart-table',
'ui.bootstrap'
])

我在index.jsp中添加了js文件

 <script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.14.1.js"></script>

这是我的 Controller

      'use strict';
angular.module('users').controller('usersListController', ['userService', function (service, $uibModal) {

var ctrl = this;

this.displayed = [];
// filter for user type
this.obj1={userType: '0'};
this.obj2={userType: '1'};
this.obj3={userType: '2'};

this.isShown = function(type) {
return type === this.filterOption;
};

this.filterOption;


this.openUser = function (row) {

var modalInstance = $uibModal.open({
animation: $scope.animationsEnabled,
templateUrl: 'js/users/user-modal.jsp',
controller: 'MonitoringModalController',


);
};

但是当我运行它时,我收到此错误:

angular.js:12520 TypeError: Cannot read property 'open' of undefined

最佳答案

您在内联注释中忘记了$uibModal

['userService', '$uibModal', function (service, $uibModal)
^^^^

关于angularjs - 我无法使用 bootstrap $uibModal 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38330938/

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