How to convert Bootstrap HTML Theme into angularJS template

Angularjs is very popular front-end application, now days each web application has two separate layer instead of single application.Separate layer means one front-end application which is created on backbone,angularjs etc and other one back-end application, which is created on server-side languages like php,java,.net and ruby etc.

In this post we will learn how to convert simple HTML template into angularjs application.I am converting Bootstrap HTML template into angular application using partial layout functionality.I am taking Gentellela Admin Bootstrap Devops theme.
Gentellela Admin is a free to use Bootstrap admin template. This template uses the default Bootstrap 3 styles along with a variety of powerful jQuery plugins and tools to create a powerful framework for creating admin panels or back-end dashboards.

I will use ui-route angular module to create partials view and render layout file based on route url.

Angular application structure

  • app : This folder will contain angular all modules and services and views.
  • app/config : This folder will contain configuration angular file.
  • app/testservice : This folder will contain your modules file including controller,views etc.
  • app/layout : This folder will contain all layout partial files.
  • assets : This folder will contain all css,fonts and js files.

You can also check other tutorial of angular,

We will create separate partial HTML template from single BOOtstrap HTML template like below,

Angular layout application structure

  • header.html : This file will contain html template header part.
  • sidebar.html : This file will contain html template sidebar part.
  • footer.html : This file will contain html template footer part.
  • layout.html : This file will use to include above partial files and create layout template which will render on each angular request.

Source code of layout.html file

You can see above code, i am using ng-view directive to include partial HTML files and defined controller for each files using ng-controller.
layout.html file create whole theme template page using partials html files.

Since i am using ui-route modules for routing angular application so i will call stateprovider method to set state and call all partial HTML files.

I hope its help you.

Conclusion :

This post help to create layout of your angular application using partial HTML files.Its like other back-end framework which are providing layout functionality, so using this angular tutorial You can easily convert bootstrap HTML template into angular layout.

Demo of convert HTML theme into angularJS template