国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

angular.js - Angular js modal pop-up box ng-click does not take effect
為情所困
為情所困 2017-05-15 17:06:20
0
2
845

In the project, the modal pop-up box component is written in the factory. Previously, it was just a simple implementation of pop-up and closing functions. Now a new ng-click event is added to request data,
`//Some simple event functions of the modal box are defined here, so I won’t list them one by one
...

getTpl = function(name){

    switch(name){
        case"unbindMemCard":
            tpl='<p class="vip-card-dialog">'+
                    '<p class="vip-card-dialog-bd">'+
                    '<p>確定解綁會(huì)員卡號(hào){{currentCard.mcCode}}下的黃金會(huì)員卡消費(fèi)項(xiàng)目。</p>'+
                    '<p>解綁后的消費(fèi)項(xiàng)目可到場(chǎng)館前臺(tái)進(jìn)行重新綁定。</p>'+
                    '</p>'+
                    '<p class="vip-card-dialog-ft">'+
                    '<a href="javascript:void(0);" class="vip-card-btn-dialog cancel my_default">取消</a>'+
                    '<a href="javascript:void(0);" ng-click="unbindMember()" class="vip-card-btn-dialog ok my_primary">確定</a>'+
                    '</p>'+
                    ' </p>';
            break;
        default :
            return;
    }
    return tpl;
};`
 return {
  unbindMemCard:function(){
        var tpl=getTpl('unbindMemCard');
        addAlertify(tpl);//彈出模態(tài)框
        //關(guān)閉模態(tài)框
        var  my_default = document.getElementsByClassName("my_default")[0];
        my_default.addEventListener("click",defaultFun,false);
    },
 }`
 
 
dialogService.unbindMemCard();//彈出模態(tài)彈出框
$scope.unbindMember=function(){
    //解綁函數(shù)
    ......
}
 確定按鈕上的ng-click函數(shù)原本是在解綁會(huì)員卡整個(gè)頁面上的,現(xiàn)在把這個(gè)點(diǎn)擊事件遷移到模態(tài)彈出框中去了,我發(fā)現(xiàn)觸發(fā)不了。也就是解綁頁面加載了html模板,當(dāng)前整個(gè)頁面里面$scope.unbindMember仍然取不到tpl,里面的ng-click="unbindMember()".
 應(yīng)該如何解決?
 我的思路:1、在factory里面另起一個(gè)方法去請(qǐng)求接口;
 2、把ng-click=unbindMember()變得能讓解綁頁面獲取到
  
為情所困
為情所困

reply all(2)
某草草

First of all, let me state that I am a rough and wild programmer, maybe my method is not good.

If I were to implement it, I think this scenario is suitable to be implemented using directives.

//當(dāng)前控制器:
$scope.XXX : {
    success : function(){
    },
    canel : function(){
    }
}
<model-box mb-data="XXX"></model-box>

Pop up/close and so on, write it in the controller of the directive.

Finally, Amway downloaded my paging program and followed the writing method of the experts in the community. I wanted to write it into the service, but I used directive to create a wheel: http://www.miaoqiyuan.cn/p/an...

過去多啦不再A夢(mèng)

The trigger cannot be triggered becauseng-click 在當(dāng)前的scope里找不到unbindMember(), this scope is not the scope in your controller, it may not even exist~
This involves the operation of Dom, so this part is still written in the directive

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template