0

JS

var app = angular.module('CompanyProfile', []);

app.controller('CompanyProfileCtrl', function() {

      function init() {

        var editor = grapesjs.init({
              allowScripts: 1,
              showOffsets: 1,
              autorender: 0,
              noticeOnUnload: 0,
              container: "#gjs",
              height: "700px",
              fromElement: true,
              clearOnRender: 0,
              storageManager: {
                autoload: 0
              },

HOW can i make this possible? BTW i did not submit the whole code. Assume that is all there. Will is work?

Aleksey Solovey
  • 4,153
  • 3
  • 15
  • 34
Brandon Yu
  • 49
  • 1
  • 1
  • 5
  • Put it in a directive to assure the container element exists when you initialize – charlietfl Nov 21 '18 at 17:27
  • hey, can you please provide an example – Brandon Yu Nov 21 '18 at 17:30
  • There are examples of initializing third party scripts in directives all over the web and in this site as well – charlietfl Nov 21 '18 at 17:31
  • Questions asking for tutorials or examples is off-topic for Stackerflow. Instead show us what you have done and describe the problems you are having so far. To create custom AngularJS Directives, see [AngularJS Developer Guide - Creating Custom Directives](https://docs.angularjs.org/guide/directive). – georgeawg Nov 21 '18 at 20:29

1 Answers1

0

If grapesjs has been loaded on the page it should be available the same way jQuery is. You can check your scripts tags for this in your main view (usually index.html). You can download it if you haven't already from here.

Mickers
  • 1,367
  • 1
  • 20
  • 28
  • is it possible if i can share you the whole code and youll understand. Cus im done the whole for grapejs part. Im just having issues integrating the angularjs controller – Brandon Yu Nov 21 '18 at 17:18
  • Your controller looks good from what I can tell. Have you been able to bind the module to the page? That might be the part you're having issues with. – Mickers Nov 21 '18 at 17:30