全新的Angular。我有一个控制器,当我将它添加到index.html页面上的脚本文件列表中时,我的站点停止工作,我得到所有视图的空白页面。我不确定自己做错了什么?我将控制器添加到我的index.html文件中,如此
<script src="app/components/common/ModalDemoCtrl.js"></script>
如果这是问题的一部分,我会在下面粘贴我的控制器代码。
var app = angular.module('crm.ma', ['ngAnimate', 'ui.bootstrap']);
app.controller('ModalDemoCtrl', function ($scope, $uibModal, $log) {
$scope.items = ['item1', 'item2', 'item3'];
$scope.animationsEnabled = true;
$scope.open = function (size) {
var modalInstance = $uibModal.open({
animation: $scope.animationsEnabled,
templateUrl: 'myModalContent.html',
controller: 'ModalInstanceCtrl',
size: size,
resolve: {
items: function () {
return $scope.items;
}
}
});
modalInstance.result.then(function (selectedItem) {
$scope.selected = selectedItem;
}, function () {
$log.info('Modal dismissed at: ' + new Date());
});
};
$scope.toggleAnimation = function () {
$scope.animationsEnabled = !$scope.animationsEnabled;
};
});
app.controller('ModalInstanceCtrl', function ($scope, $modalInstance, items) {
$scope.items = items;
$scope.selected = {
item: $scope.items[0]
};
$scope.ok = function () {
$modalInstance.close($scope.selected.item);
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
});
如果有人能帮助我,那就太棒了。提前谢谢。
答案 0 :(得分:1)
最近在$uibModal
版本0.14.0中引入了服务ui-bootstrap
。我猜你还在使用版本&lt;因此,ui-bootstrap
的0.14.0替换:
$uibModal
与
$modal
或将ui-bootstrap
更新为0.14 +