We can display an html table as a grid using bootstrap css class.
In this example we have a simple structure of the html table using boostrap css class without data
<div class="panel panel-primary"> <div class="panel-heading"> Product Listing </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='table-responsive'> <table class='table'>
<thead> <tr> <th> <button class='btn btn-primary'> Show Image </button> </th> <th>Product</th> <th>Code</th> <th>Available</th> <th>Price</th> <th>5 Star Rating</th> </tr>
</thead>
<tbody>
<tr> <td></td></tr> <tr> <td></td></tr> </tbody> </table> </div> </div> </div>
HTML
- In this code snippet Image is shown based on the toggle properties of the object
- Object.name is displayed in each td
<div class="panel panel-primary"> <div class="panel-heading"> {{pageTitle}} </div> <div class='panel-body'> <div class='row'> <div class='col-md-2'>Filter by:</div> <div class='col-md-4'><input type='text'[(ngModel)]='listFilter'/></div> </div> <div class='row'> <div class='col-md-6'> <h3>Filter by:{{listFilter}}</h3> </div> </div> <div class='table-responsive'> <table class='table' *ngIf='products && products.length' > <thead> <tr> <th> <button class='btn btn-primary' (click)='toggleImage()'> {{ showImage ? "Hide Image": "Show Image" }} </button> </th> <th>Product</th> <th>Code</th> <th>Available</th> <th>Price</th> <th>5 Star Rating</th> </tr> <thead> <tbody> <tr *ngFor='let product of products'> <td ><img *ngIf='showImage' [src]='product.imageUrl' [title]='product.productname' [style.width.px]='imageWidth' [style.margin.px]='imageMargin' > </td> <td>{{product.productName}}</td> <td>{{product.productCode| lowercase}}</td> <td>{{product.releaseDate |date}}</td> <td>{{product.price | currency:'USD':true:'1.2-2'}}</td> <td>{{product.starRating}}</td> </tr> </tbody> </table> </div> </div> </div>
Component
Here we are creating a ProductList component.The array of object is mocked for demo purpose.
import {Component} from '@angular/core'; //view for the component @Component({ selector:'pm-products', templateUrl:'app/products/product-list.component.html' }) //class export class ProductListComponent{ pageTitle:string='Product List'; products:any[]=[ { "productId": 1, "productName": "Leaf Rake", "productCode": "GDN-0011", "releaseDate": "March 19, 2016", "description": "Leaf rake with 48-inch wooden handle.", "price": 19.95, "starRating": 3.2, "imageUrl": "http://openclipart.org/image/300px/svg_to_png/26215/Anonymous_Leaf_Rake.png" }, { "productId": 2, "productName": "Garden Cart", "productCode": "GDN-0023", "releaseDate": "March 18, 2016", "description": "15 gallon capacity rolling garden cart", "price": 32.99, "starRating": 4.2, "imageUrl": "http://openclipart.org/image/300px/svg_to_png/58471/garden_cart.png" } ]; }
Nice blog!! Hope you share more infor like this!!
ReplyDeleteDOT NET Training in Chennai
Hadoop Training in Chennai
SEO Training in Chennai
Selenium Training in Chennai
JAVA Training in Chennai
German Classes in chennai
Best Android Training institute in Chennai
Android Training Institutes in Chennai
I read the post and I have really enjoyed your blogs posts. Looking for the next post.
ReplyDeleteAviation Academy in Chennai
Air hostess training in Chennai
Airport management courses in Chennai
Ground staff training in Chennai
aviation institute in Chennai
Air Hostess Training Institute in Chennai
Airline Courses in Chennai
airport ground staff training in Chennai
Great blog!!! thanks for sharing with us... Waiting for your upcoming post...
ReplyDeletebig data courses in bangalore
hadoop training institutes in bangalore
Hadoop Training in Bangalore
Data Science Courses in Bangalore
CCNA Course in Madurai
Digital Marketing Training in Coimbatore
Digital Marketing Course in Coimbatore
Awesome blog with lots of information. It is really helpful for all.
ReplyDeleteAngularJS Training in Chennai
AngularJS course in Chennai
Angular 6 Training in Chennai
ReactJS Training in Chennai
PHP Training in Chennai
Web Designing course in Chennai
Tally course in Chennai
AngularJS Training in Velachery
AngularJS Training in T Nagar
AngularJS Training in OMR
Great collection and thanks for sharing this info with us. Waiting for more like this.
ReplyDeleteBest AngularJS Training in Chennai
Angularjs Training institute in Chennai
AngularJS Training in Chennai
Angular 2 Training in Chennai
Angular 7 Training in Chennai
PHP Training in Chennai
Web Designing course in Chennai
AngularJS Training in Porur
AngularJS Training in Tambaram
AngularJS Training in Adyar
ReplyDeletevery intersting to read your blog and it makes the viewers to visit your blog and keep on updating.
Software Testing Training in Chennai
Software Testing Training in Bangalore
Software Testing Training in Coimbatore
Software Testing Training in Madurai
Best Software Testing Institute in Bangalore
Software Testing Course in Bangalore
Software Testing Training Institute in Bangalore
Selenium Course in Bangalore
Awesome read , I am going to spend more time learning about this subject new york website design company
ReplyDeleteYoure so cool! I dont suppose Ive learn anything like this before. So good to search out someone with some authentic ideas on this subject. realy thank you for beginning this up. this web site is one thing that’s needed on the web, someone with somewhat originality. useful job for bringing something new to the internet! branding san francisco
ReplyDeleteThanks for helping out, superb info . brand identity design agency
ReplyDeleteIt is truly a well-researched content and excellent wording. I got so engaged in this material that I couldn’t wait to read. Read more info about angular agency
ReplyDeleteWell written and insightful blog, Wording is easy to understand by anyone. Thanks for sharing.
ReplyDeleteCross Platform App Development