You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: public/docs/js/latest/guide/setup.jade
+16-24Lines changed: 16 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -10,27 +10,21 @@
10
10
p.
11
11
You can edit and test out your apps either though serving local files through a web server or through a service like
12
12
Plunker.
13
-
13
+
14
14
.callout.is-helpful
15
15
header Plunker is the fastest setup
16
16
p.
17
17
Plunker is a free online text editor. You can use the <ahref="http://plnkr.co/edit/?p=preview">starter template</a> for Angular 2 to get going without any setup.
18
-
18
+
19
19
p.
20
20
For Plunker, just use the <ahref="http://plnkr.co/edit/?p=preview">starter template</a> to get going. If you're serving local files, edit and save them and start a web server that serves files in that directory. If you have Python installed, you can run a basic HTTP server from the root of your code directory with:
21
21
22
22
pre.prettyprint.lang-bash
23
23
code python -m SimpleHTTPServer 8000
24
-
25
-
.l-sub-section
26
-
h3#section-examples Live Examples
27
-
p.
28
-
If you want to skip the working examples you can check out these links on Plunker.
If you want to skip the working examples you can check out these links on Plunker. <ahref='http://plnkr.co/edit/MRz2i7sjupzxERPAa3SF?p=preview')> TypeScript Example</a> or
h2#section-create-an-entry-point Create an entry point
@@ -41,7 +35,7 @@
41
35
p.
42
36
In the <code><body></code>, add an element called <code><my-app></code> that will be the root of your
43
37
application.
44
-
38
+
45
39
p.
46
40
The TypeScript setup includes System.js, a third-party open-source library that adds ES6 module loading functionality to browsers. This step isn't needed for the ES5 version. System requires mapping the code file paths to understand what to be load.
47
41
@@ -129,7 +123,7 @@
129
123
}
130
124
131
125
bootstrap(AppComponent);
132
-
126
+
133
127
.l-main-section
134
128
h2#section-run-it Run it!
135
129
@@ -170,32 +164,30 @@
170
164
The <code>@Component</code> annotation defines the HTML tag for the component by specifying the component's CSS selector.
171
165
p.
172
166
The <code>@View</code> annotation defines the HTML that represents the component. The component you wrote uses an inline template, but you can also have an external template. To use an external template, specify a <code>templateUrl</code> property and give it the path to the HTML file.
173
-
167
+
174
168
.l-sub-section
175
169
h3 import vs. window.angular
176
170
p.
177
171
The main difference between the ES5 and TypeScript versions is the loading of modules.
178
-
179
-
strong TypeScript
172
+
173
+
strong TypeScript
180
174
p.
181
175
TypeScript supports ES6 module loading syntax. ES6 modules allow for modular loading of JavaScript code. Using ES6 modules you can cherry-pick only what you need for your app.
182
-
176
+
183
177
pre.prettyprint.lang-typescript
184
178
code.
185
179
import {Component, View, bootstrap} from 'angular2/angular2';
186
180
...
187
181
// bootstrap is available for use because it was imported from angular core
188
182
bootstrap(AppComponent);
189
-
183
+
190
184
strong ES5
191
185
p.
192
-
In ES5 the script file creates an angular property on the window of the browser. This property contains every piece of Angular core, whether you need it or not.
193
-
186
+
In ES5 the script file creates an angular property on the window of the browser. This property contains every piece of Angular core, whether you need it or not.
187
+
194
188
pre.prettyprint.lang-typescript
195
189
code.
196
190
// window.angular is available because the script file attaches the angular property to the window
0 commit comments