Skip to main content

Posts

Showing posts from February, 2017

Implement CORS Filter Using Springboot

Springboot CORS implementatin in Application.java Add below piece of code in your Application.java of your spring boot project


 import org.springframework.boot.context.embedded.FilterRegistrationBean; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.filter.CorsFilter;

 @Bean
 public FilterRegistrationBean corsFilter()
 {

 UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();      CorsConfiguration config = new CorsConfiguration();
 config.setAllowCredentials(true);
 config.addAllowedOrigin("*");
 config.addAllowedHeader("Content-Type");
 config.addAllowedMethod("OPTIONS");
 config.addAllowedMethod("GET");
 config.addAllowedMethod("PUT");
 config.addAllowedMethod("POST");
 config.addAllowedMethod("DELETE");
 source.registerCorsConfiguration("/**", config);
 FilterRegi…

How To Remove Unwanted Div Tags In HTML

Problem Statement :

Html code having unnecessary div tags due to html for loop ,so there is some  invisible empty div's

Solution : By using HTML TemplateBefore Code :
<ul class="items"> <div *ngFor="let config of configs">   <div *ngFor="let group of groups.groups  | objectToArray"><div *ngIf="config.Group==group"><li (click)="onSelect(group,config.Client)">  <span class="badge">{{ group}}</span></li></div>   </div> </div></ul>After Code :  <div class="grid grid-pad"><template ngFor let-config[ngForOf]="configs"> <template  ngFor let-group [ngForOf]= "groups.groups  | objectToArray"> <template [ngIf]="config.Group==group">  <a [routerLink]="['/search',config.Client,group]"  class="col-1-4"><div class="module group">  <h4>{{group}}<…

Primeng Datatable Header Issue And Solution

Primeng Datatable  Header Is Not Working :

 p-header Not working: 

Primeng data table header is not working while using <p-header>List of Cars</p-header>Solution : in component.ts file you have to import import {Header} from 'primeng/primeng'; in html page you have to add .Thats it will work fine .  <header>List of Cars</header> still your primeng datatable header is not working ? Then update your primeng version using the node  command npm install primeng --save