$injector:当我使用棱角分明的带子时,模块rr



我将显示我的所有代码:

<!doctype html>
<html lang="en" ng-app='myapp'>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="bootstrap/css/bootstrap-responsive.css">
</head>
<body ng-controller="myCtrl">
    <input type="text" ng-model="testforie">
    <h1>{{testforie}}</h1>
<button type="button" class="btn btn-lg btn-primary" data-placement="top-right" data-container="body" data-duration="3" bs-alert="alert">Click to toggle alert
  <br>
  <small>(using an object)</small>
</button>
    <div>
        <button  data-template="popoverTpl.html" bs-popover>angular strap popover</button>
    </div>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.9/angular.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.9/angular-route.min.js"></script>
    <script src="bower_components/angular-strap/dist/angular-strap.min.js"></script>
    <script src="bower_components/angular-strap/dist/angular-strap.tpl.min.js"></script>
    <script src="app.js"></script>
</body>
</html>

我的控制器:

angular.module('myapp',['ngAnimate', 'ngSanitize', 'mgcrea.ngStrap'])
.controller('myCtrl', ['$scope','$alert', function ($scope,$alert) {
    $scope.alert = {
      "title": "Holy guacamole!",
      "content": "Best check yo self, you're not looking too good.",
      "type": "info"
    };
     var myAlert = $alert({title: 'Holy guacamole!', content: 'Best check yo self, you're not looking too good.', placement: 'top', type: 'info', show: true});
}])

错误是:

未捕获的错误: [$injector:模块] http://errors.angularjs.org/1.2.9/$injector/modulerr?p0=myapp&p1=Error%3A%2...org%2F1.2.9%2F%24injector%2Fmodulerr%3Fp0%3DngAnimate%26p1%3DError%253A%25......5)

这是一个非常简单的演示,我只想开始使用角带,但总会出现一些错误,表明我错过了一些文件,这真的吓坏了我!

我的问题在哪里?如何启动我的角带应用程序?

您已在myapp模块中将ngSanitize定义为依赖项,但未在 HTML 中包含 angular-sanitize.min.js

添加<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.9/angular-sanitize.min.js"></script>,您应该没问题:)

最新更新