Ich habe begonnen, Angular nur ein wenig Zeit zu studieren. Ich versuche mit TemplateURL ein Beispiel für eine Custome-Richtlinie zu schreiben. Das Problem besteht darin, dass in dem neuen benutzerdefinierten Tag das Ergebnis der Vorlage nicht gedruckt wird.AngularJS Problem mit VorlageURL
Zu diesem Link können Sie den Code sehen.
Index.HTML
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="it-IT">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Hello Angular</title>
<script src="../../angular.min.js"></script>
<script type="text/javascript" src="script.js"></script>
</head>
<body ng-app="myApp" ng-controller="controApp as ctrl">
<table border=2>
<thead>
<td>AAA</td>
<td>BBB</td>
<td>CCC</td>
</thead>
<tbody>
<lista-clienti lista="ctrl.elencoClienti"></lista-clienti>
</tbody>
</table>
</body>
</html>
script.js
var app = angular.module("myApp", []);
app.directive("listaClienti", function() {
return {
scope: {
lista : "="
},
//template: "<div>missing tpl</div>"
templateURL: "selectCity.html"
};
});
app.controller('controApp', function($scope){
$scope.elencoClienti = [
{codiceCliente: "1", ragioneSociale: "Michele Srl", indirizzo_so:"Via delle calende greche" },
{codiceCliente: "2", ragioneSociale: "Michele Srl", indirizzo_so:"Via delle calende greche" },
];
});
selectCity.html
<tr ng-repeat="c in lista">
<td>{{c.codiceCliente}}</td>
<td>{{c.ragioneSociale}}</td>
<td>{{c.indirizzo_so}}</td>
</tr>
konnte, was ist das Problem? Dank
Verzeichnisstruktur: 05_Custom_Directive
- Example_02
---- index.html
---- script.js
---- selectCity.html
Fügen Sie die Verzeichnisstruktur Ihrer Anwendung, meine Vorahnung ist Ihre SelectCity.html wird nicht fou durch die Richtlinie. – gh9
ich habe die Verzeichnisstruktur hinzufügen;) – vecio88
können Sie Ihre selectCity.html ändern die unter '