To generate a Bootstrap div in TypeScript, you can use the following code:
index.ts391 chars17 lines
This code imports the Component
decorator from Angular core, defines a new component called BootstrapDivComponent
, and sets its template to an HTML code that defines a Bootstrap container, row, and two columns. The col-md-6
class sets the width of each column to be half of the container, and h1
and p
tags are used to display the heading and text.
To use this component in your TypeScript application, you can add it to the declarations
array of your app module:
index.ts317 chars11 lines
This code imports NgModule
and BrowserModule
from Angular core, defines a new module called AppModule
, and adds BootstrapDivComponent
to the declarations
array. It also sets the bootstrap
property to BootstrapDivComponent
, which means that this component will be the main component of the application. Finally, AppModule
is exported so that it can be used in other parts of the application.
gistlibby LogSnag