在点击之前失去焦点

时间:2015-05-08 18:38:01

标签: html angularjs

当我失去焦点时,我试图让我的搜索下拉消失。但是,只能关注输入元素。所以我有一个问题,如果我点击下拉元素,元素会在点击进入之前隐藏。

<div class="col-md-8 col-md-offset-2">
    <p class="text-center white-text">Browse our course library to see a full list of lessons included in each course. Be sure to check back frequently as new lessons are added regularly.</p>
    <div class="form-group course-search" dropdown>
        <label class="sr-only white-text" for="searchFaqs">Search Courses</label>
        <input class="form-control" ng-focus="focus = true" ng-blur="focus = false"  type="search" ng-model="searchCourses" placeholder="Enter a Search Term" ng-change="searchQuery(searchCourses)">
        <div class="btn-group">
            <ul role="menu" ng-show="focus && (courseResults || episodeResults)" dropdown-menu ng-click="focus=true">
                <li ng-repeat="course in courseResults">
                    <a class="btn btn-dropdown" ui-sref="categories.course({ courseid: course.id })">
                        <span class="icon-right-open-big"></span>
                        <h3 ng-bind-html="course.name"></h3>
                        <div ng-if="course.context" ng-bind-html="course.context" class="context"></div>
                    </a>
                </li>
                <li ng-repeat="episode in episodeResults">
                    <a class="btn btn-dropdown" ui-sref="categories.course.episode({ courseid: course.id, episodeid: episode.id })">
                        <span class="icon-right-open-big"></span>
                        <h3 ng-bind-html="episode.title"></h3>
                        <div ng-if="episode.context" ng-bind-html="episode.context" class="context"></div>
                    </a>
                </li>
            </ul>
        </div>
    </div>
</div>

0 个答案:

没有答案