Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.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
Angularjs 视图未加载任何数据。有人能解决吗?_Angularjs_Angularjs Directive_Angularjs Scope_Angular Ui Router - Fatal编程技术网

Angularjs 视图未加载任何数据。有人能解决吗?

Angularjs 视图未加载任何数据。有人能解决吗?,angularjs,angularjs-directive,angularjs-scope,angular-ui-router,Angularjs,Angularjs Directive,Angularjs Scope,Angular Ui Router,几天前我开始学习angular.js 这不会在angular.html中加载视图。我不确定代码中出了什么问题 angular.html保存在根文件夹中。view1.html和view2.html位于root/partials文件夹中 angular.html view1.html view2.html 根据你的问题,你的观点应该是 templateUrl: 'root/partials/view2.html' 及 分别模板URL:'partials/view1.html' & templa

几天前我开始学习angular.js

这不会在angular.html中加载视图。我不确定代码中出了什么问题

angular.html保存在根文件夹中。view1.html和view2.html位于root/partials文件夹中

angular.html

view1.html

view2.html


根据你的问题,你的观点应该是

  templateUrl: 'root/partials/view2.html'


分别模板URL:'partials/view1.html' & templateUrl:'partials/view2.html'


因为文件已经在根文件夹中。

将其放入plunk或JSFIDLE。如何在JSFIDLE中测试视图??使用Plunker-它允许您创建基本的文件结构。您还可以使用标记在同一个文件中内联声明视图。此外,这里似乎有一些简单的输入错误:templateUrl是angularpartials,但视图位于root/partials下
<div>
    <input type="text" data-ng-model="filter.name"> {{filter.name | uppercase}} 
    <h3>view1 </h3>
    <ul>
        <li data-ng-repeat="client in clients | filter : filter.name | orderBy : 'city' "> {{client.name}}<br> </li>           
    </ul>   
    New Client: <input type="text" data-ng-model="newClient.name"><br />
    Client City<input type="text" data-ng-model="newClient.city"><br />    
    <button data-ng-click="addClient()">Add Customer</button><br />
    <a href="#/view2">view 2</a>
</div>
<div class="container">
    <input type="text" data-ng-model="filter.name"> {{filter.name | uppercase}} 
    <br>
    <h3>view 2 </h3>
    <ul>
        <li data-ng-repeat="client in clients | filter : filter.name | orderBy : 'city' "> {{$scope.client.name}} in {{$scope.client.city}}<br> </li>           
    </ul>   
    <a href="#/view1">view 1</a>
</div>
  templateUrl: 'root/partials/view2.html'
  templateUrl: 'root/partials/view1.html'