Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This project is abandoned, but you can use unlayer natively in Angular #119

Open
petertoth-dev opened this issue Jan 27, 2024 · 1 comment

Comments

@petertoth-dev
Copy link

petertoth-dev commented Jan 27, 2024

I just copy-paste here the basic ChatGPT answer. I tested and worked. Of course you need to implement the events etc, but from this point it's easy.

Unlayer docs: https://docs.unlayer.com/docs/getting-started

Angular Component

Add Unlayer Script to Your Angular Project:
Add the Unlayer script to your index.html file within the src directory of your Angular project.

<!-- index.html -->
<html>
  <head>
    <!-- Other meta tags, stylesheets, etc. -->
    <script src="//editor.unlayer.com/embed.js"></script>
  </head>
  <body>
    <app-root></app-root>
  </body>
</html>

Initialize Unlayer in Your Angular Component:
In your Angular component where you want to use Unlayer, initialize it as described in the documentation.

// your-component.component.ts
import { Component } from '@angular/core';

declare var unlayer: any;

@Component({
  selector: 'app-your-component',
  templateUrl: './your-component.component.html',
  styleUrls: ['./your-component.component.css']
})
export class YourComponent {
  constructor() {
    // Initialize Unlayer
    unlayer.init({
      id: 'editor-container',
      projectId: 1234, // Your project ID
      displayMode: 'email'
    });
  }
}

Create the Container Element:
In your component's HTML template, create a container element with the specified ID where Unlayer will be rendered.

<!-- your-component.component.html -->
<div id="editor-container"></div>

Use Your Component:
Use your Angular component (app-your-component) in your application where you want to display the Unlayer editor.

<!-- Some other component's template -->
<app-your-component></app-your-component>
@HealMah
Copy link

HealMah commented Nov 4, 2024

I just copy-paste here the basic ChatGPT answer. I tested and worked. Of course you need to implement the events etc, but from this point it's easy.

Unlayer docs: https://docs.unlayer.com/docs/getting-started

Angular Component

Add Unlayer Script to Your Angular Project: Add the Unlayer script to your index.html file within the src directory of your Angular project.

<!-- index.html -->
<html>
  <head>
    <!-- Other meta tags, stylesheets, etc. -->
    <script src="//editor.unlayer.com/embed.js"></script>
  </head>
  <body>
    <app-root></app-root>
  </body>
</html>

Initialize Unlayer in Your Angular Component: In your Angular component where you want to use Unlayer, initialize it as described in the documentation.

// your-component.component.ts
import { Component } from '@angular/core';

declare var unlayer: any;

@Component({
  selector: 'app-your-component',
  templateUrl: './your-component.component.html',
  styleUrls: ['./your-component.component.css']
})
export class YourComponent {
  constructor() {
    // Initialize Unlayer
    unlayer.init({
      id: 'editor-container',
      projectId: 1234, // Your project ID
      displayMode: 'email'
    });
  }
}

Create the Container Element: In your component's HTML template, create a container element with the specified ID where Unlayer will be rendered.

<!-- your-component.component.html -->
<div id="editor-container"></div>

Use Your Component: Use your Angular component (app-your-component) in your application where you want to display the Unlayer editor.

<!-- Some other component's template -->
<app-your-component></app-your-component>

It's NO ABANDONED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants