-
Create an Angular demo project
When learning Angular or any other framework or we have an idea, we want to quickly create a proof of concept. One way is quickly to quickly go to a online editor, such stackblitz, codepen, and start coding a demo project, then show case to other people of your code. But the problem is that, we quickly forget about the url of the projects, the more we create and the more we forget. So I built a project to serve as container of all demo projects. Here is what you need to do if you want to create new demo.
-
Angular component field initialization
In my previous post, I talked about Class field initialization in typescript. How about field initialization of angular component, is it different? Angular component is defined an typescript class. It should follow same logics. However, Angular component has life cycle. The ngOnInit is special method that angular will run angular first displays the data-bound properties and sets the directive or component's input properties. So if your initialization code depends on these data-bound proprties and input properties, you can not run them in constructor. So the following code doesn't work
-
Please your library user with typescript generic
In typescript, generic is a tool that api/library author to please its consumer. What does this means.
-
Class field initialization in typescript
In typescript class, you can define your field initialization in multiple ways. Here is one typical way to do that.
-
A JavaScript interview question which can be fixed by 'let'
A very popular JavaScript interview question on Lexical scope and closure is like the follow.