今天我学习了angularjs,我正在尝试为我的搜索结果创建一个页面,以便能够创建方面过滤器。目前,我有一个页面模板,其代码如下--
<?php
/* Template Name:Search Results */ ?>
<!DOCTYPE html>
<html>
<head>
<base href="<?php $url_info = parse_url( home_url() ); echo trailingslashit( $url_info[\'path\'] ); ?>">
<title>Search</title>
<script src="//code.jquery.com/jquery-1.12.0.min.js"></script>
<script src="//code.jquery.com/jquery-migrate-1.3.0.min.js"></script>
<?php wp_head(); ?>
</head>
<body>
<div id="page" ng-app="app">
<header>
<h1>
<a href="<?php echo home_url(); ?>">Search</a>
</h1>
</header>
<div ng-view></div>
<footer>
© <?php echo date( \'Y\' ); ?>
</footer>
</div>
<?php wp_footer(); ?>
</body>
</html>
到目前为止,我遇到了一个问题,当总共有10篇帖子时,我只看到了5篇帖子。这是我的剧本-
angular.module(\'app\', [\'ngRoute\', \'ngSanitize\'])
.config(function($routeProvider, $locationProvider) {
$locationProvider.html5Mode(true);
$routeProvider
.when(\'/search-results\', {
templateUrl: myLocalized.partials + \'main.html\',
controller: \'Main\'
})
.when(\'/:ID\', {
templateUrl: myLocalized.partials + \'content.html\',
controller: \'Content\'
});
})
.controller(\'Main\', function($scope, $http, $routeParams) {
$http.get(\'wp-json/posts?type=property\').success(function(res){
$scope.posts = res;
});
})
.controller(\'Content\', function($scope, $http, $routeParams) {
$http.get(\'wp-json/posts?type=property?filter["posts_per_page"]=25&filter["orderby"]=date&filter["order"]=desc/\' + $routeParams.ID).success(function(res){
$scope.post = res;
});
});
这是我的部分-
<ul>
<li ng-repeat="post in posts">
<a href="{{post.ID}}">
{{post.title}}
</a>
</li>
</ul>
<ul>
<li ng-repeat="post in data.posts">
<a href="blog/{{post.id}}" ng-bind-html="post.title.rendered"></a>
<a href="blog/{{post.id}}" ng-if="post.featured_image_thumbnail_url"><img ng-src="{{post.featured_image_thumbnail_url}}" alt="{{post.featured_image.title.rendered}}" /></a>
<div ng-bind-html="post.excerpt.rendered"></div>
</li>
</ul>
我做错了什么,让它只显示一半的帖子?