Angular.js: chamada recursiva para um controlador $ mddialog

function nextFunctionPopup() {
            
    var index = dp.aaas.findIndex(aaa => aaa.id === dp.aaa.id);
    dp.order = index + 1;
    dp.aaa = dp.aaas[dp.order];
}
SAMER SAEID