In this post we are having a look at GitHub actions and GitHub pages to build, deploy and host your static web app. Also, we are having a look at the DNS configurations to make your app available under a custom domain name. The best thing is that all of this comes for free and you only have to pay for your domain name. The result of this blogpost ist a custom subdomain (in my case http://github-deploy.zarg.es/) that links to your GitHub page which will be updated automatically when pushing changes to the main branch.

You can have a look…


A problem of generic structural directive is that we loose the type information. Unlike our typescript code we can not pass the generic type info in the html template. This article discusses an approach how to keep the type information.

In my last blog article I wrote an introduction to structural directives. This blogpost builds upon the knowledge we learned there.

In a structural directive we can receive content in order to use it in our projected template.

<div *appFoo="let bar">{{bar}}</div>

The structural directive would provide the context and by using $implicit the content becomes available. In this case it is a hard coded string ‘Hello World’.

@Directive({selector: 'appFoo'})
export class FooDirective implements OnInit {
constructor(private viewContainer: ViewContainerRef,
private templateRef: TemplateRef<{$implicit: string}>{
}

ngOnInit(){
this.viewContainer
.createEmbeddedView(
this.templateRef,
{$implicit: 'Hello World'})
}
}

TemplateRefis a generic class. The generic type that…


This blogpost demonstrates different approaches how to build re-usable components with a simple example. This is a two part blogpost. In the second part it is getting more advanced and we have a look how to utilise structural directives to build a re-usable options button component with a simple interface.

An important part of building scaleable web applications, is creating your own toolbox of re-usable components.
However, building re-usable components is not always easy because they might have to fit different requirements.

The more flexible a component is, the more requirements it can support. Of course, before extending an existing component with new functionality, one has to always think about whether the functionality makes sense for that component or whether it shall rather be a new component for itself.

For a better understanding let us have a look at the following example.

Product management is asking us to replace the native…


In this part we take a look at structural directives and how we can use them to build even more generic components. In the first part we discussed other approaches to build a re-usable component.

A structural directive is defined like any other directive but with one major difference: In the constructor TemplateRefand/or ViewContainerRef is injected.

TemplateRef allows to access the projected DOM content of the element where the structural directive is applied on, whereas ViewContainerRef is the service that allows to render any given templateRef.

As soon as TemplateRef and/or ViewContainerRef is injected into the constructor the directive becomes a structural directive.
This also changes how the directive is applied on an element: A structural directive can be applied only on ng-templa elements or the asterix notation has to be used.

You…

Alexander Zarges

I'm a PWA developer with 7+ years of Angular experience. During the day I develop the WebApp for an IOT business application, during the night I work on aux.app

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store