没有合适的资源?快使用搜索试试~ 我知道了~
首页Angular in Action 无水印原版pdf
资源详情
资源评论
资源推荐
MANNING
Jeremy Wilken
Communicating between Angular components
Angular applications are based around components that communicate with one
another. You pass data into a child component using inputs and can emit events up
to a parent component that shares data. This is essentially the way that normal HTML
elements behave, which makes Angular easy to understand and learn.
The gure below shows the structure of an example application used in chapter 5: It’s
composed of a tree of components, much like what you see when creating HTML docu-
ments. The Dashboard component has four child components: two instances of the Metric
component and two of the Nodes component. The Dashboard component contains data,
which it passes to each of its children using an input binding, which is how Angular shares
data from a parent to a child component. In addition to sharing this data, Angular also
keeps track of data changes and understands when to redraw the screen.
App
component
#dashboard
[cpu]
(onRefresh)
Navbar
component
Dashboard
component
Nodes Row
component
Nodes Row
component
Nodes Row
component
Nodes Row
component
Nodes Row
component
Nodes Row
component
[mem] [cluster1]
[cluster2]
Metric
component
Nodes
component
Nodes
component
Metric
component
Key:
[Input bindings]
(Emit output events)
#Local template variable
[node] [node] [node] [node] [node] [node]
Inputs let us send data from a parent to a child, but outputs allow data to ow in the
other direction. Similar to how events bubble up to their parent, outputs are Angular’s
syntax for allowing a child to pass data or events back to its parent. In the gure, the
Navbar component sends an output event to the App component. The App compo-
nent waits until an output event is red and then reacts accordingly. In this example,
the App component refreshes the data on the page, but you can trigger any type of
logic to execute. Angular provides other ways to communicate, such as using services
or local template variables, which are covered in detail in this book.
Angular in Action
JEREMY WILKEN
MANNING
Shelter ISland
For online information and ordering of this and other Manning books, please visit www.manning.com.
The publisher offers discounts on this book when ordered in quantity. For more information, please
contact
Special Sales Department
Manning Publications Co.
20 Baldwin Road
PO Box 761
Shelter Island, NY 11964
Email: orders@manning.com
©2018 by Manning Publications Co. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form
or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the
publisher.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed
as trademarks. Where those designations appear in the book, and Manning Publications was aware of a
trademark claim, the designations have been printed in initial caps or all caps.
Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books
we publish printed on acid- free paper, and we exert our best efforts to that end. Recognizing also our
responsibility to conserve the resources of our planet, Manning books are printed on paper that is at
least 15 percent recycled and processed without the use of elemental chlorine.
∞
Manning Publications Co.
20 Baldwin Road
PO Box 761
Shelter Island, NY 11964
Development editors: Cynthia Kane, Helen Stergius
Review editor: Ivan Martinovic´
Technical development editor: Alain Couniot
Project editor: Kevin Sullivan
Copyeditor: Corbin Collins
Proofreader: Alyson Brener
Technical proofreader: Tanya Wilke
Typesetter: Happenstance Type- O-Rama
Cover designer: Marija Tudor
ISBN 9781617293313
Printed in the United States
1 2 3 4 5 6 7 8 9 10 - EBM - 23 22 21 20 19 18
To my parents, who gave me great encouragement, support, and latitude to become
what I am today.
剩余320页未读,继续阅读
yinkaisheng-nj
- 粉丝: 763
- 资源: 6952
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- zigbee-cluster-library-specification
- JSBSim Reference Manual
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论4