HostBindings

https://www.thecodecampus.de/blog/angular-2-use-hostbindings-set-class/
And I played a little bit with it in the sandbox,  it seems it can not only bind to class (class itself is just an attr) but also can bind a boolean value to a specific class as a switch.  And it can bind to any customized attribute.
https://stackblitz.com/edit/angular-playground-325-fn6rkg?file=app%2Fbox%2Fbox.component.ts

in case forget about the syntax of using ampersand (&) in pseudo-class :host in sass/scss
here is the reference:
https://css-tricks.com/the-sass-ampersand/

Quick notes for angular refactoring

recently having to refactor a complex component in angular, some experience I think could be beneficial  for the future, so take a note here:

  1. Bind child component’s property directly
  2. If not direct binding, then use viewmodel method to bind (easier to unit test also)
  3. Smuggle some simple logic in the mark up to avoid testing.
  4. Reference to child component with interface to achieve polymorphism
  5. Use [hidden] to avoid the

Expression has changed after it was checked

From <https://blog.angular-university.io/angular-debugging/>

Or set binding value after delay()

      6. service class can return observable, can be piped and subscribed, but inside component we can convert toPromise() and do async/await for better readability, catch exception and return null for the promise<T>.

Javascript(ECMAScript 2015)中的构造和解构,以及Rest/Spread properties

下面的链接里有多种非常灵活的用法,体现了javascript这种语言的简洁性(但是也给人感觉在简单的语法中暗藏了很多后台的实现要掌握)

这也是基于javascript的原型系统,对象本身就是个集合的特点,以及作为解释型语言,不需要有编译阶段确定属性的地址,于是这个集合就可以被灵活的操纵。如果c#作为静态语言能够嵌入一些动态脚本scope,在Scope的出入口可以传递dynamic 对象,会更美好。

构造: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer

解构:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment

… 语法:https://github.com/tc39/proposal-object-rest-spread

缘起:本来是看Angular这个框架的,结果这篇文章把原始avascript的版本也也拿出来对比了一下,JS版本的UI的layout设计不太直观,但功能真的足够强。https://www.carloscaballero.io/understanding-mvc-services-for-frontend-angular/