Skip to content

Commit 10c2ff3

Browse files
authored
Merge pull request ember-learn#338 from ember-learn/fix-1.11
Fixing index.md files for 1.11
2 parents 20c82b9 + 4910e61 commit 10c2ff3

File tree

12 files changed

+1224
-1206
lines changed

12 files changed

+1224
-1206
lines changed
Lines changed: 3 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +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-
These are the core concepts you'll need to understand as you develop
76-
your Ember.js app. They are designed to scale up in complexity, so that
77-
adding new functionality doesn't force you to go back and refactor major
78-
parts of your app.
79-
80-
Now that you understand the roles of these objects, you're equipped to
81-
dive deep into Ember.js and learn the details of how each of these
82-
individual pieces work.
1+
---
2+
redirect: concepts/index
3+
---

guides/v1.11.0/concepts/index.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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+
These are the core concepts you'll need to understand as you develop
76+
your Ember.js app. They are designed to scale up in complexity, so that
77+
adding new functionality doesn't force you to go back and refactor major
78+
parts of your app.
79+
80+
Now that you understand the roles of these objects, you're equipped to
81+
dive deep into Ember.js and learn the details of how each of these
82+
individual pieces work.
Lines changed: 3 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -1,137 +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-
10-
* `String` is extended to add convenience methods, such as
11-
`camelize()` and `fmt()`.
12-
13-
* `Function` is extended with methods to annotate functions as
14-
computed properties, via the `property()` method, and as observers,
15-
via the `observes()` or `observesBefore()` methods.
16-
17-
This is the extent to which Ember.js enhances native prototypes. We have
18-
carefully weighed the tradeoffs involved with changing these prototypes,
19-
and recommend that most Ember.js developers use them. These extensions
20-
significantly reduce the amount of boilerplate code that must be typed.
21-
22-
However, we understand that there are cases where your Ember.js
23-
application may be embedded in an environment beyond your control. The
24-
most common scenarios are when authoring third-party JavaScript that is
25-
embedded directly in other pages, or when transitioning an application
26-
piecemeal to a more modern Ember.js architecture.
27-
28-
In those cases, where you can't or don't want to modify native
29-
prototypes, Ember.js allows you to completely disable the extensions
30-
described above.
31-
32-
To do so, simply set the `EmberENV.EXTEND_PROTOTYPES` flag to `false`:
33-
34-
```javascript {data-filename=config/environment.js}
35-
ENV = {
36-
EmberENV: {
37-
EXTEND_PROTOTYPES: false
38-
}
39-
}
40-
```
41-
42-
Or you can choose class which you want to disable prototype extension
43-
by added a property to your application's configuration:
44-
45-
```javascript {data-filename=config/environment.js}
46-
ENV = {
47-
EmberENV: {
48-
EXTEND_PROTOTYPES: {
49-
String: false,
50-
Array: true
51-
}
52-
}
53-
}
54-
```
55-
56-
### Life Without Prototype Extension
57-
58-
In order for your application to behave correctly, you will need to
59-
manually extend or create the objects that the native objects were
60-
creating before.
61-
62-
#### Arrays
63-
64-
Native arrays will no longer implement the functionality needed to
65-
observe them. If you disable prototype extension and attempt to use
66-
native arrays with things like a template's `{{#each}}` helper, Ember.js
67-
will have no way to detect changes to the array and the template will
68-
not update as the underlying array changes.
69-
70-
Additionally, if you try to set the model of an
71-
`Ember.ArrayController` to a plain native array, it will raise an
72-
exception since it no longer implements the `Ember.Array` interface.
73-
74-
You can manually coerce a native array into an array that implements the
75-
required interfaces using the convenience method `Ember.A`:
76-
77-
```javascript
78-
var islands = ['Oahu', 'Kauai'];
79-
islands.contains('Oahu');
80-
//=> TypeError: Object Oahu,Kauai has no method 'contains'
81-
82-
// Convert `islands` to an array that implements the
83-
// Ember enumerable and array interfaces
84-
Ember.A(islands);
85-
86-
islands.contains('Oahu');
87-
//=> true
88-
```
89-
90-
#### Strings
91-
92-
Strings will no longer have the convenience methods described in the
93-
[Ember.String API reference.](http://emberjs.com/api/classes/Ember.String.html). Instead,
94-
you can use the similarly-named methods of the `Ember.String` object and
95-
pass the string to use as the first parameter:
96-
97-
```javascript
98-
"my_cool_class".camelize();
99-
//=> TypeError: Object my_cool_class has no method 'camelize'
100-
101-
Ember.String.camelize("my_cool_class");
102-
//=> "myCoolClass"
103-
```
104-
105-
#### Functions
106-
107-
To annotate computed properties, use the `Ember.computed()` method to
108-
wrap the function:
109-
110-
```javascript
111-
// This won't work:
112-
fullName: function() {
113-
return this.get('firstName') + ' ' + this.get('lastName');
114-
}.property('firstName', 'lastName')
115-
116-
117-
// Instead, do this:
118-
fullName: Ember.computed('firstName', 'lastName', function() {
119-
return this.get('firstName') + ' ' + this.get('lastName');
120-
})
121-
```
122-
123-
Observers are annotated using `Ember.observer()`:
124-
125-
```javascript
126-
// This won't work:
127-
fullNameDidChange: function() {
128-
console.log("Full name changed");
129-
}.observes('fullName')
130-
131-
132-
// Instead, do this:
133-
fullNameDidChange: Ember.observer('fullName', function() {
134-
console.log("Full name changed");
135-
})
136-
```
137-
1+
---
2+
redirect: configuring-ember/index
3+
---

0 commit comments

Comments
 (0)