<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                本小節,讓我們完成klass模塊中組件間的對接工作,以及較驗前后臺的對接效果。 # 組件對接 ### 增加新增班級鏈接 klass/index/index.component.html ``` <a routerLink="./add">新增班級</a> ? <form (ngSubmit)="onQuery()"> ``` **注意:** 是`./add`而不能是`/add`。 #### 測試 ![](https://img.kancloud.cn/c7/9d/c79d28161bda927b9317be3041515558_251x104.png) ### 新建后跳轉到首頁 klass/add/add.component.ts ```js constructor(private httpClient: HttpClient, private router: Router, ① private route: ActivatedRoute ①) { } onSubmit(): void { const url = 'http://localhost:8080/Klass'; const klass = new Klass(undefined, this.name.value, new Teacher(parseInt(this.teacherId.value, 10), undefined, undefined) ); this.httpClient.post(url, klass) .subscribe(() => { console.log('保存成功'); this.router.navigate([''], {relativeTo: this.route}); ? }, (response) => { console.log(`向${url}發起的post請求發生錯誤` + response); this.setMessage(AddComponent.errorMessage); }); } ``` 我們重新啟動后臺,并進行前后臺對接測試: ![](https://img.kancloud.cn/d1/53/d153ca80cc35653f0793701f3b2b982c_401x380.gif) 由于前面在單元測試中我們已經下足了功夫,所以此次測試結果完美 ?? # 參考文檔 | 名稱 | 鏈接 | 預計學習時長(分) | | --- | --- | --- | | 源碼地址 | [https://github.com/mengyunzhi/spring-boot-and-angular-guild/releases/tag/step3.3.7](https://github.com/mengyunzhi/spring-boot-and-angular-guild/releases/tag/step3.3.7) | - | | 相對導航 | [https://www.angular.cn/guide/router#relative-navigation](https://www.angular.cn/guide/router#relative-navigation) | 5 |
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看