Skip to content

Manipulation in ts

Javier Pérez Ruiz edited this page May 17, 2017 · 1 revision

Manipulation

HzNavbar is synchronized with the navigator of haztivity, all the actions performed with the navigator will update the hz-navbar.
To interact with the navbar use the NavigatorService.

import {PageFactory, PageRegister, PageController} from "@haztivity/core";
import  template from "./page.pug";
export let page: PageRegister = PageFactory.createPage(
    {
        title: "MyPage",// Title to show in the pages list
        name: "6612",
        resources: [],
        template: template
    }
);
page.on(
    PageController.ON_SHOW, null, (eventObject, $page, $oldPage, oldPageRelativePosition, pageController) => {
        let navigatorService:NavigatorService = pageController.InjectorService.get(NavigatorService);
        navigatorService.disable();
        $page.find("#next").on("click",()=>{
            navigatorService.enable();
            //If the navbar is disabled the action will not be performed, it's necessary enable it before
            navigatorService.next();
        });
        $page.find("#enable").on("click",()=>{
            navigatorService.enable();
        });
        $page.find("#disable").on("click",()=>{
            navigatorService.disable();
        });
    }
);

Clone this wiki locally