NSC*_*der 7 build gruntjs yeoman angular-ui-bootstrap
在我的yeoman应用程序上添加angular-ui-bootstrap和运行grunt服务后,它运行得很好,我想要显示的模态显示正确,但是一旦我做了一个grunt构建,我在控制台中得到一个未知的提供程序错误.
<!-- This is what I added in my index.html -->
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
// In app.js I have 
angular.module('yeomanApp', [
  'ngCookies',
  'ngResource',
  'ngSanitize',
  'ngRoute',
  'ui.bootstrap'
])
在控制器中
.controller('myCntrl', function ($modal) {
$scope.items = ['item1', 'item2', 'item3'];
$scope.showDeleteWarning = function () {
    var modalInstance = $modal.open({
        templateUrl: 'deleteWarning.html',
        controller: ModalInstanceCtrl,
        resolve: {
            items: function () {
              return $scope.items;
            }
          }
        });
    modalInstance.result.then(function (selectedItem) {
      $scope.selected = selectedItem;
    }, function () {});
  };
// Please note that $modalInstance represents a modal window (instance) dependency.
// It is not the same as the $modal service used above.
var ModalInstanceCtrl = function ($scope, $modalInstance, items) {
  $scope.items = items;
  $scope.selected = {
    item: $scope.items[0]
  };
  $scope.ok = function () {
    $modalInstance.close($scope.selected.item);
    deleteVent();
  };
  $scope.cancel = function () {
    $modalInstance.dismiss('cancel');
  };
};
};
小智 1
可能您需要注入控制器依赖项......
https://docs.angularjs.org/tutorial/step_05#a-note-on-minfication
.controller('myCntrl', ['$modal', function ($modal) {
    /* Controller Code Here... */
}]);
| 归档时间: | 
 | 
| 查看次数: | 3494 次 | 
| 最近记录: |