Extract Angular components to plain HTML + CSS - html

I have an angular app that I need to use as a source of the components for my new app that will be mostly using pure HTML. I need to get the HTML and CSS from the Angular app.
The problem is, that the app uses custom components such as <mat-icon> that are not standard HTML tags. I assume, that under the hood they eventually consist of simple HTML elements but I can't figure it out. Is there any method to convert an Angular website to plain HTML & CSS? I know that the dynamic content can't be extracted, but I mean only the view. Maybe there is a Chrome extension to do that? I do have access to the app source code, so it can be also some npm module.

Related

Angular 7: Dynamically generate template

I'm rewriting my website https://ixtutor.com/ completely in angular. I've created few components that render as widgets on a blog page.
For example, on a blog post https://ixtutor.com/tensorflow-basics-with-housing-prices-prediction-example-chapter-i/ , there are widgets like,
(i) Code runner widget
(ii) Exercise widget
I'm modeling these widgets as components in my angular application.
Problem: One of the page in my application is a live html editor, which allows an author to write the (angular) html templates in a textarea T1 and see the (rendered) view side-by-side. I also want the author to be able to use the widget components in the html that they create.
This works great with regular html tags, where I can use the innerHTML property of a div to directly bind the ngModel of the textarea T1, however, it doesn't work for the angular components.
I've looked at dynamic angular components but I cannot figure out how to use that in a full-fledged html template. Any recommendations or suggestions will be really appreciated.
Thanks.
Angular does not support inserting dynamic components in the template at runtime. It has to know at compile time which components will be inserted.
The only way is to compile your Angular components to web components using Angular elements, that way, you will be able to insert them as custom HTML elements in your application.
You will have to develop them in a separate library for this.

Inserting HTML (with angular 2 directives) from the server into the DOM

I have ~2,000 lines of HTML code that I can retrieve from my Java server. This HTML code also has angular directives inside of it, such as ngIf* and (click) and [ngClass]. When I try to display that HTML in my client with such methods as the below:
<div [innerHTML]="htmlData"></div>
<div innerHTML="{{ htmlData }}"></div>
I see all of the HTML elements displayed correctly, but none of the angular directives are working (such as some of the HTML should be hidden with the *ngIf but they aren't... and none of the (click) events work. What can I do to fix this?
I need this functionality because I am delivering my code as a JAR file to various users to run on their local machines, and I want to serve the HTML code from some Amazon's S3 so I can update it whenever I want to give their website an update.
And I tried looking at the below answers, but those dealt with pure HTML from the server, and didn't have any angular directives.
Inserting HTML from server into DOM with angular2 (general DOM manipulation in Angular2)
Angular HTML binding
Unfortunately it's not possible. InnterHTML will put HTML code there - not angular. Angular code should be compiled ahead of time - a process where all the directives and html magic is replaced with simple JS.
You can transform you angular code to plain html by server side rendering with node js.
You can read more about server side rendering here: https://angular.io/guide/universal
But just as well you can use JAVA and with any popular templating framework for JAVA servers if you'll send your parameters on the http request.

Is it possible to preview Angular template?

Is there a way to preview Angular template (i.e. see how HTML would be rendered) without starting the whole application?
I'm working on CSS styling and it would be easier to be able to see changes immediately.
Is there a way to preview Angular template (i.e. see how HTML would be
rendered) without starting the whole application?
You can't. There's only one way which is starting your Angular application. One reason is that in the Angular application, your CSS doesn't directly affect the HTML like in a normal standalone webpage.

HTML email template builder using Delphi

I want to build an interactive html page builder using drag n drop.
Basically it will have elements like image, section, text etc which a user can use to build a HTML page.
Any suggestions for third party Delphi components which I can use for HTML editor?
Have a look at HTML Component Library. It includes an editor. Check this blog post for an introduction HTMLComponents, the native Delphi html rendering engine

How to use HTML template with Vaadin?

I am new to Vaadin.
I have created template for my web application in HTML and JS.
How to use the developed template with Vaadin as am not sure if I will be able to develop same template using Vaadin only?
It may be possible to re-use some of the layout of the template using the CustomLayout layout component in Vaadin.
You can also render the contents of a template into a Label component, and display the label in the application. See http://demo.vaadin.com/sampler#LabelRich for a small demo.
Generally, though, the idea of templates and "pages" is orthogonal to developing applications in Vaadin.