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 摘要。