简体   繁体   中英

Aurelia Layout View Binding Scope

I am trying to use a layout view. The module I am using the layout view is called dashboard. I have this fragment in my layout view:

<div class="manage-btn" click.delegate="manageClick()">MANAGE ACCOUNT</div>

this is my dashboard.html:

<template>     

  <router-view layout-view="src/layouts/dash-layout.html"></router-view>

</template>

then in my dashboard.js I have the function:

manageClick() {

    if (this.profileDropClass === '') {
        this.profileDropClass = 'show';
    }
    else {
        this.profileDropClass = '';
    }

}// manageClick()

I keep getting an error that says the manageClick() is not a function. I have functionality that I want to reside within the layout view, is this not possible? If I have to repeat this functionality, what good is the layout view?

You'd have to define the layout-viewmodel and or model. Take a look at the following blog post for more details https://www.google.at/amp/s/charlespockert.wordpress.com/2016/07/05/using-the-layouts-feature-in-aurelia/amp/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM