/
index.html
698 lines (542 loc) · 29.9 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="Description" content="Ember.js的中文开发者交流平台,提供Ember.js官方网站指南和API的中文翻译,持续关注最近的社区动态,为您提供高质量的Ember.js中文资料。 " />
<meta name="Keywords" content="Ember.js、Ember、Javascript、Javascript框架、HTML、论坛、博客、中文社区" />
<title>Ember.js - 核心概念</title>
<link rel="shortcut icon" href="/images/favicon.png" />
<!--[if lte IE 7 ]><link href="/stylesheets/fonts/fontello-ie7.css" media="screen" rel="stylesheet" type="text/css" /><![endif]-->
<link href="/stylesheets/site.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/highlight.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/emberjs-cn.css" media="screen" rel="stylesheet" type="text/css" />
<link href="http://emberjs.cn/blog/feed.xml" rel="alternate" type="application/atom+xml" title="Ember.js CN - 博客" />
<script type="text/javascript">
var _gaq = _gaq || [];
var pluginUrl = '//www.google-analytics.com/plugins/ga/inpage_linkid.js';
_gaq.push(['_require', 'inpage_linkid', pluginUrl]);
_gaq.push(['_setAccount', 'UA-38578402-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<!--[if lt IE 9]>
<script type="text/javascript" src="/javascripts/common-old-ie.js"></script>
<![endif]-->
<!--[if gte IE 9]><!-->
<script type="text/javascript" src="/javascripts/common-modern.js"></script>
<!--<![endif]-->
<script type="text/javascript" src="/javascripts/guides.js"></script>
</head>
<body class="bilingual_guides bilingual_guides_concepts bilingual_guides_concepts_core-concepts bilingual_guides_concepts_core-concepts_index">
<div id="header">
<div id="wrapper">
<a id="logo" href="/"> </a>
<ul id="nav">
<li><a href="/guides">指南</a></li>
<li><a href="/blog">博客</a></li>
<li>
<a target="_blank" href="http://discuss.emberjs.cn">论坛</a>
</li>
<li><a href="/builds">构建</a></li>
</ul>
<div id="github">
<a href="https://github.com/emberjs-cn"><img src="/images/fork-us.png">Fork Us!</a>
<a href="https://github.com/emberjs/ember.js"><img src="/images/fork-us.png">Fork Ember!</a>
</div>
</div>
</div>
<div id="content-wrapper">
<div id="sidebar">
<ol id="toc-list">
<li class="level-1">
<a href="/bilingual_guides/getting-started">入门指南</a>
<ol>
<li class="level-3">
<a href="/bilingual_guides/getting-started">介绍</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/planning-the-application">应用规划</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/creating-a-static-mockup">创建静态页面</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/obtaining-emberjs-and-dependencies">获取Ember.js和相应依赖</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/adding-a-route-and-template">添加第一个路由与模板</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/modeling-data">建立模型</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/using-fixtures">使用静态数据</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/displaying-model-data">显示模型数据</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/displaying-a-models-completeness">显示模型的完成状态</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/creating-a-new-model">创建新的模型实例</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/marking-a-model-as-complete-incomplete">标记模型为完成或未完成</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/displaying-the-number-of-incomplete-todos">显示未完成待办事项的数量</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/toggle-todo-editing-state">切换显示和编辑状态</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/accepting-edits">接受修改</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/deleting-todos">删除模型</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/adding-child-routes">添加子路由</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/show-only-incomplete-todos">显示未完成待办事项</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/show-only-complete-todos">显示已完成待办事项</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/show-all-todos-again">显示所有待办事项</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/display-a-button-to-remove-completed-todos">添加移除所有已完成待办事项的按钮</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/show-when-all-todos-are-complete">提示所有待办事项已完成</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/toggle-all-todos">切换已完成和未完成待办事项</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/getting-started/using-other-adapters">更换FixtureAdapter</a>
</li>
</ol></li>
<li class="level-1 selected">
<a href="/bilingual_guides/concepts/core-concepts">概念</a>
<ol class='selected'>
<li class="level-3 sub-selected">
<a href="/bilingual_guides/concepts/core-concepts">核心概念</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/concepts/naming-conventions">命名惯例</a>
</li>
</ol></li>
<li class="level-1">
<a href="/bilingual_guides/object-model/classes-and-instances">对象模型</a>
<ol>
<li class="level-3">
<a href="/bilingual_guides/object-model/classes-and-instances">类与实例</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/object-model/computed-properties">计算属性</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/object-model/computed-properties-and-aggregate-data">计算属性和带@each的集合数据</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/object-model/observers">观察器</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/object-model/bindings">绑定</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/object-model/reopening-classes-and-instances">重新打开类和实例</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/object-model/what-do-i-use-when">绑定,观察器,计算属性:如何选择?</a>
</li>
</ol></li>
<li class="level-1">
<a href="/bilingual_guides/application">应用</a>
<ol>
<li class="level-3">
<a href="/bilingual_guides/application">介绍</a>
</li>
</ol></li>
<li class="level-1">
<a href="/bilingual_guides/templates/the-application-template">模板</a>
<ol>
<li class="level-3">
<a href="/bilingual_guides/templates/the-application-template">应用模板</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/templates/handlebars-basics">Handlebars基础</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/templates/conditionals">条件表达式</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/templates/displaying-a-list-of-items">显示项目列表</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/templates/changing-scope">切换作用域</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/templates/binding-element-attributes">绑定元素属性</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/templates/binding-element-class-names">绑定元素类名称</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/templates/links">链接</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/templates/actions">操作</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/templates/input-helpers">Input Helpers</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/templates/rendering-with-helpers">用助手来渲染</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/templates/writing-helpers">编写助手方法</a>
</li>
</ol></li>
<li class="level-1">
<a href="/bilingual_guides/routing">路由</a>
<ol>
<li class="level-3">
<a href="/bilingual_guides/routing">介绍</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/routing/defining-your-routes">定义路由</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/routing/generated-objects">生成的对象</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/routing/specifying-a-routes-model">指定路由的模型</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/routing/setting-up-a-controller">设置控制器</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/routing/rendering-a-template">渲染模板</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/routing/redirection">重定向</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/routing/specifying-the-location-api">指定地址API</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/routing/query-params">Query Parameters</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/routing/asynchronous-routing">Asynchronous Routing</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/routing/loading-and-error-substates">Loading / Error Substates</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/routing/preventing-and-retrying-transitions">Preventing and Retrying Transitions</a>
</li>
</ol></li>
<li class="level-1">
<a href="/bilingual_guides/components">组件</a>
<ol>
<li class="level-3">
<a href="/bilingual_guides/components">介绍</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/components/defining-a-component">定义组件</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/components/passing-properties-to-a-component">传递属性</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/components/wrapping-content-in-a-component">包裹内容</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/components/customizing-a-components-element">自定义组件元素</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/components/handling-user-interaction-with-actions">使用Action处理用户交互</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/components/sending-actions-from-components-to-your-application">Sending Actions from Components to Your Application</a>
</li>
</ol></li>
<li class="level-1">
<a href="/bilingual_guides/controllers">控制器</a>
<ol>
<li class="level-3">
<a href="/bilingual_guides/controllers">介绍</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/controllers/representing-a-single-model-with-objectcontroller">代表单一模型</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/controllers/representing-multiple-models-with-arraycontroller">代表多模型</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/controllers/dependencies-between-controllers">管理控制器间的依赖</a>
</li>
</ol></li>
<li class="level-1">
<a href="/bilingual_guides/models">模型</a>
<ol>
<li class="level-3">
<a href="/bilingual_guides/models">介绍</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/models/defining-models">定义模型</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/models/creating-and-deleting-records">创建和删除记录</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/models/pushing-records-into-the-store">将记录推入仓库</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/models/persisting-records">持久化记录</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/models/finding-records">查询记录</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/models/working-with-records">使用记录</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/models/connecting-to-an-http-server">连接HTTP服务器</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/models/handling-metadata">处理元数据</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/models/frequently-asked-questions">常见问题</a>
</li>
</ol></li>
<li class="level-1">
<a href="/bilingual_guides/views">视图</a>
<ol>
<li class="level-3">
<a href="/bilingual_guides/views">介绍</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/views/defining-a-view">定义视图</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/views/handling-events">处理事件</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/views/inserting-views-in-templates">在模板中插入视图</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/views/adding-layouts-to-views">为视图添加布局</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/views/customizing-a-views-element">自定义视图元素</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/views/built-in-views">内置视图</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/views/manually-managing-view-hierarchy">手动管理视图层级</a>
</li>
</ol></li>
<li class="level-1">
<a href="/bilingual_guides/enumerables">枚举</a>
<ol>
<li class="level-3">
<a href="/bilingual_guides/enumerables">介绍</a>
</li>
</ol></li>
<li class="level-1">
<a href="/bilingual_guides/testing/integration">测试</a>
<ol>
<li class="level-3">
<a href="/bilingual_guides/testing/integration">集成测试</a>
</li>
</ol></li>
<li class="level-1">
<a href="/bilingual_guides/configuring-ember/disabling-prototype-extensions">配置Ember.js</a>
<ol>
<li class="level-3">
<a href="/bilingual_guides/configuring-ember/disabling-prototype-extensions">禁用基本类型扩展</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/configuring-ember/embedding-applications">嵌入式应用</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/configuring-ember/feature-flags">特性标识</a>
</li>
</ol></li>
<li class="level-1">
<a href="/bilingual_guides/cookbook">Cookbook</a>
<ol>
<li class="level-3">
<a href="/bilingual_guides/cookbook">简介</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/cookbook/user_interface_and_interaction">用户界面与交互</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/cookbook/event_handling_and_data_binding">事件处理和数据绑定</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/cookbook/helpers_and_components">助手与组件</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/cookbook/working_with_objects">使用对象</a>
</li>
</ol></li>
<li class="level-1">
<a href="/bilingual_guides/understanding-ember/the-view-layer">理解Ember.js</a>
<ol>
<li class="level-3">
<a href="/bilingual_guides/understanding-ember/the-view-layer">视图层</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/understanding-ember/managing-asynchrony">管理异步</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/understanding-ember/keeping-templates-up-to-date">模板自动更新</a>
</li>
<li class="level-3">
<a href="/bilingual_guides/understanding-ember/debugging">调试</a>
</li>
</ol></li></ol>
<div id="back-to-top"><a id="back-top-top" href="#">⬆ 返回顶部</a></div>
</div>
<div id="content" class="has-sidebar">
<div class="chapter">
<h1>核心概念
<a href="https://github.com/emberjs-cn/www.emberjs.cn/tree/master/source/guides/concepts/core-concepts.md" target="_blank" class="edit-page">
编辑页面</a>
</h1>
<p>英文原文:<a href="http://emberjs.com/guides/concepts/core-concepts">http://emberjs.com/guides/concepts/core-concepts/</a></p>
<h2 class='anchorable-toc' id='toc_core-concepts'>核心概念(Core Concepts)</h2>
<p>To get started with Ember.js, there are a few core concepts you
should understand. </p>
<p>要开始学习Ember.js,首先要了解一些核心概念。</p>
<p>Ember.js is designed to help developers build ambitiously large web
applications that are competitive with native apps. Doing so requires
both new tools and a new vocabulary of concepts. We've spent a lot of
time borrowing ideas pioneered by native application frameworks like
Cocoa and Smalltalk.</p>
<p>Ember.js的设计目标是能帮助广大开发者构建能与本地应用相颦美的大型Web应用。要实现这个目标需要新的工具和新的概念。我们花了很大的功夫从Cocoa、Smalltalk等本地应用框架引入了其优秀的理念。</p>
<p>However, it's important to remember what makes the web special. Many
people think that something is a web application because it uses
technologies like HTML, CSS and JavaScript. In reality, these are just
implementation details.</p>
<p>然而,记住Web的特殊性非常重要。很多人认为一个应用是Web应用是因为其使用了像HTML、CSS和Javascript这些技术。实际上,这只是实现的细节问题。</p>
<p>Instead, <strong>the web derives its power from the ability to bookmark and
share URLs.</strong> URLs are the key feature that give web applications
superior shareability and collaboration. Today, most JavaScript
frameworks treat the URL as an afterthought, instead of the primary
reason for the web's success.</p>
<p>相反,<strong>Web应用是通过能收藏和分析链接来凸显它的作用的</strong>。URL是Web应用的一个最核心的特性,正是URL使得Web应用有了卓越的可共享性和可协作性。现今,很多Javascript框架都是时候才考虑URL,没有考虑这个让Web成功的主要因素。</p>
<p>Ember.js, therefore, marries the tools and concepts of native
GUI frameworks with support for the feature that makes the web so
powerful: the URL.</p>
<p>Ember.js将本地GUI框架中的工具和概念与使得Web应用如此强大的URL嫁接在一起。</p>
<h3 class='anchorable-toc' id='toc_concepts'>概念(Concepts)</h3><h4 class='anchorable-toc' id='toc_templates'>模板(Templates)</h4>
<p>A <strong>template</strong>, written in the Handlebars templating language, describes
the user interface of your application. Each template is backed by a
model, and the template automatically updates itself if the model
changes.</p>
<p>In addition to plain HTML, templates can contain:</p>
<p><strong>模板</strong>,用Handlebars模板语言来编写,它描述了一个应用程序的用户接口。每个模板背后都有一个模型,当模型发生改变时,模板将自动进行更新。</p>
<p>此外,相对于纯HTML,模板还提供了:</p>
<ul>
<li><p><strong>Expressions</strong>, like <code>{{firstName}}</code>, which take information from the template's model and put it into HTML.</p></li>
<li><p><strong>表达式</strong>, 例如 <code>{{firstName}}</code> ,
它从模板对应的模型获取信息并将信息添加到HTML中。</p></li>
<li><p><strong>Outlets</strong>, which are placeholders for other templates. As users
move around your app, different templates can be plugged into the
outlet by the router. You can put outlets into your template using the
<code>{{outlet}}</code> helper.</p></li>
<li><p><strong>出口(Outlets)</strong>, 它是其他模板的占位符。当用户使用应用时,不
同的模板会通过路由插入到出口中。你可以使用 <code>{{outlet}}</code> 助手将出口放到
模板中去。</p></li>
<li><p><strong>Components</strong>, custom HTML elements that you can use to clean up repetitive templates or create reusable controls.</p></li>
<li><p><strong>组件</strong>,自定义的HTML元素,可以用来清理重复的模板或创建可重用的控件。</p></li>
</ul>
<h4 class='anchorable-toc' id='toc_router'>路由器(Router)</h4>
<p>The <strong>router</strong> translates a URL into a series of nested templates, each
backed by a model. As the templates or models being shown to the user
change, Ember automatically keeps the URL in the browser's address bar
up-to-date.</p>
<p><strong>路由器</strong>将URL转换为一系列内嵌的有模型数据支撑的模板。当显示给用户的模板和模型发生改变时,Ember自动更新浏览器地址栏中的URL。</p>
<p>This means that, at any point, users are able to share the URL of your
app. When someone clicks the link, they reliably see the same content
as the original user.</p>
<p>这意味着用户可以在任意点分享应用的URL。当某个用户点击了这个链接时,将看到与分享链接的用户看到的相同内容。</p>
<h4 class='anchorable-toc' id='toc_components'>组件(Components)</h4>
<p>A <strong>component</strong> is a custom HTML tag whose behavior you implement using
JavaScript and whose appearance you describe using Handlebars templates.
They allow you to create reusable controls that can simplify your
application's templates.</p>
<p><strong>组件</strong>是一个自定义的HTML标签,其行为用Javascript来实现,而显示使用Handlebars模板来描述。组件可以用来定义可重用的控件来简化应用的模板。</p>
<h4 class='anchorable-toc' id='toc_models'>模型(Models)</h4>
<p>A <strong>model</strong> is an object that stores <em>persistent state</em>. This is the
data that your application operates on and what gives it value to your
users. These objects are usually loaded from your server, then saved
back when changes are made on the client.</p>
<p><strong>模型</strong>是一个存储 <em>持久化状态</em>
的对象。它是应用将操作的数据,也是用来返回值给用户的数据。这些对象通常从服务器端加载,并当其在客户端发生改变后又保存到服务器端。</p>
<h4 class='anchorable-toc' id='toc_route'>路由(Route)</h4>
<p>The <strong>route</strong> is the object responsible for <em>managing application state</em>.</p>
<p><strong>路由</strong>是 <em>负责管理应用程序状态</em> 的对象。</p>
<h4 class='anchorable-toc' id='toc_controllers'>控制器(Controllers)</h4>
<p><strong>controller</strong> is an object that stores <em>application state</em>. A
template can optionally have a controller in addition to a model, and
can retrieve properties from both.</p>
<p><strong>控制器</strong>是存放<em>应用状态</em>的对象。模板除模型之外还可以有一个控制器与之对应,使其可以从这两者获取属性。</p>
<hr>
<p>These are the core concepts you'll need to understand as you develop
your Ember.js app. They are designed to scale up in complexity, so that
adding new functionality doesn't force you to go back and refactor
major parts of your app.</p>
<p>以上这些是在开发<code>Ember.js</code>应用时需要了解的核心概念。Ember.js设计为可以弹性的处理复杂的问题,因此需要为应用增加新功能、新特性时只需要改变很小的部分。</p>
<p>Now that you understand the roles of these objects, you're equipped to
dive deep into Ember.js and learn the details of how each of these
individual pieces work.</p>
<p>现在你已经理解了这些对象各自的角色,可以开始深入到Ember.js
的世界中,进一步了解这些部分如何工作的细节。</p>
<footer>
<a class="previous-guide" href="/bilingual_guides/getting-started/using-other-adapters">
← 入门指南: 更换FixtureAdapter
</a>
<a class="next-guide" href="/bilingual_guides/concepts/naming-conventions">
命名惯例 →
</a>
</footer>
</div>
</div>
</div>
<div id="footer">
<div id="footer-wrapper">
<div class="info">© 2013 Emberjs.CN <br/>Design by <a href="http://www.heropixel.com">HeroPixel</a></div>
<div class="statement"><b>声明:</b>本站的文章可以随意在网上转载,但必须注明原文出处!</div>
<div class="links">
<a href="http://weibo.com/embercn"><img src="/images/weibo.png"/></a>
<a href="http://emberjs.cn/blog/feed.xml"><img src="/images/feed.png"/></a>
</div>
</div>
</div>
<script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F0b0fcec01b06cc76e274f7b21f4766c4' type='text/javascript'%3E%3C/script%3E"));
$(function() {
$('a[href="http://tongji.baidu.com/hm-web/welcome/ico?s=0b0fcec01b06cc76e274f7b21f4766c4"]').hide();
});
</script>
</body>
</html>