日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Angular应用的路由指令RouterLink

發(fā)布時間:2023/12/19 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Angular应用的路由指令RouterLink 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

Angular應用的路由指令RouterLinkapp Component html源代碼:

<h1>{{title}}</h1> <nav><a routerLink="/heroes">Heroes</a></nav> <router-outlet></router-outlet> <app-messages></app-messages>

A routerLink attribute is set to “/heroes”, the string that the router matches to the route to HeroesComponent. The routerLink is the selector for the RouterLink directive that turns user clicks into router navigations. It’s another of the public directives in the RouterModule.

HTML原生標簽a的屬性routerlLink,是RouterLink指令的選擇器,將用戶點擊轉(zhuǎn)換成navigation. RouterLink是RouterModule里的公有指令。

運行時效果:點擊了超鏈接后,會跳轉(zhuǎn)到localhost:4200/heroes:


RouterLink is an inbuilt Angular Directive that lets you link to specific routes in your app. In a SPA(single-page application), you change what the user sees by showing or hiding portions of the display that correspond to particular components, rather than going out to the server to get a new page.

RouterLink 是一個內(nèi)置的 Angular 指令,可讓您鏈接到應用程序中的特定路由。 在 SPA(單頁應用程序)中,您可以通過顯示或隱藏與特定組件對應的顯示部分來更改用戶看到的內(nèi)容,而不是前往服務器獲取新頁面。

RouterModule provides RouterLink directive in Angular. The RouterModule adds router directives and providers. RouterLink lets us link to the specific routes in our angular application.

RouterModule 在 Angular 中提供 RouterLink 指令。 RouterModule 添加路由器指令和提供程序。 RouterLink 允許我們鏈接到我們的 angular 應用程序中的特定路由。

When applied to an element in a template, makes that element a link that initiates navigation to a route. Navigation opens one or more routed components in one or more locations on the page.

當應用于模板中的元素時,使該元素成為啟動導航到路線的鏈接。 導航會在頁面上的一個或多個 <router-outlet> 位置打開一個或多個路由組件。

更多Jerry的原創(chuàng)文章,盡在:“汪子熙”:

總結

以上是生活随笔為你收集整理的Angular应用的路由指令RouterLink的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。