diff options
| author | Caitlin Potter | 2014-02-06 14:02:18 +0000 |
|---|---|---|
| committer | Peter Bacon Darwin | 2014-02-16 19:03:40 +0000 |
| commit | f7d28cd377f06224247b950680517a187a7b6749 (patch) | |
| tree | 20203b9f7bf60748bb752f325b1869415352a6f3 /docs/content/tutorial/step_02.ngdoc | |
| parent | 2e641ac49f121a6e2cc70bd3879930b44a8a7710 (diff) | |
| download | angular.js-f7d28cd377f06224247b950680517a187a7b6749.tar.bz2 | |
docs(all): convert <pre>/</pre> snippets to GFM snippets
Diffstat (limited to 'docs/content/tutorial/step_02.ngdoc')
| -rw-r--r-- | docs/content/tutorial/step_02.ngdoc | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/docs/content/tutorial/step_02.ngdoc b/docs/content/tutorial/step_02.ngdoc index 99180b4b..efafba91 100644 --- a/docs/content/tutorial/step_02.ngdoc +++ b/docs/content/tutorial/step_02.ngdoc @@ -32,7 +32,8 @@ view. The view component is constructed by Angular from this template: __`app/index.html`:__ -<pre> + +```html <html ng-app="phonecatApp"> <head> ... @@ -50,7 +51,7 @@ __`app/index.html`:__ </body> </html> -</pre> +``` We replaced the hard-coded phone list with the {@link api/ng.directive:ngRepeat ngRepeat directive} and two @@ -77,7 +78,8 @@ the `PhoneListCtrl` __controller__. The __controller__ is simply a constructor f `$scope` parameter: __`app/js/controllers.js`:__ -<pre> + +```js var phonecatApp = angular.module('phonecatApp', []); @@ -92,7 +94,7 @@ phonecatApp.controller('PhoneListCtrl', function ($scope) { ]; }); -</pre> +``` Here we declared a controller called `PhoneListCtrl` and registered it in an AngularJS module, `phonecatApp`. Notice that our `ng-app` directive (on the `<html>` tag) now specifies the `phonecatApp` @@ -130,7 +132,8 @@ developed. If our controller is available on the global namespace then we can si with a mock `scope` object. Take a look at the following unit test for our controller: __`test/unit/controllersSpec.js`:__ -<pre> + +```js describe('PhoneCat controllers', function() { describe('PhoneListCtrl', function(){ @@ -143,7 +146,7 @@ describe('PhoneCat controllers', function() { }); }); }); -</pre> +``` The test instantiates `PhoneListCtrl` and verifies that the phones array property on the scope contains three records. This example demonstrates how easy it is to create a unit test for code in @@ -157,7 +160,8 @@ service, `$controller`, which will retrieve your controller by name. Here is th `$controller`: __`test/unit/controllersSpec.js`:__ -<pre> + +```js describe('PhoneCat controllers', function() { beforeEach(module('phonecatApp')); @@ -171,7 +175,7 @@ describe('PhoneCat controllers', function() { })); }); }); -</pre> +``` Don't forget that we need to load up the `phonecatApp` module into the test so that the controller is available to be injected. |
