AngularJs:如何将表格滚动到当前的ng-init日期?

时间:2018-03-23 17:14:46

标签: jquery html css angularjs

我的DOM上有这段代码,用于初始化我桌面上的当前日期。

<table id="daysTableLeft" class="table table-hover" ng-init="getHorraire(pickDateRow,$index,0)">
                          <tr ng-repeat="fd in getFullDayDate track by $index"
                          ng-click="getHorraire(fd.myDate,$index,1)"
                          style="cursor:pointer" ng-model="pickDateRow"
                          ng-class="{activeLink: $index===selectedIndex, weekend: fd.dayName=='Samedi'|| fd.dayName=='Dimanche'}">
                          <td style="font-size:14px;" id="{{fd.$index}}"> {{fd.fullDate}}, 2018</td>
                          </tr>
                          <tr><td style="height:80px;"></td></tr>
                      </table>

例如,如果今天的日期是30/03/2018,我知道第30个日期位于底部元素。然后我必须手动滚动才能看到今天的日期。

是否有可能自动滚动到当前日期?

1 个答案:

答案 0 :(得分:2)

根据@Bryan的建议,您可以为当前日期创建一个ID,并使用$ git show --name-only 1778f1e9a4c37aa2bad51f4027139625cf39783a 0fa669bcaeb8861cbf24544f18d22a8f39821f1a commit 1778f1e9a4c37aa2bad51f4027139625cf39783a Author: Jouni Malinen <jouni@codeaurora.org> Date: Fri Mar 23 17:57:14 2018 +0200 SAE: Fix PTK derivation to use KDF-SHA256 The previous implementation ended up defaulting to using PRF-SHA1 for deriving PTK from PMK when SAE was used. This is not correct since the SAE AKM is defined to be using SHA-256 -based KDF instead. Fix that. Note: This change is not backwards compatible. Both the AP and station side implementations will need to be updated at the same time to maintain functionality. Signed-off-by: Jouni Malinen <jouni@codeaurora.org> src/common/defs.h src/common/wpa_common.c commit 0fa669bcaeb8861cbf24544f18d22a8f39821f1a Author: Jouni Malinen <jouni@codeaurora.org> Date: Wed Mar 21 22:34:09 2018 +0200 Fix a resource leak on hostapd maclist parsing error path The open file needs to be closed in error case. The conversion to using a new helper function (hostapd_add_acl_maclist) somehow managed to remove the neede fclose(f) call. Bring it back to fix this. Fixes: 3988046de538 ("hostapd: Dynamic MAC ACL management over control interface") Signed-off-by: Jouni Malinen <jouni@codeaurora.org> hostapd/config_file.c 滚动到当前日期。

anchor-scroll

您必须将 <div ng-repeat="item in dateArray"> <span id="{{(item.getDate()==today.getDate())?'scrollDate':''}}"> {{item | date}} </span> </div> $location注入您的控制器。

工作jsfiddle link供您参考。

注意:$anchorScroll无法提供平滑滚动或无法与$anchorScroll一起使用。如果你想要平滑滚动,你必须使用第三方指令。

参考链接:https://stackoverflow.com/a/21918502/2079271