Aurelia Binding Click Trigger in Nav Bar

拥有回忆 提交于 2019-12-05 21:33:17

In nav-bar.html, add another bindable property for the toggle method. Bindable properties are the way to share data/functions with a custom element. This keeps custom elements encapsulated and portable.

<template bindable="router,toggleSidebar">

Then in app.html, bind the toggleSidebar method to the nav-bar element:

<nav-bar router.bind="router" toggle-sidebar.call="toggleSidebar()"></nav-bar>

I think you may need to return true from your toggleSidebar method so that the default action (following the link) isn't canceled.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!