javascript - 在 AngularJS View 中使用 Waypoints.js

标签 javascript jquery angularjs jquery-waypoints

我试图在可滚动的 AngularJS View 中使用 Waypoints,但它不起作用。我正在尝试使用 ui.utils jQuery Passthrough 但没有任何反应。这是我到目前为止所拥有的:

<body>
<div id="wrapper">

    <div id="nav-menu">
        <...>
    </div>


    <div id="main" class="main">
        <div ng-view></div> 
    </div>
</div>
</body>

我正在使用以下 View 模板:

<div class="fullScreenImage"></div>
<div ui-jq="waypoint" ui-options="test">test</div>

我的 Controller 看起来像这样:

app.controller('myController', ['$scope',
 function ($scope) {
    $scope.test = function(){
       alert('You have scrolled to an entry.');
}}]);

我的ma​​in元素是可滚动的,但窗口不是。将直通设置为主 div 将触发测试函数,但我需要它在模板内。有什么建议吗?

最佳答案

提供 JSFiddle 或 plunkr 会很有帮助。

但我认为问题是因为模板位于 ngView 内部。

由于模板的内容通过 XHR 放置在 ngView 内,因此需要刷新路径点,如链接 http://imakewebthings.com/jquery-waypoints/#doc-refresh 中所述。

恕我直言,Angular 指令会更有效。

关于javascript - 在 AngularJS View 中使用 Waypoints.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23094706/

相关文章:

javascript - attr 在 Chrome 和 safari 中不起作用

javascript - 使用 === 检查两个值是否有意义相等,在 javascript 中不起作用

jquery-plugins - 如何在 jQuery 中使用插件?

javascript - 在 AngularJS/Cordova 应用程序中网络连接断开时显示弹出窗口?

javascript - 在从 HTML 代码调用的 JavaScript 函数中使用 $scope 变量 - AngularJS

javascript - AngularJS,停止 a href?

javascript - 需要调用工具提示上的 Morris.js 单击事件

javascript - 提交后重置 HTML 表单

javascript - 如何使用导入的 JS 对象数组部署 REST API?

javascript - Angular ng-if 子句不能双向工作