2013-06-26 35 views
1

這裏是我的html和角js代碼未捕獲的錯誤:沒有模塊:ui.bootstrap.alert在angular.min.js線17

<html ng-app="myApp"> 
<head> 
    <title>Angular App</title> 
    <link href="Styles/bootstrap.min.css" rel="stylesheet" type="text/css" /> 
    <script src="Scripts/angular.min.js" type="text/javascript"></script> 
    <script src="Scripts/ui-bootstrap-custom-0.4.0.js" type="text/javascript"></script> 
    <script src="Scripts/ui-bootstrap-custom-tpls-0.4.0.js" type="text/javascript"></script> 
    <script type="text/javascript" language="javascript"> 
     var myApp = angular.module('myApp', ['ui.bootstrap.alert']); 
     function AlertDemoCtrl($scope) { 
      $scope.alerts = [ 
    { type: 'error', msg: 'Oh snap! Change a few things up and try submitting again.' }, 
    { type: 'success', msg: 'Well done! You successfully read this important alert message.' } 
    ]; 

      $scope.addAlert = function() { 
       $scope.alerts.push({ msg: "Another alert!" }); 
      }; 

      $scope.closeAlert = function (index) { 
       $scope.alerts.splice(index, 1); 
      }; 

     } 
    </script> 
</head> 
<body> 

    <div ng-controller="AlertDemoCtrl"> 
     <alert ng-repeat="alert in alerts" type="alert.type" close="closeAlert($index)">{{alert.msg}}</alert> 
     <button class='btn' ng-click="addAlert()"> 
      Add Alert</button> 
    </div> 
</body> 
</html> 

角UI引導警報不工作,並在其控制檯投擲錯誤

Uncaught Error: No module: ui.bootstrap.alert in angular.min.js line 17 
+0

您的自定義UI文件中有什麼? – Sprottenwels

+0

這是從http://angular-ui.github.io/bootstrap/爲警報 – iJade

+0

建立的自定義引導ui構建我試圖注入ui.bootstrap而不是ui.bootstrap.alert – Sprottenwels

回答

0

同樣的問題......這是錯誤。 SCRIPT5022:無模塊:ui.bootstrap angular.min.js,行17字443

我其實對ui.bootstrap注入的依賴 - 沒有戒備狀態。 另一個有趣的觀察 - 這個問題只出現在IE瀏覽器(Chrome和Firefox非常高興)!

任何指針將是偉大的......

0

我有這個問題,真的是一個愚蠢的答案。我通過右鍵單擊並保存,下載了文件ui-bootstrap-tpls-0.5.0.js frmo github。這不起作用,而不是下載.js文件,它指向的html文件已下載。

確保你的用戶界面的自舉 - * js文件看起來像這裏的文件:。

https://github.com/angular-ui/bootstrap/blob/gh-pages/ui-bootstrap-tpls-0.5.0.js

你也應該確保你的用戶界面的自舉 - * JS是之前加載你app.js(或者你聲明你的角度模塊的地方)。

相關問題