###前提・実現したいこと
monacaクラウドIDE、onsenUI2.2です。
質問は掲題の通りでons-lazy-repeatを使用するとng-clickが使用できません。
当初domを操作していることが問題なのかと考えましたが、直接ng-clickを書き込んでもNGでした。
※使用できない=タップしても何も起きません。エラーもでません。
そこで単純にons-lazy-repeatタグを除去したところ正常に動作しました。
さすがにこれでは使い道がないので仕様ではないと思っていますが、この問題を解決する方法はありませんでしょうか。。
html
1<ons-template id="hoge.html"> 2<ons-page ng-controller="HogeCtrl as hoge"> 3<ons-lazy-repeat id="list"> 4 <ons-list-item> 5 <div ng-click="hoge.popP()">hoge</div> 6 </ons-list-item> 7</ons-lazy-repeat> 8</ons-page> 9</ons-template>
javascript
1 2module.controller("HogeCtrl", function() { 3 document.addEventListener('init', getList, false); 4 this.popP = function() { 5 alert('hoge') 6 }; 7}); 8 9function getList() { 10 var lazyRepeat = document.getElementById('list'); 11 lazyRepeat.delegate = { 12 createItemContent: function(i, template) { 13 var dom = template.cloneNode(true); 14 return dom; 15 }, 16 17 countItems: function() { 18 return 15; 19 }, 20 destroyItem: function(index, item) { 21 console.log('Destroyed item with index: ' + index); 22 } 23 }; 24 lazyRepeat.refresh(); 25} 26 27
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/04/06 00:40
2017/04/06 00:45
2017/04/06 00:59
2017/04/06 01:03
2017/04/06 01:23 編集
2017/04/06 01:49 編集
2017/04/06 02:05
2017/04/06 02:11
2017/04/06 02:32 編集
2017/04/06 02:46 編集
2017/04/06 02:46
2017/04/06 02:49
2017/04/06 02:54
2017/04/06 04:03 編集
2017/04/06 05:20
2017/04/06 05:47
2017/04/06 05:53
2017/04/06 06:47 編集
2017/04/06 12:12