1. 程式人生 > >angular子頁面呼叫父頁面方法

angular子頁面呼叫父頁面方法

父頁面html
<res-card  open-video-play = "openVideoPlay(dataArr,resourceStr,playType)" ></res-card>

--ps 注意: open-video-play 為子頁面呼叫方法  子頁面呼叫的時候橫線轉大寫

父頁面js

$scope.openVideoPlay = function (dataArr,resourceStr,playType) {

};

子頁面呼叫js

var singleshipingList = [];
singleshipingList.push(dgSource);
scope.openVideoPlay({dataArr:singleshipingList,resourceStr:data.data});

--ps 注意  子頁面呼叫的時候方法引數以物件形式穿,並且物件名和父頁面定義的物件名必須一樣