Skip to content

Commit 20c82b9

Browse files
authored
Merge pull request ember-learn#337 from ember-learn/fix-1.10
Fixing index.md files for 1.10
2 parents 1285dd8 + 39f03ff commit 20c82b9

File tree

12 files changed

+1229
-1211
lines changed

12 files changed

+1229
-1211
lines changed
Lines changed: 2 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,3 @@
1-
To get started with Ember.js, there are a few core concepts you
2-
should understand.
3-
4-
Ember.js is designed to help developers build ambitiously large web
5-
applications that are competitive with native apps. Doing so requires
6-
both new tools and a new vocabulary of concepts. We've spent a lot of
7-
time borrowing ideas pioneered by native application frameworks like
8-
Cocoa and Smalltalk.
9-
10-
However, it's important to remember what makes the web special. Many
11-
people think that something is a web application because it uses
12-
technologies like HTML, CSS and JavaScript. In reality, these are just
13-
implementation details.
14-
15-
Instead, **the web derives its power from the ability to bookmark and
16-
share URLs.** URLs are the key feature that give web applications
17-
superior shareability and collaboration. Today, most JavaScript
18-
frameworks treat the URL as an afterthought, instead of the primary
19-
reason for the web's success.
20-
21-
Ember.js, therefore, marries the tools and concepts of native
22-
GUI frameworks with support for the feature that makes the web so
23-
powerful: the URL.
24-
25-
### Concepts
26-
27-
#### Templates
28-
29-
A **template**, written in the Handlebars templating language, describes
30-
the user interface of your application. Each template is backed by a
31-
model, and the template automatically updates itself if the model changes.
32-
33-
In addition to plain HTML, templates can contain:
34-
35-
* **Expressions**, like `{{firstName}}`, which take information from
36-
the template's model and put it into HTML.
37-
* **Outlets**, which are placeholders for other templates. As users
38-
move around your app, different templates can be plugged into the
39-
outlet by the router. You can put outlets into your template using the
40-
`{{outlet}}` helper.
41-
* **Components**, custom HTML elements that you can use to clean up
42-
repetitive templates or create reusable controls.
43-
44-
#### Router
45-
46-
The **router** translates a URL into a series of nested templates, each
47-
backed by a model. As the templates or models being shown to the user
48-
change, Ember automatically keeps the URL in the browser's address bar
49-
up-to-date.
50-
51-
This means that, at any point, users are able to share the URL of your
52-
app. When someone clicks the link, they reliably see the same content as
53-
the original user.
54-
55-
#### Components
56-
57-
A **component** is a custom HTML tag whose behavior you implement using
58-
JavaScript and whose appearance you describe using Handlebars templates.
59-
They allow you to create reusable controls that can simplify your
60-
application's templates.
61-
62-
#### Models
63-
64-
A **model** is an object that stores _persistent state_. Templates are
65-
responsible for displaying the model to the user by turning it into
66-
HTML. In many applications, models are loaded via an HTTP JSON API,
67-
although Ember is agnostic to the backend that you choose.
68-
69-
70-
#### Route
71-
72-
A **route** is an object that tells the template which model it should
73-
display.
74-
75-
#### Controllers
76-
77-
A **controller** is an object that stores _application state_. A
78-
template can optionally have a controller in addition to a model, and
79-
can retrieve properties from both.
80-
811
---
82-
83-
These are the core concepts you'll need to understand as you develop
84-
your Ember.js app. They are designed to scale up in complexity, so that
85-
adding new functionality doesn't force you to go back and refactor major
86-
parts of your app.
87-
88-
Now that you understand the roles of these objects, you're equipped to
89-
dive deep into Ember.js and learn the details of how each of these
90-
individual pieces work.
2+
redirect: concepts/index
3+
---

guides/v1.10.0/concepts/index.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
To get started with Ember.js, there are a few core concepts you
2+
should understand.
3+
4+
Ember.js is designed to help developers build ambitiously large web
5+
applications that are competitive with native apps. Doing so requires
6+
both new tools and a new vocabulary of concepts. We've spent a lot of
7+
time borrowing ideas pioneered by native application frameworks like
8+
Cocoa and Smalltalk.
9+
10+
However, it's important to remember what makes the web special. Many
11+
people think that something is a web application because it uses
12+
technologies like HTML, CSS and JavaScript. In reality, these are just
13+
implementation details.
14+
15+
Instead, **the web derives its power from the ability to bookmark and
16+
share URLs.** URLs are the key feature that give web applications
17+
superior shareability and collaboration. Today, most JavaScript
18+
frameworks treat the URL as an afterthought, instead of the primary
19+
reason for the web's success.
20+
21+
Ember.js, therefore, marries the tools and concepts of native
22+
GUI frameworks with support for the feature that makes the web so
23+
powerful: the URL.
24+
25+
### Concepts
26+
27+
#### Templates
28+
29+
A **template**, written in the Handlebars templating language, describes
30+
the user interface of your application. Each template is backed by a
31+
model, and the template automatically updates itself if the model changes.
32+
33+
In addition to plain HTML, templates can contain:
34+
35+
* **Expressions**, like `{{firstName}}`, which take information from
36+
the template's model and put it into HTML.
37+
* **Outlets**, which are placeholders for other templates. As users
38+
move around your app, different templates can be plugged into the
39+
outlet by the router. You can put outlets into your template using the
40+
`{{outlet}}` helper.
41+
* **Components**, custom HTML elements that you can use to clean up
42+
repetitive templates or create reusable controls.
43+
44+
#### Router
45+
46+
The **router** translates a URL into a series of nested templates, each
47+
backed by a model. As the templates or models being shown to the user
48+
change, Ember automatically keeps the URL in the browser's address bar
49+
up-to-date.
50+
51+
This means that, at any point, users are able to share the URL of your
52+
app. When someone clicks the link, they reliably see the same content as
53+
the original user.
54+
55+
#### Components
56+
57+
A **component** is a custom HTML tag whose behavior you implement using
58+
JavaScript and whose appearance you describe using Handlebars templates.
59+
They allow you to create reusable controls that can simplify your
60+
application's templates.
61+
62+
#### Models
63+
64+
A **model** is an object that stores _persistent state_. Templates are
65+
responsible for displaying the model to the user by turning it into
66+
HTML. In many applications, models are loaded via an HTTP JSON API,
67+
although Ember is agnostic to the backend that you choose.
68+
69+
70+
#### Route
71+
72+
A **route** is an object that tells the template which model it should
73+
display.
74+
75+
#### Controllers
76+
77+
A **controller** is an object that stores _application state_. A
78+
template can optionally have a controller in addition to a model, and
79+
can retrieve properties from both.
80+
81+
---
82+
83+
These are the core concepts you'll need to understand as you develop
84+
your Ember.js app. They are designed to scale up in complexity, so that
85+
adding new functionality doesn't force you to go back and refactor major
86+
parts of your app.
87+
88+
Now that you understand the roles of these objects, you're equipped to
89+
dive deep into Ember.js and learn the details of how each of these
90+
individual pieces work.
Lines changed: 3 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,3 @@
1-
By default, Ember.js will extend the prototypes of native JavaScript
2-
objects in the following ways:
3-
4-
* `Array` is extended to implement the `Ember.Enumerable`,
5-
`Ember.MutableEnumerable`, `Ember.MutableArray` and `Ember.Array`
6-
interfaces. This polyfills ECMAScript 5 array methods in browsers that
7-
do not implement them, adds convenience methods and properties to
8-
built-in arrays, and makes array mutations observable.
9-
* `String` is extended to add convenience methods, such as
10-
`camelize()` and `fmt()`.
11-
* `Function` is extended with methods to annotate functions as
12-
computed properties, via the `property()` method, and as observers,
13-
via the `observes()` or `observesBefore()` methods.
14-
15-
This is the extent to which Ember.js enhances native prototypes. We have
16-
carefully weighed the tradeoffs involved with changing these prototypes,
17-
and recommend that most Ember.js developers use them. These extensions
18-
significantly reduce the amount of boilerplate code that must be typed.
19-
20-
However, we understand that there are cases where your Ember.js
21-
application may be embedded in an environment beyond your control. The
22-
most common scenarios are when authoring third-party JavaScript that is
23-
embedded directly in other pages, or when transitioning an application
24-
piecemeal to a more modern Ember.js architecture.
25-
26-
In those cases, where you can't or don't want to modify native
27-
prototypes, Ember.js allows you to completely disable the extensions
28-
described above.
29-
30-
To do so, simply set the `EXTEND_PROTOTYPES` flag to `false`:
31-
32-
```javascript
33-
window.EmberENV = {};
34-
EmberENV.EXTEND_PROTOTYPES = false;
35-
```
36-
37-
Or you can choose class which you want to disable prototype extension.
38-
```javascript
39-
EmberENV.EXTEND_PROTOTYPES = {
40-
String: false,
41-
Array: true
42-
};
43-
```
44-
45-
Note that the above code must be evaluated **before** Ember.js loads. If
46-
you set the flag after the Ember.js JavaScript file has been evaluated,
47-
the native prototypes will already have been modified.
48-
49-
### Life Without Prototype Extension
50-
51-
In order for your application to behave correctly, you will need to
52-
manually extend or create the objects that the native objects were
53-
creating before.
54-
55-
#### Arrays
56-
57-
Native arrays will no longer implement the functionality needed to
58-
observe them. If you disable prototype extension and attempt to use
59-
native arrays with things like a template's `{{#each}}` helper, Ember.js
60-
will have no way to detect changes to the array and the template will
61-
not update as the underlying array changes.
62-
63-
Additionally, if you try to set the model of an
64-
`Ember.ArrayController` to a plain native array, it will raise an
65-
exception since it no longer implements the `Ember.Array` interface.
66-
67-
You can manually coerce a native array into an array that implements the
68-
required interfaces using the convenience method `Ember.A`:
69-
70-
```javascript
71-
var islands = ['Oahu', 'Kauai'];
72-
islands.contains('Oahu');
73-
//=> TypeError: Object Oahu,Kauai has no method 'contains'
74-
75-
// Convert `islands` to an array that implements the
76-
// Ember enumerable and array interfaces
77-
Ember.A(islands);
78-
79-
islands.contains('Oahu');
80-
//=> true
81-
```
82-
83-
#### Strings
84-
85-
Strings will no longer have the convenience methods described in the
86-
[Ember.String API reference.](http://emberjs.com/api/classes/Ember.String.html). Instead,
87-
you can use the similarly-named methods of the `Ember.String` object and
88-
pass the string to use as the first parameter:
89-
90-
```javascript
91-
"my_cool_class".camelize();
92-
//=> TypeError: Object my_cool_class has no method 'camelize'
93-
94-
Ember.String.camelize("my_cool_class");
95-
//=> "myCoolClass"
96-
```
97-
98-
#### Functions
99-
100-
To annotate computed properties, use the `Ember.computed()` method to
101-
wrap the function:
102-
103-
```javascript
104-
// This won't work:
105-
fullName: function() {
106-
return this.get('firstName') + ' ' + this.get('lastName');
107-
}.property('firstName', 'lastName')
108-
109-
110-
// Instead, do this:
111-
fullName: Ember.computed('firstName', 'lastName', function() {
112-
return this.get('firstName') + ' ' + this.get('lastName');
113-
})
114-
```
115-
116-
Observers are annotated using `Ember.observer()`:
117-
118-
```javascript
119-
// This won't work:
120-
fullNameDidChange: function() {
121-
console.log("Full name changed");
122-
}.observes('fullName')
123-
124-
125-
// Instead, do this:
126-
fullNameDidChange: Ember.observer('fullName', function() {
127-
console.log("Full name changed");
128-
})
129-
```
130-
1+
---
2+
redirect: configuring-ember/index
3+
---

0 commit comments

Comments
 (0)