- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我没有让 masonry 在 ng-repeat 中工作。
我尝试添加一个类 masonry-container,并在我的 ng-repeat 中使用类 masonry-item。
在我的 js 中,我使用这两个类,我的 js 文件加载如下:-jquery-石工-我的文件
<div class="masonry-container" >
<div ng-repeat="link in links">
<div class="masonry-item col-sm-4">
<div class="jumbotron">
<div>
{{link.title}}
</div>
<div>
{{link.url}}
</div>
</div>
</div>
</div>
</div>
1.1JS)
$(document).ready(function(){
$('.masonry-container').masonry({
// options
itemSelector: '.masonry-item',
columnWidth: '.masonry-item'
});
});
最佳答案
我不知道 masonry ,但是当你的 JS 执行时,Angular 还没有渲染模板。
要执行您想做的操作,您应该使用指令并将代码放入link
函数中。
angular.module('Example', [])
.directive('masonry-container', [function () {
return {
link: function ($scope, element, attributs, controllers) {
element.masonry({
// ...
});
// ...
}
};
}])
Directives that want to modify the DOM typically use the link option to register DOM listeners as well as update the DOM. It is executed after the template has been cloned and is where directive logic will be put.
关于javascript - Angular 和 Masonry 协同工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36838854/
我想插入 备注 关于要在我的 latex 文档的特定位置进行的修复 也许有一个 列表的“待办事项/修复我” 你怎么处理这个? 似乎一种方法是使用 fixme 包,但我无法使其工作。 有人在用吗? 最佳
错误:无法创建表。我已经创建了一个数据库,并且已经提供了所有特权。但仍然无法登录协作模块。我受够了,但我不想放弃。我已经尝试了所有可能的方法,但都行不通。 Stackoverflow 是我所知道的最好
我是一名优秀的程序员,十分优秀!