【发布时间】:2017-05-05 17:23:16
【问题描述】:
我试图在页面客户端列表上显示,但由于某种原因它不起作用..我认为它与“ngRoute”有关
结构:
-根 index.html
- bower_components
- CSS
- js
main.js - 模板
页脚.html
header.html - 浏览量
客户.html
主页.html
模板.html- 部分
客户端列表.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>
【问题讨论】:
-
您能在控制台中提供记录的错误吗?
-
没有没有错误
-
你好。如果您没有收到错误。例如,当您尝试获取localhost/clients 时,您会看到什么?只是空白页?
-
在客户端页面上我看到了 h3-clients 但它没有加载客户端列表
标签: javascript jquery html css angularjs