1

So I have successfully rendered epub via epubJs in Angular now I want my select element to populate pages with href so that I can navigate to the specific Page in epub my epub on top left corner there is a select element in which I want to populate options of pages

So i referred to epubjs examples

book.loaded.navigation.then(function(toc){
            var $select = document.getElementById("toc"),
                    docfrag = document.createDocumentFragment();

            toc.forEach(function(chapter) {
                var option = document.createElement("option");
                option.textContent = chapter.label;
                option.ref = chapter.href;

                docfrag.appendChild(option);
            });

            $select.appendChild(docfrag);

            $select.onchange = function(){
                    var index = $select.selectedIndex,
                            url = $select.options[index].ref;
                    rendition.display(url);
                    return false;
            };

        });

now i Want to convert this js in Angular ts so that i can populate my select element with options

Here is my ts code

reader.ts

Here is my html code

reader.html

0 Answers0