Choose any sample angular application or create using the twitter Bootstrap styling framework which is very easy for building an application and gives a good look for the page. This chapter explains creating a template for
product list view for a sample application in the created directory i.e.
SPLessons.
If one want to add an external template for the Product List Component. By convention each feature of the application has its own folder under the
app folder. So, create a new folder under the app folder and name it as
product as shown in the image below.
In that folder, create the template for our Product List Component. By convention, the name of the template is the same name as the component with an HTML extension. So, call the Product List Component as
product-list.component.html. as shown in the image below.
Create building the template using HTML in the file as shown in the below code.
product-list.component.html
[html]
<div class='panel panel-primary'>
<div class='panel-heading'>
Product List
</div>
<div class='panel-body'>
<div class='row'>
<div class='col-md-2'>Filter by:</div>
<div class='col-md-4'>
<input type='text' />
</div>
</div>
<div class ='row'>
<div class='col-md-6'>
<h3>Filtered by: </h3>
</div>
</div>
<div class='table-responsive'>
<table class='table'>
<thead>
<tr>
<th>
<button class='btn btn-success'>
Show Image
</button>
</th>
<th>Product</th>
<th>Code</th>
<th>Available</th>
<th>Price</th>
<th>5 Star Rating</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
[/html]
In the above code the Twitter Bootstrap style classes are used to display the content in a panel and the
product list is displayed in the heading and is displayed as the
panel heading.
Next is the
filter by. An input box for entry of the filter string is defined. And added text that displays the user entered filter. And is done using the Twitter Bootstrap style classes to lay out the input box and text into rows.
Now the table. Used Twitter Bootstrap's table style classes. Which contain a table header. The first column header is a button to show the product image.