0

私はモーダルブートストラップを持っており、コールの内側には角度が$httpとなっています。 ページをロードしてデータを取得するときだけ、キャッシュをキャッシュしないでください。 AngularJS 1.6 |ブートストラップ3.3

ブートストラップモードを開くたびに「http」を呼び出すことはできますか?以下は

var helloApp = angular.module('helloApp',[]); 
 

 
helloApp.controller("CompanyCtrl",['$scope',function($scope){ 
 

 
\t $scope.numbers = [1,2,3,4,5,6,7,8,9]; 
 
\t $scope.tableTitle = "SEMESTRE "; 
 
\t $scope.checked1 = false; //DELETE 
 

 
\t $scope.number = 7; 
 
\t $scope.getNumber = function(num) { 
 
\t  return new Array(num); 
 
\t } 
 

 
\t $scope.companies = [ 
 
        { 'name':'Infosys Technologies', 
 
        \t 'employees': 125000, 
 
        \t 'headoffice': 'Bangalore'}, 
 
        \t { 'name':'Cognizant Technologies', 
 
\t      \t 'employees': 100000, 
 
\t      \t 'headoffice': 'Bangalore'}, 
 
\t      \t { 'name':'Wipro', 
 
\t \t      \t 'employees': 115000, 
 
\t \t      \t 'headoffice': 'Bangalore'}, 
 
\t \t      \t { 'name':'Tata Consultancy Services (TCS)', 
 
\t \t \t      \t 'employees': 150000, 
 
\t \t \t      \t 'headoffice': 'Bangalore'}, 
 
\t \t \t      \t { 'name':'HCL Technologies', 
 
\t \t \t \t      \t 'employees': 90000, 
 
\t \t \t \t      \t 'headoffice': 'Noida'}, 
 
        ]; 
 
    $scope.vAddGroup = [ 
 

 
    ]; 
 

 
$scope.addGroup = function(name){ \t 
 
\t var index = -1; \t 
 
\t var comArr = eval($scope.companies); 
 
\t \t for(var i = 0; i < comArr.length; i++) { 
 
\t \t \t if(comArr[i].name === name) { 
 
\t \t \t \t index = i; 
 
\t \t \t \t break; 
 
\t \t \t } 
 
\t \t } 
 
\t \t if(index === -1) { 
 
\t \t \t alert("Something gone wrong"); 
 
\t \t } 
 

 
\t $scope.vAddGroup.push({ 'name':comArr[index].name, 'employees':comArr[index].employees, 'headoffice':comArr[index].headoffice }); 
 
\t $scope.checked1 = true; 
 

 
\t var d = document.getElementById("1"); // IDENTIFICADOR UNICO CADA MATERIA 
 
\t d.className = " subjectOK not-active"; 
 

 
}; 
 

 

 
$scope.addRow = function(){ \t \t 
 
\t $scope.companies.push({ 'name':$scope.name, 'employees': $scope.employees, 'headoffice':$scope.headoffice }); 
 
\t $scope.name=''; 
 
\t $scope.employees=''; 
 
\t $scope.headoffice=''; 
 
}; 
 

 
$scope.removeRow = function(name){ \t \t \t \t 
 
\t \t var index = -1; \t \t 
 
\t \t var comArr = eval($scope.vAddGroup); 
 
\t \t for(var i = 0; i < comArr.length; i++) { 
 
\t \t \t if(comArr[i].name === name) { 
 
\t \t \t \t index = i; 
 
\t \t \t \t break; 
 
\t \t \t } 
 
\t \t } 
 
\t \t if(index === -1) { 
 
\t \t \t alert("Something gone wrong"); 
 
\t \t } 
 
\t \t $scope.vAddGroup.splice(index, 1); \t 
 
\t \t $scope.checked1 = false; 
 

 
\t \t var d = document.getElementById("1"); // IDENTIFICADOR UNICO CADA MATERIA 
 
\t \t d.className = " subject"; 
 
\t }; 
 

 
}]); 
 

 

 

 
helloApp.controller('DataCtrl', function($scope, $http) { 
 
    $http.get("http://www.w3schools.com/angular/customers.php") 
 
    .then(function(response) { 
 
     $scope.content = response.data.records; 
 
    }, function(response) { 
 
     $scope.contentWrong = response.config; 
 
    }); 
 

 
}); 
 

 

 
function closeModal(){ 
 

 
\t $(".modalCloseID").on('hide.bs.modal', function() { 
 
\t }); 
 

 
\t console.log("TEST"); 
 

 
\t $('.modalCloseID').modal('hide'); 
 
}
.subject { 
 
    background-color: #4CAF50; /* Green */ 
 
    /* border: none; */ 
 
    border: 1px solid white; 
 
    border-radius: 4px; 
 
    color: white; 
 
    padding: 1px 25px; 
 
    text-align: center; 
 
    text-decoration: none; 
 
    display: inline-block; 
 
    font-size: 14px; 
 
    cursor: pointer; 
 
    cursor: hand; 
 
    line-height:20px; 
 
    -webkit-transition-duration: .4s; /* Safari */ 
 
    transition-duration: .4s; 
 

 
    -webkit-touch-callout: none; /* iOS Safari */ 
 
    -webkit-user-select: none; /* Chrome/Safari/Opera */ 
 
    -khtml-user-select: none; /* Konqueror */ 
 
     -moz-user-select: none; /* Firefox */ 
 
     -ms-user-select: none; /* Internet Explorer/Edge */ 
 
      user-select: none; /* Non-prefixed version, currently 
 
            not supported by any browser */ 
 

 
} 
 
.subject:hover { 
 
    background-color: #241E4E; 
 
    color: white; 
 
    border: 1px solid #555555; 
 
    box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19); 
 

 
} 
 
.subject:focus { 
 
outline:0px; 
 
} 
 

 
.subjectOK { 
 
\t background-color: white; 
 
    /* border: none; */ 
 
    border: 2px solid black; 
 
    border-radius: 30%; 
 
    color: black; 
 
    padding: 1px 25px; 
 
    text-align: center; 
 
    text-decoration: none; 
 
    display: inline-block; 
 
    font-size: 14px; 
 
    cursor:not-allowed; 
 
    line-height:20px; 
 
    -webkit-transition-duration: .4s; /* Safari */ 
 
    transition-duration: .4s; 
 

 

 
    -webkit-touch-callout: none; /* iOS Safari */ 
 
    -webkit-user-select: none; /* Chrome/Safari/Opera */ 
 
    -khtml-user-select: none; /* Konqueror */ 
 
     -moz-user-select: none; /* Firefox */ 
 
     -ms-user-select: none; /* Internet Explorer/Edge */ 
 
      user-select: none; /* Non-prefixed version, currently 
 
            not supported by any browser */ 
 

 
} 
 

 
.csstr { 
 
\t border: 0px solid black; 
 

 
} 
 

 

 
.csstitle { 
 
    border-left: 6px solid red; 
 
    background-color: lightgrey; 
 
} 
 

 
.not-active { 
 
    pointer-events: none; 
 
    cursor: default; 
 
}
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
 
<html ng-app="helloApp"> 
 
<head> 
 

 
\t <meta http-equiv="Expires" content="0"> 
 
\t <meta http-equiv="Last-Modified" content="0"> 
 
\t <meta http-equiv="Cache-Control" content="no-cache, mustrevalidate"> 
 
\t <meta http-equiv="Pragma" content="no-cache"> 
 

 

 
<title>AngularJS</title> 
 

 

 
\t \t <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script> 
 
\t \t <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> 
 
\t \t <link rel="stylesheet" href="main.css"> 
 
\t \t <script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.min.js"></script> 
 
\t \t <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> 
 
\t \t <script type="text/javascript" src="controllers.js"></script> 
 

 

 
\t \t \t 
 
</head> 
 
<!-- Controller name goes here --> 
 
<body ng-controller="CompanyCtrl"> 
 

 

 
\t <h2 class="csstitle">Seleccionar Materias</h2> 
 

 

 

 
\t <div class="table-responsive">   
 
\t <table class="table"> 
 
\t  <thead> 
 
\t  <tr> 
 
\t   <th ng-repeat="number in numbers" class="text-center">{{tableTitle}}{{number}}</th> 
 
\t  </tr> 
 
\t  </thead> 
 
\t  <tbody ng-app="helloApp" ng-controller="DataCtrl"> 
 
\t  <tr class="csstr" ng-repeat="item in content | limitTo: 7"> 
 

 
\t   <td> <!-- SEMESTRE #1 --> 
 
\t   \t <div id="{{numbers[0]}}" class="subject" data-toggle="modal" data-target="#myModal{{numbers[0]}}">{{content[$index].City}} <br/> descripcion <br/> + S1</div> 
 
\t   </td> 
 

 
\t   <td><!-- SEMESTRE #2 --> 
 
\t   \t <div class="subject" data-toggle="modal" data-target="#myModal{{numbers[1]}}">{{content[$index].City}} <br/> descripcion <br/> + S2</div> 
 
\t   </td> 
 

 
\t   <td><!-- SEMESTRE #3 --> 
 
\t  \t  <div class="subject" data-toggle="modal" data-target="#myModal{{numbers[2]}}">{{item.City}} <br/> descripcion <br/> + S3</div> \t 
 
\t   </td> 
 

 
\t   <td><!-- SEMESTRE #4 --> 
 
\t   \t <div class="subject" data-toggle="modal" data-target="#myModal{{numbers[3]}}">{{item.City}} <br/> descripcion <br/> + S4</div> \t 
 
\t   </td> 
 

 
\t   <td><!-- SEMESTRE #5 --> 
 
\t   \t <div class="subject" data-toggle="modal" data-target="#myModal{{numbers[4]}}">{{item.City}} <br/> descripcion <br/> + S5</div> \t 
 
\t   </td> 
 

 
\t   <td><!-- SEMESTRE #6 --> 
 
\t   \t <div class="subject" data-toggle="modal" data-target="#myModal{{numbers[5]}}">{{item.City}} <br/> descripcion <br/> + S6</div> \t 
 
\t   </td> 
 

 
\t   <td><!-- SEMESTRE #7 --> 
 
\t   \t <div class="subject" data-toggle="modal" data-target="#myModal{{numbers[6]}}">{{item.City}} <br/> descripcion <br/> + S7</div> \t 
 
\t   </td> 
 

 
\t   <td><!-- SEMESTRE #8 --> 
 
\t   \t <div class="subject" data-toggle="modal" data-target="#myModal{{numbers[7]}}">{{item.City}} <br/> descripcion <br/> + S8</div> \t 
 
\t   </td> 
 

 
\t   <td><!-- SEMESTRE #9 --> 
 
\t   \t <div class="subject" data-toggle="modal" data-target="#myModal{{numbers[8]}}">{{item.City}} <br/> descripcion <br/> + S9</div> \t 
 
\t   </td> 
 

 
\t  </tr> 
 

 
\t  </tbody> 
 
\t </table> 
 
    \t </div> 
 

 

 

 
<div ng-app="helloApp" ng-controller="DataCtrl" ng-repeat="item in numbers | limitTo: 9"> 
 
    <!-- Modal --> 
 
    <div class="modal fade modalCloseID" id="myModal{{item}}" role="dialog" data-backdrop="static"> 
 
    <div class="modal-dialog modal-lg"> 
 
     <div class="modal-content"> 
 
     <div class="modal-header"> 
 
      <button type="button" class="close" data-dismiss="modal">&times;</button> 
 
      <h4 class="modal-title">Materia # {{item}}</h4> 
 
     </div> 
 
     <div class="modal-body"> 
 
      <p>Seleccione un horario.</p> 
 

 
\t \t \t \t \t <label>Filtro</label> 
 
\t \t \t \t \t <input type="text" class="form-control" ng-model="searchKeyword"/> 
 

 
\t \t \t \t \t <div ng-app="helloApp" ng-controller="DataCtrl"> 
 
\t \t \t \t \t \t {{content}} 
 
\t \t \t \t \t \t {{contentWrong}} 
 
\t \t \t \t \t </div> 
 

 

 
\t \t \t \t \t <table class="table"> 
 
\t \t \t \t \t \t <tr> 
 
\t \t \t \t \t \t \t <th>Name 
 
\t \t \t \t \t \t \t </th> 
 
\t \t \t \t \t \t \t <th>Employees 
 
\t \t \t \t \t \t \t </th> 
 
\t \t \t \t \t \t \t <th>Head Office 
 
\t \t \t \t \t \t \t </th> 
 
\t \t \t \t \t \t \t <th>Acción 
 
\t \t \t \t \t \t \t </th> 
 
\t \t \t \t \t \t </tr> 
 
\t \t \t \t \t \t <tr ng-repeat="company in companies | filter: searchKeyword "> 
 
\t \t \t \t \t \t \t <td> 
 
\t \t \t \t \t \t \t \t {{company.name}} 
 
\t \t \t \t \t \t \t </td> 
 
\t \t \t \t \t \t \t <td> 
 
\t \t \t \t \t \t \t \t {{company.employees}} 
 
\t \t \t \t \t \t \t </td> 
 
\t \t \t \t \t \t \t <td> 
 
\t \t \t \t \t \t \t \t {{company.headoffice}} 
 
\t \t \t \t \t \t \t </td> 
 
\t \t \t \t \t \t \t <td> 
 
\t \t \t \t \t \t \t <input type="button" value="Agregar" class="btn btn-primary" onclick="closeModal()" ng-click="addGroup(company.name)" ng-disabled="checked{{item}}"/> 
 
\t \t \t \t \t \t \t </td> 
 
\t \t \t \t \t \t </tr> 
 
\t \t \t \t \t </table> 
 

 
\t \t \t \t </div> 
 
     \t \t <div class="modal-footer"> 
 
      <button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button> 
 
     </div> 
 
     </div> 
 
    </div> 
 
    </div> 
 
    \t <!-- END MODAL--> 
 
</div> 
 
    
 

 

 

 
\t <hr> 
 
\t <h2 class="csstitle">Materias seleccionadas</h2> 
 

 
\t <table class="table"> 
 
\t \t <tr> 
 
\t \t \t <th>Name 
 
\t \t \t </th> 
 
\t \t \t <th>Employees 
 
\t \t \t </th> 
 
\t \t \t <th>Head Office 
 
\t \t \t </th> 
 
\t \t \t <th>Acción 
 
\t \t \t </th> 
 
\t \t </tr> 
 
\t \t <tr ng-repeat="item in vAddGroup"> 
 
\t \t \t <td> 
 
\t \t \t \t {{item.name}} 
 
\t \t \t </td> 
 
\t \t \t <td> 
 
\t \t \t \t {{item.employees}} 
 
\t \t \t </td> 
 
\t \t \t <td> 
 
\t \t \t \t {{item.headoffice}} 
 
\t \t \t </td> 
 
\t \t \t <td> 
 
\t \t \t <input type="button" value="Eliminar" class="btn btn-danger" ng-click="removeRow(item.name)"/> 
 
\t \t \t </td> 
 
\t \t </tr> 
 
\t </table> 
 

 

 

 

 

 
</body> 
 
</html>

+0

はい、それは可能です。どのようにどこであなたの電話をしているのかを示してください。角度用途のキャッシュのいくつかを無効にすることはできますが、おそらくあなたの問題はキャッシュとほとんど関係ありません。 (Webアプリケーションでは非常に一般的な機能なので、通常はキャッシュ機能を無効にする必要はありませんので、$ httpコールが1回だけ行われる可能性が高くなります) – ippi

+0

ありがとうございます、私はコードを追加しました! –

+0

'$( '。modalCloseID')を呼び出していますか?modal( 'hide');'コントローラを破壊しますか?モーダルが表示されたらコントローラを破壊していないと思います。 –

答えて

0

答え「できるだけ小さな変化として、」簡単です: は、私はあなたのボタンをngのクリックを追加し、いずれかをクリックしたときに呼び出される関数の中であなたのhttp-コールを包みましたボタンの

長い(より正確な)答えが含まれます:

  • おそらく本当によく一緒にすべてのことを果たしていない角度とjQueryので、すべて一緒にあなたのプロジェクトからのjQueryをスクラップ。

  • ng-controller="DataCtrl" ng-repeat="item in numbers"このようにすると、「アイテム」ごとに1つのDataCtrlインスタンスが取得されます。通常は角度とモーダルを使用して、モーダルを1つしか表示せず、コンテンツを表示/非表示に変更します。 (あなたのアプリがとにかく小さい場合)

  • ボタンを使用して各列の番号をループすることで、DRY-ERを少し変えました。私はおそらくそれをさらに取って、 "件名ボタン"の指示文を作成します(ここのコードはすべてのボタンでほぼ同じです)。また、各行にもループします。

  • 多分UI Bootstrapを見てください。しかし時間の経過とともに、角度のあるモーダルの迅速な修正は、他のすべての依存関係をスキップして、ng-class="'show-modal':showModal"のようなものを使用するだけであることが分かります。ブートストラップスクリプト、データトグル、およびjqueryは、まっすぐな角度/ CSSで非常に単純なものにレイヤーを追加するだけです。

var helloApp = angular.module('helloApp',[]); 
 

 
helloApp.controller("CompanyCtrl",['$scope',function($scope){ 
 

 
\t $scope.numbers = [1,2,3,4,5,6,7,8,9]; 
 
\t $scope.tableTitle = "SEMESTRE "; 
 
\t $scope.checked1 = false; //DELETE 
 

 
\t $scope.number = 7; 
 
\t $scope.getNumber = function(num) { 
 
\t  return new Array(num); 
 
\t } 
 

 
\t $scope.companies = [ 
 
        { 'name':'Infosys Technologies', 
 
        \t 'employees': 125000, 
 
        \t 'headoffice': 'Bangalore'}, 
 
        \t { 'name':'Cognizant Technologies', 
 
\t      \t 'employees': 100000, 
 
\t      \t 'headoffice': 'Bangalore'}, 
 
\t      \t { 'name':'Wipro', 
 
\t \t      \t 'employees': 115000, 
 
\t \t      \t 'headoffice': 'Bangalore'}, 
 
\t \t      \t { 'name':'Tata Consultancy Services (TCS)', 
 
\t \t \t      \t 'employees': 150000, 
 
\t \t \t      \t 'headoffice': 'Bangalore'}, 
 
\t \t \t      \t { 'name':'HCL Technologies', 
 
\t \t \t \t      \t 'employees': 90000, 
 
\t \t \t \t      \t 'headoffice': 'Noida'}, 
 
        ]; 
 
    $scope.vAddGroup = [ 
 

 
    ]; 
 

 
$scope.addGroup = function(name){ \t 
 
\t var index = -1; \t 
 
\t var comArr = eval($scope.companies); 
 
\t \t for(var i = 0; i < comArr.length; i++) { 
 
\t \t \t if(comArr[i].name === name) { 
 
\t \t \t \t index = i; 
 
\t \t \t \t break; 
 
\t \t \t } 
 
\t \t } 
 
\t \t if(index === -1) { 
 
\t \t \t alert("Something gone wrong"); 
 
\t \t } 
 

 
\t $scope.vAddGroup.push({ 'name':comArr[index].name, 'employees':comArr[index].employees, 'headoffice':comArr[index].headoffice }); 
 
\t $scope.checked1 = true; 
 

 
\t var d = document.getElementById("1"); // IDENTIFICADOR UNICO CADA MATERIA 
 
\t d.className = " subjectOK not-active"; 
 

 
}; 
 

 

 
$scope.addRow = function(){ \t \t 
 
\t $scope.companies.push({ 'name':$scope.name, 'employees': $scope.employees, 'headoffice':$scope.headoffice }); 
 
\t $scope.name=''; 
 
\t $scope.employees=''; 
 
\t $scope.headoffice=''; 
 
}; 
 

 
$scope.removeRow = function(name){ \t \t \t \t 
 
\t \t var index = -1; \t \t 
 
\t \t var comArr = eval($scope.vAddGroup); 
 
\t \t for(var i = 0; i < comArr.length; i++) { 
 
\t \t \t if(comArr[i].name === name) { 
 
\t \t \t \t index = i; 
 
\t \t \t \t break; 
 
\t \t \t } 
 
\t \t } 
 
\t \t if(index === -1) { 
 
\t \t \t alert("Something gone wrong"); 
 
\t \t } 
 
\t \t $scope.vAddGroup.splice(index, 1); \t 
 
\t \t $scope.checked1 = false; 
 

 
\t \t var d = document.getElementById("1"); // IDENTIFICADOR UNICO CADA MATERIA 
 
\t \t d.className = " subject"; 
 
\t }; 
 

 
}]); 
 

 

 

 
helloApp.controller('DataCtrl', function($scope, $http) { 
 

 
    $scope.openModal = function(){ 
 
    $http.get("http://www.w3schools.com/angular/customers.php") 
 
    .then(function(response) { 
 
     $scope.content = response.data.records; 
 
    }, function(response) { 
 
     $scope.contentWrong = response.config; 
 
    }); 
 
    }; 
 
    
 
    $scope.openModal(); 
 
    
 
}); 
 

 
function closeModal(){ 
 

 
\t $(".modalCloseID").on('hide.bs.modal', function() { 
 
\t }); 
 

 
\t console.log("TEST"); 
 

 
\t $('.modalCloseID').modal('hide'); 
 
}
.subject { 
 
    background-color: #4CAF50; /* Green */ 
 
    /* border: none; */ 
 
    border: 1px solid white; 
 
    border-radius: 4px; 
 
    color: white; 
 
    padding: 1px 25px; 
 
    text-align: center; 
 
    text-decoration: none; 
 
    display: inline-block; 
 
    font-size: 14px; 
 
    cursor: pointer; 
 
    cursor: hand; 
 
    line-height:20px; 
 
    -webkit-transition-duration: .4s; /* Safari */ 
 
    transition-duration: .4s; 
 

 
    -webkit-touch-callout: none; /* iOS Safari */ 
 
    -webkit-user-select: none; /* Chrome/Safari/Opera */ 
 
    -khtml-user-select: none; /* Konqueror */ 
 
     -moz-user-select: none; /* Firefox */ 
 
     -ms-user-select: none; /* Internet Explorer/Edge */ 
 
      user-select: none; /* Non-prefixed version, currently 
 
            not supported by any browser */ 
 

 
} 
 
.subject:hover { 
 
    background-color: #241E4E; 
 
    color: white; 
 
    border: 1px solid #555555; 
 
    box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19); 
 

 
} 
 
.subject:focus { 
 
outline:0px; 
 
} 
 

 
.subjectOK { 
 
\t background-color: white; 
 
    /* border: none; */ 
 
    border: 2px solid black; 
 
    border-radius: 30%; 
 
    color: black; 
 
    padding: 1px 25px; 
 
    text-align: center; 
 
    text-decoration: none; 
 
    display: inline-block; 
 
    font-size: 14px; 
 
    cursor:not-allowed; 
 
    line-height:20px; 
 
    -webkit-transition-duration: .4s; /* Safari */ 
 
    transition-duration: .4s; 
 

 

 
    -webkit-touch-callout: none; /* iOS Safari */ 
 
    -webkit-user-select: none; /* Chrome/Safari/Opera */ 
 
    -khtml-user-select: none; /* Konqueror */ 
 
     -moz-user-select: none; /* Firefox */ 
 
     -ms-user-select: none; /* Internet Explorer/Edge */ 
 
      user-select: none; /* Non-prefixed version, currently 
 
            not supported by any browser */ 
 

 
} 
 

 
.csstr { 
 
\t border: 0px solid black; 
 

 
} 
 

 

 
.csstitle { 
 
    border-left: 6px solid red; 
 
    background-color: lightgrey; 
 
} 
 

 
.not-active { 
 
    pointer-events: none; 
 
    cursor: default; 
 
}
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
 
<html ng-app="helloApp"> 
 
<head> 
 

 
\t <meta http-equiv="Expires" content="0"> 
 
\t <meta http-equiv="Last-Modified" content="0"> 
 
\t <meta http-equiv="Cache-Control" content="no-cache, mustrevalidate"> 
 
\t <meta http-equiv="Pragma" content="no-cache"> 
 

 

 
<title>AngularJS</title> 
 

 

 
\t \t <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script> 
 
\t \t <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> 
 
\t \t <link rel="stylesheet" href="main.css"> 
 
\t \t <script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.min.js"></script> 
 
\t \t <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> 
 
\t \t <script type="text/javascript" src="controllers.js"></script> 
 

 

 
\t \t \t 
 
</head> 
 
<!-- Controller name goes here --> 
 
<body ng-controller="CompanyCtrl"> 
 

 

 
\t <h2 class="csstitle">Seleccionar Materias</h2> 
 

 

 

 
\t <div class="table-responsive">   
 
\t <table class="table"> 
 
\t  <thead> 
 
\t  <tr> 
 
\t   <th ng-repeat="number in numbers" class="text-center">{{tableTitle}}{{number}}</th> 
 
\t  </tr> 
 
\t  </thead> 
 
\t  <tbody ng-app="helloApp" ng-controller="DataCtrl"> 
 
\t  <tr class="csstr" ng-repeat="item in content | limitTo: 7"> 
 

 
\t   <td> <!-- SEMESTRE #1 --> 
 
\t   \t <div id="{{numbers[0]}}" class="subject" ng-click="openModal()" data-toggle="modal" data-target="#myModal{{numbers[0]}}">{{content[$index].City}} <br/> descripcion <br/> + S1</div> 
 
\t   </td> 
 

 
\t   <td><!-- SEMESTRE #2 --> 
 
\t   \t <div class="subject" ng-click="openModal()" data-toggle="modal" data-target="#myModal{{numbers[1]}}">{{content[$index].City}} <br/> descripcion <br/> + S2</div> 
 
\t   </td> 
 

 
\t   <td><!-- SEMESTRE #3 --> 
 
\t  \t  <div class="subject" ng-click="openModal()" data-toggle="modal" data-target="#myModal{{numbers[2]}}">{{item.City}} <br/> descripcion <br/> + S3</div> \t 
 
\t   </td> 
 

 
\t   <td><!-- SEMESTRE #4 --> 
 
\t   \t <div class="subject" ng-click="openModal()" data-toggle="modal" data-target="#myModal{{numbers[3]}}">{{item.City}} <br/> descripcion <br/> + S4</div> \t 
 
\t   </td> 
 

 
\t   <td><!-- SEMESTRE #5 --> 
 
\t   \t <div class="subject" ng-click="openModal()" data-toggle="modal" data-target="#myModal{{numbers[4]}}">{{item.City}} <br/> descripcion <br/> + S5</div> \t 
 
\t   </td> 
 

 
\t   <td><!-- SEMESTRE #6 --> 
 
\t   \t <div class="subject" ng-click="openModal()" data-toggle="modal" data-target="#myModal{{numbers[5]}}">{{item.City}} <br/> descripcion <br/> + S6</div> \t 
 
\t   </td> 
 

 
\t   <td><!-- SEMESTRE #7 --> 
 
\t   \t <div class="subject" ng-click="openModal()" data-toggle="modal" data-target="#myModal{{numbers[6]}}">{{item.City}} <br/> descripcion <br/> + S7</div> \t 
 
\t   </td> 
 

 
\t   <td><!-- SEMESTRE #8 --> 
 
\t   \t <div class="subject" ng-click="openModal()" data-toggle="modal" data-target="#myModal{{numbers[7]}}">{{item.City}} <br/> descripcion <br/> + S8</div> \t 
 
\t   </td> 
 

 
\t   <td><!-- SEMESTRE #9 --> 
 
\t   \t <div class="subject" ng-click="openModal()" data-toggle="modal" data-target="#myModal{{numbers[8]}}">{{item.City}} <br/> descripcion <br/> + S9</div> \t 
 
\t   </td> 
 

 
\t  </tr> 
 

 
\t  </tbody> 
 
\t </table> 
 
    \t </div> 
 

 

 

 
<div ng-app="helloApp" ng-controller="DataCtrl" ng-repeat="item in numbers | limitTo: 9"> 
 
    <!-- Modal --> 
 
    <div class="modal fade modalCloseID" id="myModal{{item}}" role="dialog" data-backdrop="static"> 
 
    <div class="modal-dialog modal-lg"> 
 
     <div class="modal-content"> 
 
     <div class="modal-header"> 
 
      <button type="button" class="close" data-dismiss="modal">&times;</button> 
 
      <h4 class="modal-title">Materia # {{item}}</h4> 
 
     </div> 
 
     <div class="modal-body"> 
 
      <p>Seleccione un horario.</p> 
 

 
\t \t \t \t \t <label>Filtro</label> 
 
\t \t \t \t \t <input type="text" class="form-control" ng-model="searchKeyword"/> 
 

 
\t \t \t \t \t <div ng-app="helloApp" ng-controller="DataCtrl"> 
 
\t \t \t \t \t \t {{content}} 
 
\t \t \t \t \t \t {{contentWrong}} 
 
\t \t \t \t \t </div> 
 

 

 
\t \t \t \t \t <table class="table"> 
 
\t \t \t \t \t \t <tr> 
 
\t \t \t \t \t \t \t <th>Name 
 
\t \t \t \t \t \t \t </th> 
 
\t \t \t \t \t \t \t <th>Employees 
 
\t \t \t \t \t \t \t </th> 
 
\t \t \t \t \t \t \t <th>Head Office 
 
\t \t \t \t \t \t \t </th> 
 
\t \t \t \t \t \t \t <th>Acción 
 
\t \t \t \t \t \t \t </th> 
 
\t \t \t \t \t \t </tr> 
 
\t \t \t \t \t \t <tr ng-repeat="company in companies | filter: searchKeyword "> 
 
\t \t \t \t \t \t \t <td> 
 
\t \t \t \t \t \t \t \t {{company.name}} 
 
\t \t \t \t \t \t \t </td> 
 
\t \t \t \t \t \t \t <td> 
 
\t \t \t \t \t \t \t \t {{company.employees}} 
 
\t \t \t \t \t \t \t </td> 
 
\t \t \t \t \t \t \t <td> 
 
\t \t \t \t \t \t \t \t {{company.headoffice}} 
 
\t \t \t \t \t \t \t </td> 
 
\t \t \t \t \t \t \t <td> 
 
\t \t \t \t \t \t \t <input type="button" value="Agregar" class="btn btn-primary" onclick="closeModal()" ng-click="addGroup(company.name)" ng-disabled="checked{{item}}"/> 
 
\t \t \t \t \t \t \t </td> 
 
\t \t \t \t \t \t </tr> 
 
\t \t \t \t \t </table> 
 

 
\t \t \t \t </div> 
 
     \t \t <div class="modal-footer"> 
 
      <button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button> 
 
     </div> 
 
     </div> 
 
    </div> 
 
    </div> 
 
    \t <!-- END MODAL--> 
 
</div> 
 
    
 

 

 

 
\t <hr> 
 
\t <h2 class="csstitle">Materias seleccionadas</h2> 
 

 
\t <table class="table"> 
 
\t \t <tr> 
 
\t \t \t <th>Name 
 
\t \t \t </th> 
 
\t \t \t <th>Employees 
 
\t \t \t </th> 
 
\t \t \t <th>Head Office 
 
\t \t \t </th> 
 
\t \t \t <th>Acción 
 
\t \t \t </th> 
 
\t \t </tr> 
 
\t \t <tr ng-repeat="item in vAddGroup"> 
 
\t \t \t <td> 
 
\t \t \t \t {{item.name}} 
 
\t \t \t </td> 
 
\t \t \t <td> 
 
\t \t \t \t {{item.employees}} 
 
\t \t \t </td> 
 
\t \t \t <td> 
 
\t \t \t \t {{item.headoffice}} 
 
\t \t \t </td> 
 
\t \t \t <td> 
 
\t \t \t <input type="button" value="Eliminar" class="btn btn-danger" ng-click="removeRow(item.name)"/> 
 
\t \t \t </td> 
 
\t \t </tr> 
 
\t </table> 
 

 

 

 

 

 
</body> 
 
</html>

関連する問題