Angular2 using @Inputs with s

前端 未结 4 944
我寻月下人不归
我寻月下人不归 2020-12-03 04:40

I have a sub-navigation in my page that displays some subviews below a common main view. I would like to pass an object to the subviews through the

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-03 05:04

    I think the proper Angular2 way to be passing data is via Dependency Injections (by using a Service) otherwise the user will be able to see the data you're passing in the browser's URL.

    Also, using a Service will allow for "Separation of Concerns", meaning that Component A shouldn't be dependent on Component B.

    Dependency Injection Links:

    1) https://angular.io/guide/dependency-injection

    2) https://angular.io/guide/dependency-injection-in-action

    3) https://www.youtube.com/watch?v=MJrw43GP2u0

提交回复
热议问题