Themes are very useful and save a lot of our time while designing and making the site responsive. Here, we will learn to implement them in an Angular 7 app.
First of all, download the latest version of AdminLTE theme or whatever theme you prefer. For AdminLTE, you can get the latest version from
here.
Create a new project in Angular 7 by typing the following command.
Once the project is created, open it and create various components
like sidebar, menubar, etc. by typing the following commands.
- ng g c theme-header
- ng g c theme-menu
- ng g c theme-footer
- ng g c theme-setting
- ng g c dashboard
Open the zip file from the download location and copy
the following files in the assets folder for your Angular application.
It should be present here.
Open the index.html file and add the following code in it. We have to
add the CSS and JS files for all the pages here which we are going to
use.
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>ThemeIntegrationAngular7</title>
- <base href="/">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="icon" type="image/x-icon" href="favicon.ico">
- <link rel="stylesheet" href="assets/bower_components/bootstrap/dist/css/bootstrap.min.css">
- <link rel="stylesheet" href="assets/bower_components/font-awesome/css/font-awesome.min.css">
- <link rel="stylesheet" href="assets/bower_components/Ionicons/css/ionicons.min.css">
- <link rel="stylesheet" href="assets/dist/css/AdminLTE.min.css">
- <link rel="stylesheet" href="assets/dist/css/skins/_all-skins.min.css">
- </head>
- <body class="hold-transition skin-blue fixed sidebar-mini">
- <app-root>
- <div class="wrapper"></div>
- </app-root>
- <script src="assets/bower_components/jquery/dist/jquery.min.js"></script>
- <script src="assets/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
- <script src="assets/bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
- <script src="assets/bower_components/fastclick/lib/fastclick.js"></script>
- <script src="assets/dist/js/adminlte.min.js"></script>
- <script src="assets/dist/js/demo.js"></script>
- </body>
- </html>
Open the theme-header.component.html file and add the following code in it.
Open the theme-menu.component.html file and add the following code in it.
Open the theme-footer.component.html file and add the following code in it.
- <footer class="main-footer">
- <div class="pull-right hidden-xs">
- <b>Version</b> 2.4.13
- </div>
- <strong>Copyright © 2014-2019 <a href="https://adminlte.io">AdminLTE</a>.</strong> All rights
- reserved.
- </footer>
Open the theme-setting.component.html file and add the following code in it.
Open the app.component.html file and add the following code in it.
- <app-theme-header></app-theme-header>
- <app-theme-menu></app-theme-menu>
- <app-dashboard></app-dashboard>
- <router-outlet></router-outlet>
- <app-theme-footer></app-theme-footer>
- <app-theme-setting></app-theme-setting>
Open the dashboard.component.html file and add the following code in it.
- <div class="content-wrapper">
- <!-- Content Header (Page header) -->
- <section class="content-header">
- <h1>
- Fixed Layout
- <small>Blank example to the fixed layout</small>
- </h1>
- <ol class="breadcrumb">
- <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
- <li><a href="#">Layout</a></li>
- <li class="active">Fixed</li>
- </ol>
- </section>
- <!-- Main content -->
- <section class="content">
- <div class="callout callout-info">
- <h4>Tip!</h4>
- <p>Add the fixed class to the body tag to get this layout. The fixed layout is your best option if your sidebar
- is bigger than your content because it prevents extra unwanted scrolling.</p>
- </div>
- <!-- Default box -->
- <div class="box">
- <div class="box-header with-border">
- <h3 class="box-title">Title</h3>
- <div class="box-tools pull-right">
- <button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
- <i class="fa fa-minus"></i></button>
- <button type="button" class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove">
- <i class="fa fa-times"></i></button>
- </div>
- </div>
- <div class="box-body">
- Start creating your amazing application!
- </div>
- <!-- /.box-body -->
- <div class="box-footer">
- Footer
- </div>
- <!-- /.box-footer-->
- </div>
- <!-- /.box -->
- </section>
- <!-- /.content -->
- </div>
- <router-outlet></router-outlet>
That’s it. Run the application by typing the
ng serve command.
Please give your valuable feedback/comments/questions about this article. Please let me know how you like and understand this article and
how I could improve it.