angular-ui / angular-ui/ui-router

Access states' custom data-object in component

未關閉
#3,845 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
TypeScript
星號
13.4k
分支
2.9k
PR 合併指標
30 天內沒有已合併 PR

描述

This issue tracker is for Bug Reports and Feature Requests only.

Please direct requests for help to StackOverflow.
See http://bit.ly/UIR-SOF for details.

This is a (check one box):

- [ ] Bug Report
- [ ] Feature Request
- [x ] General Query

My version of UI-Router is: 9.1.0

# General Query
Im migrating an AngularJS-App with ui-router to Angular 12 with ui-router 2 and trying to find out how I can access custom data-objects I define in a state.

State:
export const homeState = {
name: 'layout.home',
url: '/home',
component: CwpHomePageComponent,
data: {
title: 'Startseite'
}
};

How would I now access the data-object which contains the page title? In AngularJS we used $state.current.data but for ui-router 2 it says "current" is deprecated... What is the recommended solution now? Cant find anything in the docs...

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。