404使用UI-Bootstrap和Plunker

时间:2014-09-02 13:42:18

标签: angularjs angular-ui plunker

我的plunker

中有以下内容
<!DOCTYPE html>
<html ng-app="plunker">

<head>
  <meta charset="utf-8" />
  <title>AngularJS Plunker</title>
  <script>
    document.write('<base href="' + document.location + '" />');
  </script>
  <link rel="stylesheet" href="style.css" />
  <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/angular-ui/0.4.0/angular-ui.css" />
  <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" />
  <script data-require="angular.js@1.2.x" src="https://code.angularjs.org/1.2.22/angular.js" data-semver="1.2.22"></script>
  <script src="//code.jquery.com/jquery-2.1.1.js"></script>
  <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui/0.4.0/angular-ui.js"></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.10.0/ui-bootstrap-tpls.js"></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.10.0/ui-bootstrap.js"></script>
  <script src="app.js"></script>
</head>

<body ng-controller="MainCtrl">
  <p>Hello {{name}}!</p>
  <accordion close-others="false">
    <accordion-group heading="Company" ng-click="toggleOpen()">
      <div class="row" data-ng-repeat="item in companyValues">
        <div class="col-xs-6">

          <input name="companyFilter" type="radio" value="{{item.value}}" id="{{item.name}}-filter-radio" ng-model="userData.companyFilter" ng-change="saveUserPreferences()" />
        </div>
        <div class="col-xs-6 pull-text-left">{{item.name}}</div>
    </accordion-group>
  </accordion>
</body>

</html>

然而,当我尝试跑步时,我在模板/ accordion / accordion-group.html上获得了404。有什么想法吗?

2 个答案:

答案 0 :(得分:3)

您的标记会加载两个不同版本的ui.bootstrap

  1. 包含Angular.js中预先加载的组件模板的版本&#39; $templateCache服务。
  2. 如果您想要调整控件外观,则没有预加载模板的版本。
  3. 由于第2版加载了第2版,似乎所有预加载的模板都不可用。

    解决方案:删除该行:

    <script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.10.0/ui-bootstrap.js"></script>
    

    示例:http://plnkr.co/edit/JyNu2hggAFt33hTvfoXo?p=preview

答案 1 :(得分:2)

使用angular.ui时,还必须在依赖项中包含angular.ui.tpls,如下所示:

var app = angular.module('myApp', ['ui.bootstrap', 'ui.bootstrap.tpls']);