应用程序如何知道组件是一个页面 [英] How does the app know a component is a page

查看:164
本文介绍了应用程序如何知道组件是一个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在不推荐使用 @Page 装饰器,应用程序如何区分应该用作页面一部分的组件和表示页面的组件你可以导航到?

Now that the @Page decorator had been deprecated, how does the app differentiate between a component that should be used as part of a page and a component that represents a page you can navigate to?

唯一的区别是我看到页面组件没有中定义的选择器属性组件装饰器。

The only difference I see that page components have no selector property defined in the @Component decorator.

推荐答案

如果组件被推送到导航控制器的堆栈。

A component is considered to be a page if it's pushed to the navigation controller's stack.

选择器属性是可选的core / index / ComponentMetadata-class.htmlrel =nofollow> Angular2组件。当你想在另一个组件的模板中使用组件作为HTML元素时,你只需要它。

A selector property is optional in an Angular2 component. You only need it when you want to use the component as an HTML element in the template of another component.

我认为原因是 @Page 已被弃用,首先两者之间没有那么大的区别。

I think the reason @Page was deprecated, is that there wasn't so much difference between the two in the first place.

这篇关于应用程序如何知道组件是一个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆