Issue #1691πŸ’¬ AnsweredOpened December 28, 2018by AkibDeraiya1230 reactions

How to use variable/function outside of the script

Quick answerby artf

You can't, they're not in the same context, read carefully this page https://grapesjs.com/docs/modules/Components-js.html You need to copy your global variables inside the script property or you can inject them in the canvas as a dependecy

Read full answer below ↓

Question

Hello @artf , How can i access the variable as well functions which is outside of the script. My code is like, I am using angular.js(Angular1). And the above code is for the controller file. Can you please assist me how can i use this global variable as well function in my script?

Answers (2)

artfβ€’ January 4, 2019

You can't, they're not in the same context, read carefully this page https://grapesjs.com/docs/modules/Components-js.html You need to copy your global variables inside the script property or you can inject them in the canvas as a dependecy

lock[bot]β€’ January 4, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins β†’
Premium option

Premium plugins ship with support, regular updates, and production-ready features β€” save days of integration work.

Browse premium plugins β†’

Related tutorials

In-depth guides on the same topic.

All tutorials β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.