move gotoPage function from list.js to directives.js