我有这样的代码:
HTML
<!doctype html>
<html ng-app=EmployeeApp>
<head>
<meta charset="utf-8">
<title>favly</title>
<link rel="stylesheet" type="text/css" href="css/styles_index.css"/>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
<link href='http://fonts.googleapis.com/css?family=Roboto:500,900,100,300,700,400' rel='stylesheet' type='text/css'>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="js/search_folder.js"></script>
</head>
<body ng-controller="empCtrl">
<div id="leftMenu">
<div id="searchFoldersList"><span class="icon-search search"></span><input ng-model="fold.Folder" type="text" placeholder="Search..." /></div>
<div id="foldersList">
<ul>
<li ng-repeat="fold in folder">{{fold.Folder}}</li>
</ul>
</div>
<div id="addFolderBox"><span class="icon-add plus"></span> ADD NEW FOLDER</div>
</div>
<div id="rightContent">
<div id="menuContent">
<ul>
<li><span class="icon-list"></span></li>
<li><span class="icon-settings"></span></li>
<li><span class="icon-account-circle"></span></li>
</ul>
</div>
</div>
</body>
</html>
在JS上是这样的:
var employeeApp = angular.module("EmployeeApp",[]);
employeeApp.controller("empCtrl",function($scope, $http){
$http.get("folders_list.php").success(function (response) {$scope.folder = response.folders;});
});
和folders_list.php作用域如下:
{“记录”:{“文件夹”:“Juegos”},{“文件夹”:“Perif©ricos”}}
好吧,我的代码可以显示文件夹的名称,但我的问题是,我不知道为什么输入不能搜索那些"li“来找到输入的单词。我想这是因为我的ng-model是不正确的,但是我不知道ng-model是什么类型。
谢谢!
发布于 2015-05-20 08:20:53
这应该是response.records吗?
从…
$http.get("folders_list.php").success(function (response) {$scope.folder = response.records;}); 而不是
$http.get("folders_list.php").success(function (response) {$scope.folder = response.folders;}); https://stackoverflow.com/questions/30338193
复制相似问题