gpt4 book ai didi

angularjs - ng-include 不显示包含的表

转载 作者:行者123 更新时间:2023-11-27 23:05:27 25 4
gpt4 key购买 nike

HTML 脚本

<div>
<select ng-model="selectView">
<option value="empTable.html">Table View</option>
<option value="empList.html">List View</option>
</select>

<div ng-include="selectView"></div>

</div>

Angular 脚本

var angScript = angular.module("multiselectapp",[]). controller ("multicontroller", function ($scope){
var empList = [
{ name:"sue", gender:"female" },
{ name:"Joe", gender:"male" }
];

$scope.employees =empList;
$scope. selectView ="empTable.html";
});

empTable.htmlempList.html 具有使用ng-repeat 显示表格和 ListView 的基本HTML 脚本。 Angular 脚本文件已加载,所有路径都可以通过显示在 HTML 页面上的 $scope.message="file detected in html“ 消息进行交叉验证。但是根本没有显示表格和列表。

请多多指教!

最佳答案

 Ng-include=" '{{selectedView}}' " 

如果它不起作用,请尝试删除 {{}}

关于angularjs - ng-include 不显示包含的表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49726424/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com