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
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: docs/content/tutorial/step_01.ngdoc
+2-5
Original file line number
Diff line number
Diff line change
@@ -12,15 +12,12 @@ dynamically display the same result with any set of data.
12
12
13
13
In this step you will add some basic information about two cell phones to an HTML page.
14
14
15
+
- The page now contains a list with information about two phones.
15
16
16
17
<div doc-tutorial-reset="1"></div>
17
18
18
19
19
-
The page now contains a list with information about two phones.
20
-
21
-
The most important changes are listed below. You can see the full diff on [GitHub](https://github.com/angular/angular-phonecat/compare/step-0...step-1):
to decouple the code and to separate concerns. With that in mind, let's use a little Angular and
15
+
JavaScript to add model, view, and controller components to our app.
16
16
17
+
- The list of three phones is now generated dynamically from data
17
18
18
19
<div doc-tutorial-reset="2"></div>
19
20
20
21
21
-
The app now contains a list with three phones.
22
-
23
-
The most important changes are listed below. You can see the full diff on [GitHub](https://github.com/angular/angular-phonecat/compare/step-1...step-2):
24
-
25
-
26
22
## View and Template
27
23
28
24
In Angular, the __view__ is a projection of the model through the HTML __template__. This means that
Don't forget that we need to load up the `phonecatApp` module into the test so that the controller
181
-
is available to be injected.
174
+
* Before each test we tell Angular to load the `phonecatApp` module.
175
+
* We ask Angular to `inject` the `$controller` service into our test function
176
+
* We use `$controller` to create an instance of the `PhoneListCtrl`
177
+
* With this instance, we verify that the phones array property on the scope contains three records.
178
+
182
179
183
180
### Writing and Running Tests
181
+
184
182
Angular developers prefer the syntax of Jasmine's Behavior-driven Development (BDD) framework when
185
183
writing tests. Although Angular does not require you to use Jasmine, we wrote all of the tests in
186
-
this tutorial in Jasmine. You can learn about Jasmine on the [Jasmine home page](http://jasmine.github.io/) and at the [Jasmine docs](http://jasmine.github.io/).
187
-
188
-
The angular-seed project is pre-configured to run all unit tests using [Karma](http://karma-runner.github.io/). Ensure that the necessary karma plugins are installed.
189
-
You can do this by issuing `npm install` into your terminal.
184
+
this tutorial in Jasmine v1.3. You can learn about Jasmine on the [Jasmine home page][jasmine] and
185
+
at the [Jasmine docs][jasmine-docs].
190
186
187
+
The angular-seed project is pre-configured to run unit tests using [Karma][karma] but you will need
188
+
to ensure that Karma and its necessary plugins are installed. You can do this by running
189
+
`npm install`.
191
190
192
-
To run the test, do the following:
191
+
To run the tests, and then watch the files for changes: `npm test`.
193
192
194
-
1. In a _separate_ terminal window or tab, go to the `angular-phonecat` directory and run
195
-
`npm test` to start the Karma server (the config file necessary to start the server is
196
-
located at `./test/karma.conf.js`).
197
-
198
-
2. Karma will start a new instance of Chrome browser automatically. Just ignore it and let it run in
193
+
* Karma will start a new instance of Chrome browser automatically. Just ignore it and let it run in
199
194
the background. Karma will use this browser for test execution.
195
+
* You should see the following or similar output in the terminal:
200
196
201
-
3. You should see the following or similar output in the terminal:
202
-
203
-
info: Karma server started at http://localhost:9876/
204
-
info (launcher): Starting browser "Chrome"
205
-
info (Chrome 22.0): Connected on socket id tPUm9DXcLHtZTKbAEO-n
Copy file name to clipboardExpand all lines: docs/content/tutorial/step_05.ngdoc
+5-8
Original file line number
Diff line number
Diff line change
@@ -11,14 +11,11 @@ from our server using one of Angular's built-in {@link guide/services services}
11
11
ng.$http $http}. We will use Angular's {@link guide/di dependency
12
12
injection (DI)} to provide the service to the `PhoneListCtrl` controller.
13
13
14
+
* There are now a list of 20 phones, loaded from the server.
14
15
15
16
<div doc-tutorial-reset="5"></div>
16
17
17
18
18
-
You should now see a list of 20 phones.
19
-
20
-
The most important changes are listed below. You can see the full diff on [GitHub](https://github.com/angular/angular-phonecat/compare/step-4...step-5):
21
-
22
19
## Data
23
20
The `app/phones/phones.json` file in your project is a dataset that contains a larger list of phones
Copy file name to clipboardExpand all lines: docs/content/tutorial/step_06.ngdoc
+1-6
Original file line number
Diff line number
Diff line change
@@ -10,15 +10,10 @@ In this step, you will add thumbnail images for the phones in the phone list, an
10
10
now, will go nowhere. In subsequent steps you will use the links to display additional information
11
11
about the phones in the catalog.
12
12
13
+
* There are now links and images of the phones in the list.
13
14
14
15
<div doc-tutorial-reset="6"></div>
15
16
16
-
17
-
You should now see links and images of the phones in the list.
18
-
19
-
The most important changes are listed below. You can see the full diff on [GitHub](https://github.com/angular/angular-phonecat/compare/step-5...step-6):
20
-
21
-
22
17
## Data
23
18
24
19
Note that the `phones.json` file contains unique ids and image urls for each of the phones. The
0 commit comments