Node-Red仪表板模板UI-带有ng-repeat的AngularJS引导轮播

时间:2018-09-30 17:42:09

标签: angularjs angular-ui-bootstrap node-red

我一直在摸索用Node-Red Dashboard模板节点中的AngularJS创建Bootstrap Carousel。我什至在这里找到了几个技巧,但是提出的解决方案对我而言不起作用...这是Node-Red仪表板模板中的完整代码:(任何帮助都非常有用!)

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Spotify UI</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
</head>
<body>

<md-content>
    <md-tabs md-dynamic-height md-border-bottom>
        <md-tab md-on-select="send({getFeatured: true})" ng-click="send({getFeatured: true})">
            <md-tab-label><md-icon ng-md-icon icon="stars" style="fill: LIGHTGREEN"></md-icon></md-tab-label>
            <md-tab-body>
            <md-content>  

<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
  <div class="carousel-inner">
    <div class="item" ng-class="{active:!$index}" ng-repeat="item in featured track by $index">
      <img class="d-block w-100" src="{{item.images[0].url}}" alt="missing">
      <p>{{$index}}</p>
    </div>
  </div>
  <a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>

            </md-content>
      </md-tab-body>
      </md-tab>
    </md-tabs>
</md-content>

<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>

<script>
(function(scope) {
  scope.$watch('msg', function(msg) {
    if (msg.payload.playlists.items) {
      scope.featured = msg.payload.playlists.items;
    };
  });
})(scope);
</script>
</body>
</html>

更新01.10.2018-在将类从class="item"更改为class="carousel-item"之后,我终于设法使其正常工作。

0 个答案:

没有答案