Skip to content

How to import jCanvas to work with Angular? #363

@afunworm

Description

@afunworm

Hi.

Is there a way for this to work with Angular?

I have the canvas set up in the view component. In the script component, I tried importing both jQuery and jCanvas using different methods, for example:

import * as $ from 'jQuery'; import * as jCanvas from 'jcanvas';

Then using different way to invoke it. An example would be:

jCanvas('#canvas') .addLayer({ type: 'image', name: 'bg', source: 'images/canvas/bg.png', x: 0, y: 0, width: 613, height: 905, fromCenter: false, }) .drawLayers();

Or:

$('#canvas') .addLayer({ type: 'image', name: 'bg', source: 'images/canvas/bg.png', x: 0, y: 0, width: 613, height: 905, fromCenter: false, }) .drawLayers();

But they all returns the error: $(...).addLayer is not a function.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions