我试图在页面客户列表中显示但由于某种原因它不起作用..我认为它与' ngRoute'
有关结构:
-root 的index.html
的index.html
<body ng-app="emailBuilder">
<div ng-include='"templates/header.html"'></div>
<div ng-view></div>
<div ng-include='"templates/footer.html"'></div>
</body>
main.js
var app = angular.module('emailBuilder', [
'ngRoute'
]);
app.config(['$routeProvider', function ($routeProvider) {
$routeProvider
.when("/", {templateUrl: "views/home.html", controller: "PageCtrl"})
.when("/clients", {templateUrl: "views/clients.html", controller: "PageCtrl"})
.when("/templates", {templateUrl: "views/templates.html", controller: "PageCtrl"})
.otherwise("/404", {templateUrl: "views/404.html", controller:"PageCtrl"});
}]);
app.controller("PageCtrl", function($scope){
$scope.clients = [
{ name: "clientName", template: "templateName", logo: "logo1"},
{ name: "clientName2", template: "templatename2", logo: "logo2"},
];
});
clientList.html
<div class="client">
<img ng-src="{{client.logo}}.jpg" width="15" />
{{client.name}}<br /> {{client.template}}
</div>
clients.html
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Clients
<small>Choose a client</small>
</h1>
<ol class="breadcrumb">
<li><a href="../index.html">Home</a>
</li>
<li class="active">Clients</li>
</ol>
</div>
</div>
<div class="row">
<h3>Clients</h3>
<div ng-controller="PageCtrl">
<div ng-repeat="client in clients" ng-include="views/partials/clientList.html">
</div>
</div>
</div>
</div>