搜索结果不会显示在Angular指令中

时间:2016-04-01 18:57:05

标签: javascript angularjs

我无法在搜索结果页面上显示搜索结果。我知道它的工作原因是分页和其他功能正在工作和显示,我只是无法获得显示的实际搜索结果(网站标题,网址和desc),需要一些新鲜的眼睛(!)和想法(?)< / p>

指令的HTML元素:

<search-results ng-model="searchTerms" results="results.documents" site-urls="page.url" site-title="page.title" site-content="page.content"  uib-typeahead="query for query in getSuggestions($viewValue)" typeahead-on-select="search($item)"></search-results>

指令的HTML模板:

    <div ng-repeat="page in results.documents" id="result-list-items">
<h3>
    <a href="{{page.url}}">
        <span id="results-list-title" ng-bind-html="page.title"></span>
    </a>
</h3>
<h4 class="list-group-item-heading" id="results-list-url" ng-bind-html="page.url"></h4>
<p class="list-group-item-text" id="results-list-desc" ng-bind-html="page.content"></p>
</div>

AngularJS for directive:

'use strict';

angular.module("searchengine.search-results", [])
    .directive('searchResults', function() {
        return {
            restrict: 'E',
            replace: true,
            templateUrl: 'search/search-results.html',
            controller: ['homeCtrl','searchCtrl'],
            scope: {
                searchTerms: "=",//ngModel
                results: "=",
                siteUrls: "=",
                siteTitle: "=",
                siteContent: "=",
                suggestions: "&",
                search: "&"
            }
            //link: {(scope, elem, attr)
            //}
        }
    });

0 个答案:

没有答案