> For the complete documentation index, see [llms.txt](https://brianwu.gitbook.io/brian/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://brianwu.gitbook.io/brian/angular/build-and-conponect.md).

# Build & Conponect

利用 IntelliJ & Angular CLI 建立 angular project Type Script

在 template 用的東西 不要用 `<form>` 那是另外一個後面章節會講的東西

不要用 `<script>` 要寫應該寫到 conponent，不要在 template 寫

## 控制流程，可以判斷是否 顯示、重複 宿主元素

\*NgIf \*NgFor NgSwitch

### NgFor

使用NgFor時，有幾個變數可以用 index first last even (目前的index 是否為偶數筆) odd (目前的index 是否為基數筆)

```
//使用方式
*ngFor = let item of items

item.first;

---
//參考資料:(https://coryrylan.com/blog/angular-ng-for-syntax)
<ul>
  <li *ngFor="let item of items; let i = index">
    {{i}} {{item}}
  </li>
</ul>
```

\[] 輸出綁定 () 輸入綁定 \[()] 雙向綁定 ngModel 雙向綁定
