0

テーブル上で行が選択されたときにモーダルテンプレートを表示しようとしています。ブートストラップアングルモーダルテンプレートが正しく表示されない

私が抱えている問題は、行をクリックすると、約2pxの厚さの黒い影のついた線が現れることです。それは私が推測しているモーダルであるはずですが、モーダルは実際には完全にその内容ではありません。

私は間違っていますか?

HTMLインデックスのためのコード:モーダルテンプレートの

<!DOCTYPE html> 
<html> 
    <head> 
     <script src="angular.js"></script> 
     <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> 
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script> 
     <script src="ui-bootstrap-tpls-1.3.3.js"></script> 
     <script src="index.js"></script> 
     <link rel="stylesheet" href="site.css"> 
    </head> 
    <body> 
     <div class="containter"> 
      <div class="jumbotron"> 
       <h1>JSON to Table</h1> 
      </div> 
      <div ng-app="myTable" ng-controller="tableCtrl"> 
       <div id="table1Div" style="background:white;position absolute;"> 
        <table class="table table-hover table-bordered" id="peopleTable"> 
         <tr> 
          <th>First Name</th> 
          <th>Last Name</th> 
          <th>Age</th> 
          <th>Nickname</th> 
         </tr> 
         <tr ng-repeat="person in people" ng-click="changeRowData(person)"> 
          <td> 
           {{person.FirstName}} 
          </td> 
          <td> 
           {{person.LastName}} 
          </td> 
          <td> 
           {{person.Age}} 
          </td> 
          <td> 
           {{person.Nickname}} 
          </td> 
         </tr> 
        </table> 
       </div> 
       <div class="centered"> 
        <button type="button" class="btn btn-primary" data-ng-click="addEntry()">Add New Entry</button> 
       </div> 
       <div id="searchFirstName"> 
        <div class="panel panel-primary"> 
         <div class="panel-heading">Change Table Background Colour: </div> 
         <div class="panel-body"> 
          <div id"buttonAndColours"> 
           <button class="btn btn-primary" id="tableBackgroundButton" style="float: right">Change</button> 
           <div class="colours" style="background-color:red;"></div> 
           <div class="colours" style="background-color:yellow;"></div> 
           <div class="colours" style="background-color:lightBlue;"></div> 
           <div class="colours" style="background-color:green;"></div> 
           <div class="colours" style="background-color:white;"></div> 
          </div> 
         </div> 
        </div> 
        <div class="panel panel-info"> 
         <div class="panel-heading">Search For First Name in Table:</div> 
         <div class="panel-body"> 
          <p>Search: <input type="text" ng-model="searchText"/> First Name being searched for: <u><b>{{searchText}}</u></b></p> 
          <br/> 
          <table class="table table-condensed"> 
           <tr> 
            <th>First Names to be Searched For:</th> 
           </tr> 
           <tr ng-repeat="person in people | filter:searchText"> 
            <td>{{ person.FirstName }}</td> 
           </tr> 
          </table> 
         </div> 
        </div> 

       </div> 
      </div> 
     </div> 
    </div> 
</body> 
</html> 

コード:

<div class="modal fade" role="dialog"> 
    <div class="modal-dialog"> 
     <div class="modal-content"> 
      <div class="modal-header"> 
       <button type="button" class="close" data-dismiss="modal">&times;</button> 
       <h4 class="modal-title">Row Data</h4> 
      </div> 
      <div class="modal-body" name="modalData"> 
       <form class="form-horizontal form-width" role="form"> 
        <div class="form-group"> 
         <label class="control-label col-sm-4" for="firstname">First Name:</label> 
         <div class="col-sm-8"> 
          <input type="text" class="form-control" id="firstN" ng-bind="FirstName"> 
         </div> 
        </div> 
        <div class="form-group"> 
         <label class="control-label col-sm-4" for="lastname">Last Name:</label> 
         <div class="col-sm-8"> 
          <input type="text" class="form-control" id="lastN" ng-bind="LastName"> 
         </div> 
        </div> 
        <div class="form-group"> 
         <label class="control-label col-sm-4" for="age">Age:</label> 
         <div class="col-sm-8"> 
          <input type="text" class="form-control" id="ageN" ng-bind="Age"> 
         </div> 
        </div> 
        <div class="form-group"> 
         <label class="control-label col-sm-4" for="nickname">Nickname:</label> 
         <div class="col-sm-8"> 
          <input type="text" class="form-control" id="nickN" ng-bind="Nickname"> 
         </div> 
        </div> 
       </form> 
      </div> 
      <div class="modal-footer"> 
       <button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button> 
       <button type="submit" class="btn btn-success" data-dismiss="modal">Submit</button> 
      </div> 
     </div> 
    </div> 
</div> 

コードのJavascriptファイル用:

var myTable = angular.module('myTable', ['ui.bootstrap']); 

myTable.controller('tableCtrl', function($scope, $http, $uibModal) { 

$http.get("xxxxxxxxx.json").success(function(response){ 
    $scope.people = response.People; 
}); 

$scope.changeRowData = function(changeableData) { 
    var modalTemplateInstance = $uibModal.open({ 
     templateUrl: 'modalTemplate.html', 
     controller: function($scope) { 

     } 
    }); 
} 

}); 
+0

angular.jsはAngularJsウェブサイトからの標準angularjsファイルです。 (angularjsファイル、削除されたコメントを含めないように頼んだ人への返信で):) – Imdad

答えて

0

いいえ、解決策だけを見つけました。 :)

モーダルテンプレートは、モーダルをHTMLページにハードコーディングするときに必要とされるモードのタグの一部が必要ないことを意味することを認識しました。

はReditedにmodalTemplateファイル:

<div class="modal-header"> 
    <button type="button" class="close" data-dismiss="modal">&times;</button> 
    <h4 class="modal-title">Row Data</h4> 
</div> 
<div class="modal-body" name="modalData"> 
    <form class="form-horizontal form-width" role="form"> 
     <div class="form-group"> 
      <label class="control-label col-sm-4" for="firstname">First Name:</label> 
      <div class="col-sm-8"> 
       <input type="text" class="form-control" id="firstN" ng-bind="FirstName"> 
      </div> 
     </div> 
     <div class="form-group"> 
      <label class="control-label col-sm-4" for="lastname">Last Name:</label> 
      <div class="col-sm-8"> 
       <input type="text" class="form-control" id="lastN" ng-bind="LastName"> 
      </div> 
     </div> 
     <div class="form-group"> 
      <label class="control-label col-sm-4" for="age">Age:</label> 
      <div class="col-sm-8"> 
       <input type="text" class="form-control" id="ageN" ng-bind="Age"> 
      </div> 
     </div> 
     <div class="form-group"> 
      <label class="control-label col-sm-4" for="nickname">Nickname:</label> 
      <div class="col-sm-8"> 
       <input type="text" class="form-control" id="nickN" ng-bind="Nickname"> 
      </div> 
     </div> 
    </form> 
</div> 
<div class="modal-footer"> 
    <button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button> 
    <button type="submit" class="btn btn-success" data-dismiss="modal">Submit</button> 
</div> 
0

は、ブラウザのコンソール出力は、何らかのエラー(F12キーを押していまたは右クリックして[要素の検査]を選択し、コンソールにナビゲートします)。

また、ブラウザの開発ツールで、ネットワークペインを開いて録画していることを確認します。その後、モーダルを起動すると、モーダルテンプレートファイルが正常に読み込まれますか?

+0

エラーはなく、2つの異なるブラウザ、chromeとedgeを試しました。 また、テンプレートのURLとしてindex.htmlを入れてみると、それは動作し、モーダルとして表示されます。しかし、実際のmodalTemplate.htmlは表示されません。 :/はい、デベロッパーツールに従ってモーダルテンプレートファイルをロードします。 :) – Imdad

+0

奇妙な、よくチェックのためにありがとう。私はあなたのコードを実行していると私はあなたが記述したものを参照してください。それはあなたのテンプレートの書式に見えますが、私は何かを見ることができるか見てみましょう – andrewkodesgood

+0

Nvmはあなたがそれを持っているように見える – andrewkodesgood

関連する問題