angularjs – 角表行指令不在表内渲染

前端之家收集整理的这篇文章主要介绍了angularjs – 角表行指令不在表内渲染前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图添加一行“isrcrow”指令到表如下:
<table class="table">
        <thead><tr>
                   <th>Artist Name</th>
                   <th>Track Title</th>
                   <th>Version</th>
                   <th>Track Duration</th>
                   <th>Recording Year</th>
                   <th></th>
               </tr>
        </thead>
        <tbody>
            <isrcrow></isrcrow>
        </tbody>       

    </table>

这里是指令:

(function() {
  var isrcorderapp;

  isrcorderapp = angular.module("isrcorderapp",[]);

  isrcorderapp.controller("isrcordercontroller",function($scope,$http) {
    return $scope.recordingTypes = [
      {
        type: 'Single'
      },{
        type: 'Album'
      },{
        type: 'Live'
      },{
        type: 'Concert'
      },{
        type: 'Instrumental'
      }
    ];
  });

  isrcorderapp.directive("isrcrow",function() {
    return {
      restrict: 'E',template: '<tr>\
                <td><input id="artist" ng-model="name"/></td>\
                <td><input id="track"/></td>\
                <td><select id="isrctype" ng-model="isrctype" ng-change="setState(state)" ng-options="s.type for s in recordingTypes" class="ng-pristine ng-valid"></select></td>\
                <td><input id="duration"/></td>\
                <td><input id="year"/></td>\
                <td><input type="button" value="Add ISRC" onclick="AddIsrc()" class="btn btn-small btn-success" />\
                    <input type="button" value="Delete" onclick="RemoveIsrc()" class="btn btn-small btn-danger" />\
                </td>\
            </tr>',scope: {
        name: '='
      },link: function(scope,element,attr) {}
    };
  });

}).call(this);

我经历的问题是isrcrow指令不呈现在表体内。它在桌子外面和上面:

有谁知道什么可能导致这种行为?

添加我的评论摘要作为答案,因为它似乎已经帮助OP。 原文链接:https://www.f2er.com/angularjs/145631.html

猜你在找的Angularjs相关文章