1

Currently, I am working on an Angular project where I have so many pages having similar HTML structure.

I have a fixed HTML Structure and what all I need is, whenever I create a component, component.html file should contain my fixed HTML structure by default.

How can I do that, Is that something possible?

If it is, Please help!

SiddAjmera
  • 38,129
  • 5
  • 72
  • 110
  • Just to confirm I got this right, what you want to achieve is replace the default content for the view file generated by "ng generate component"? – SPArcheon Sep 21 '18 at 09:27
  • @SPArchaeologist - We are building a design language system of our own and all components have almost same HTML structure, So we thought of having a template which have fixed headers, footers and consistent spacing between the elements across the site. So, whenever we generate a component, It should generate HTML file having our basic structure. – chaithanya bonthala Sep 21 '18 at 11:47
  • 1
    Try having a look at Angular Schematics. It'll provide you with a way of extending AngularCLI's pre-defined Schematics to create your own and do the needful there. Here's a great article about it: https://blog.angular.io/schematics-an-introduction-dc1dfbc2a2b2 – SiddAjmera Sep 21 '18 at 11:51
  • Please take a look at ng-include https://www.w3schools.com/angular/angular_includes.asp – Shekhar Khairnar Sep 21 '18 at 11:55

0 Answers0