Sunday, January 28, 2018

Angular, html template hack

Hack: 
To place a void returning function call into a html template one can put it into an || block with another function as it will evaluate to false and cause the other function to execute as if it stood alone.

Solution: 

Use an attribute selector.

{{console.log('text') || doSth()}}

Tuesday, November 28, 2017

Angular, prevent component html tag

Problem: 
Angular components each create their own custom tag in the HTML structure. This can prevent HTML tables from aligning correctly if a custom component element gets placed encapsulating table row elements inside a table element.

Solution: 

Use an attribute selector.

@Component({ selector: 'my-component',

Source(s):
https://stackoverflow.com/questions/34588933/how-to-remove-replace-the-angular2-components-selector-tag-from-html

Friday, November 24, 2017

Wednesday, November 22, 2017

Material Design in Angular, overriding specific css

Problem: 
Angular Material Design button greys out as a hover effect. Standard css override failed.

Solution: 

Adding '/deep/' to the css definition.

.header-container /deep/ .mat-button-focus-overlay{
  background-color:transparent;}

Source(s):
https://stackoverflow.com/questions/44342158/how-can-i-change-angular-material-button-background-color-on-hover-state