我无法使用 bootstrap $uibModal is undefined
I couldn't using bootstrap $uibModal is undefined
我正在尝试使用 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>
这是我的控制器
'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)
^^^^
删除
angular.module('ui.bootstrap',[])
这一行表示"create module ui.bootstrap
"。空模块。实际上你覆盖了 ui.bootstrap
模块。
你不应该创建 ui.bootstrap 模块,因为这是由 angular ui bootstrap.
提供的
angular.module('ui.bootstrap',[])
删除上面一行代码。
我正在尝试使用 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>
这是我的控制器
'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)
^^^^
删除
angular.module('ui.bootstrap',[])
这一行表示"create module ui.bootstrap
"。空模块。实际上你覆盖了 ui.bootstrap
模块。
你不应该创建 ui.bootstrap 模块,因为这是由 angular ui bootstrap.
提供的angular.module('ui.bootstrap',[])
删除上面一行代码。