Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/423.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript AngularJS路由页面未显示_Javascript_Html_Angularjs_Routes - Fatal编程技术网

Javascript AngularJS路由页面未显示

Javascript AngularJS路由页面未显示,javascript,html,angularjs,routes,Javascript,Html,Angularjs,Routes,这么快的问题,我已经看了这段代码一段时间了,但找不到原因,它只是给了我页面上的输出 Partials/View1.html 每当我遇到一些小问题时,我并不是想在这里发帖,但这已经困扰了我一段时间了,我在控制台上没有收到任何错误。我从运行代码,在另一篇文章中提到,它工作得很好,但我没有从中得到正确的输出。以下是index.html(主页) 我没有从view1.html中得到应该显示的内容,我只是得到了上面显示的内容。这是密码 <div class="container"> <h

这么快的问题,我已经看了这段代码一段时间了,但找不到原因,它只是给了我页面上的输出

Partials/View1.html
每当我遇到一些小问题时,我并不是想在这里发帖,但这已经困扰了我一段时间了,我在控制台上没有收到任何错误。我从运行代码,在另一篇文章中提到,它工作得很好,但我没有从中得到正确的输出。以下是index.html(主页)

我没有从view1.html中得到应该显示的内容,我只是得到了上面显示的内容。这是密码

<div class="container">
<h2>View 1</h2>
Name: 
<br>
<input type="text" ng-model="filter.name">
<br>
<ul>
    <li ng-repeat="cust in customers | filter:filter.name | orderBy: 'city'">{{ cust.name }} - {{ cust.city }}</li>
</ul>

<br>
Customer name: <br>
<input type="text" ng-model="newCustomer.name">
Customer city: <br>
<input type="text" ng-model="newCustomer.city">
<br>
<button ng-click="addCustomer()">Add Customer</button>
<br>
<a href="#/view2">View 2</a>

</div>

视图1
姓名:



客户名称:
客户城市:

添加客户

您应该使用templateUrl而不是template:

.when('/partial2',
   {
     controller: 'SimpleController',
     templateUrl: 'Partials/View2.html'
   })

哇,我很害怕这个。看了所有的东西,没有错误,不知怎的,在我的脑海里,我想这会是一件愚蠢的事情。谢谢。别担心,@theman55,当你花了很长时间查看自己的代码时,这些类型的错误几乎不可能被你自己发现。对于没有编写它的人来说,跳进去发现bug要容易得多
<div class="container">
<h2>View 1</h2>
Name: 
<br>
<input type="text" ng-model="filter.name">
<br>
<ul>
    <li ng-repeat="cust in customers | filter:filter.name | orderBy: 'city'">{{ cust.name }} - {{ cust.city }}</li>
</ul>

<br>
Customer name: <br>
<input type="text" ng-model="newCustomer.name">
Customer city: <br>
<input type="text" ng-model="newCustomer.city">
<br>
<button ng-click="addCustomer()">Add Customer</button>
<br>
<a href="#/view2">View 2</a>

</div>
.when('/partial2',
   {
     controller: 'SimpleController',
     templateUrl: 'Partials/View2.html'
   })