在数据准备就绪之前,我需要检测一个出现ngRepeat
的时刻。Catch ngRepeat初始化事件
我试过使用compile
(它为ngRepeat启动一次),但仍然没有运气,它在数据准备好后触发。
目标是在父指令上设置加载微调器。并在数据准备就绪时将其删除。
猜测我可以使用父邮件链接来搜索孩子的指令,但它不是角度的方式。
这里是plunker https://plnkr.co/edit/5OY5ySZm5L6Ba5Vw17af?p=preview
function testDirective(){
return {
compile: function compile(){
console.log('on data ready too, but I want it to be fired on init');
return {
pre: function(scope){
if(scope.$first){
console.log('first');
}
if(scope.$last){
console.log('last');
}
}
};
}
}
}
这也不是角度的方式。在此处添加您的代码或者获得帮助。 –
......这是什么? ngRepeat的用法?好。 – Kindzoku
@VassilisPits一样好 – Kindzoku