我正在使用 angular.js 和 jquery 开发新闻提要页面。
我正在使用指令来检测要显示的最后一个提要。当它返回时scope.$last ==true,我调用一个函数来执行一些 Jquery 动画。
然后,我按日期将 ng-model 添加showYear到过滤器元素,并添加ng-if到过滤器元素。
我的问题是,当最后一个元素被过滤ng-if并且未呈现时,该指令无法检测scope.$last并运行feedPosition()。
我尝试像下面的网址那样做,但它面临同样的问题:here。
请帮忙。
这是我的代码:
HTML:
<div id="feedList">
<div ng-repeat="feed in feeds | orderBy: '-date'" ng-if="show(feed.date)" feed-list-repeat-directive>
//some content here
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
JavaScript:
<script>
var feeds = [{
"type" : "publications",
"source" :"AAA",
"date" : new Date(2014, 4, 10),
"title" : "title 2014",
"thrumb" : "thrumb1.jpg"
},{
"type" : "tvc",
"source" : "BBB",
"date" : …Run Code Online (Sandbox Code Playgroud) 这是我的HTML代码:
<ul>
<li>
<div class="imgBox"><img 1></div>
<div class="txtBox">text 1</div>
</li>
<li>
<div class="imgBox"><img 2></div>
<div class="txtBox">text 2</div>
</li>
<li>
<div class="imgBox"><img 3></div>
<div class="txtBox">text 3</div>
</li>
<li>
<div class="imgBox"><img 4></div>
<div class="txtBox">text 4</div>
</li>
<ul>
Run Code Online (Sandbox Code Playgroud)
桌面的预期结果是:
_____________________
| img 1 | txt 1 |
_____________________
| txt 2 | img2 |
_____________________
| img 3 | txt 3 |
_____________________
| txt 4 | img 4 |
_____________________
Run Code Online (Sandbox Code Playgroud)
每个块宽:50%,图像宽度:100%到盒子,自动高度; 文本在框的中间,如display:table-cell; 文本对齐:中心; 垂直对齐:中部;
移动设备的预期结果是:
___________
| img 1 |
___________
| …Run Code Online (Sandbox Code Playgroud)