Code generation using ngx-blockly in Angular 14

376 views
Skip to first unread message

dillip bhaskar

unread,
Jan 11, 2023, 2:10:57 AM1/11/23
to Blockly
Hi ,
I am using ngx-blockly library in my Angular 14 application.
I am able to get the blocks and also able to drag n drop the blocks into workspace.

But I am struggling in generating Javascript code from workspace.

Can anybody help me in this regard.

Thanks
Dillip

Beka Westberg

unread,
Jan 11, 2023, 5:03:41 PM1/11/23
to blo...@googlegroups.com
Hello, Thank you for your question!

Could you provide a bit more information before I try to give a recommendation?
  • What code are you using to try to get the code?
  • What output is it returning, if any?
  • Are you getting any errors in the browser console? If so, could you copy + paste them in your reply?  
Also note that the core team doesn't maintain the ngx-blockly package, so we may not be able to help! But I can try!

Once we have a bit more information hopefully we can get this sorted =)
--Beka

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/869331d9-f0d0-451d-8229-d15148cc66can%40googlegroups.com.

Mark Friedman

unread,
Jan 11, 2023, 6:34:31 PM1/11/23
to blo...@googlegroups.com
Dillip,

  I'm not really familiar with ngx-blockly, but did you see the ngx-blockly documentation on code generation?

-Mark


On Tue, Jan 10, 2023 at 11:10 PM dillip bhaskar <dillip...@gmail.com> wrote:
--

dillip bhaskar

unread,
Jan 12, 2023, 12:45:37 AM1/12/23
to Blockly
Thanks Beka for addressing my concern..

Here is the GitHub link for NGX-Blockly that I have started integrating.


I am able to get the blocks in the menu & drag n drop the blocks into workspace with no console error ( snapshot attached ).
But unable to generate Javascript code out of it. 
Could you please help me in this regard.

regards
Dillip
ngx-blockly.PNG

Beka Westberg

unread,
Jan 12, 2023, 1:58:14 PM1/12/23
to blo...@googlegroups.com
Hello!

It looks like you linked to the source repository for ngx-blockly, rather than your repository. I can tell you that their code looks correct based on their documentation :P But it doesn't help me give you advice about your code :/ Could you post the code /you're/ using to try to get the output code string? E.g. your onCode callback?

I would also recommend checking out the link Mark posted if you haven't!

Hopefully with a bit more information we can get this sorted =)
--Beka

dillip bhaskar

unread,
Jan 15, 2023, 11:45:58 AM1/15/23
to Blockly
I have attached the HTML as well TS file from my application.

Can you please look at it and help me in generating Javascript code.

Thanks
Dillip

blockly.component.ts
blockly.component.html

Beka Westberg

unread,
Jan 17, 2023, 3:32:41 PM1/17/23
to Blockly
Hmm, from my uninformed perspective, it looks like you're doing everything correctly! If you copy the code from their example, then does it log the code to the console? That might help you debug.

Best wishes,
--Beka

Reply all
Reply to author
Forward
0 new messages