Skip to content

Instantly share code, notes, and snippets.

@jhoguet
Created February 9, 2016 04:57
Show Gist options
  • Save jhoguet/ca42c416d9a39e9496b4 to your computer and use it in GitHub Desktop.
Save jhoguet/ca42c416d9a39e9496b4 to your computer and use it in GitHub Desktop.
aurelia console debugger

Simply expose a global (eg in main.js)

window.au = el => {
    let aureliaNode  = el;
    // go up the structure until an element affected by aurelia is found
    while (aureliaNode !== null && aureliaNode !== undefined && aureliaNode.au === undefined) {
        aureliaNode = aureliaNode.parentNode;
    }

    if (!aureliaNode.au){
        return null;
    }

    return aureliaNode.au.controller.viewModel;
};

then right click any element, click inspect, and enter the following in the console

au($0).myProperty

where myProperty is a custom view model property

inspired by angular.element($0).scope()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment