From f7d28cd377f06224247b950680517a187a7b6749 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Thu, 6 Feb 2014 14:02:18 +0000 Subject: docs(all): convert
/snippets to GFM snippets --- docs/content/tutorial/step_00.ngdoc | 5 ++-- docs/content/tutorial/step_01.ngdoc | 5 ++-- docs/content/tutorial/step_02.ngdoc | 20 ++++++++----- docs/content/tutorial/step_03.ngdoc | 14 +++++---- docs/content/tutorial/step_04.ngdoc | 20 ++++++++----- docs/content/tutorial/step_05.ngdoc | 44 ++++++++++++++++----------- docs/content/tutorial/step_06.ngdoc | 15 ++++++---- docs/content/tutorial/step_07.ngdoc | 34 ++++++++++++--------- docs/content/tutorial/step_08.ngdoc | 25 +++++++++------- docs/content/tutorial/step_09.ngdoc | 25 +++++++++------- docs/content/tutorial/step_10.ngdoc | 15 ++++++---- docs/content/tutorial/step_11.ngdoc | 25 +++++++++------- docs/content/tutorial/step_12.ngdoc | 59 +++++++++++++++++++++---------------- 13 files changed, 181 insertions(+), 125 deletions(-) (limited to 'docs/content/tutorial') diff --git a/docs/content/tutorial/step_00.ngdoc b/docs/content/tutorial/step_00.ngdoc index b6ea975c..22bbe158 100644 --- a/docs/content/tutorial/step_00.ngdoc +++ b/docs/content/tutorial/step_00.ngdoc @@ -77,7 +77,8 @@ The HTML page that displays "Nothing here yet!" was constructed with the HTML co The code contains some key Angular elements that we will need as we progress. __`app/index.html`:__ -
+ +```html @@ -93,7 +94,7 @@ __`app/index.html`:__ -+``` diff --git a/docs/content/tutorial/step_01.ngdoc b/docs/content/tutorial/step_01.ngdoc index 540484d3..d3f28929 100644 --- a/docs/content/tutorial/step_01.ngdoc +++ b/docs/content/tutorial/step_01.ngdoc @@ -21,7 +21,8 @@ The page now contains a list with information about two phones. 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): __`app/index.html`:__ -
+ +```html
+ +```html ... @@ -50,7 +51,7 @@ __`app/index.html`:__ -+``` 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`:__ -
+
+```js
 
 var phonecatApp = angular.module('phonecatApp', []);
 
@@ -92,7 +94,7 @@ phonecatApp.controller('PhoneListCtrl', function ($scope) {
   ];
 });
 
-
+```
 
 Here we declared a controller called `PhoneListCtrl` and registered it in an AngularJS
 module, `phonecatApp`. Notice that our `ng-app` directive (on the `` 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`:__
-
+
+```js
 describe('PhoneCat controllers', function() {
 
   describe('PhoneListCtrl', function(){
@@ -143,7 +146,7 @@ describe('PhoneCat controllers', function() {
     });
   });
 });
-
+```
 
 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`:__
-
+
+```js
 describe('PhoneCat controllers', function() {
   beforeEach(module('phonecatApp'));
 
@@ -171,7 +175,7 @@ describe('PhoneCat controllers', function() {
     }));
   });
 });
-
+```
 
 Don't forget that we need to load up the `phonecatApp` module into the test so that the controller
 is available to be injected.
diff --git a/docs/content/tutorial/step_03.ngdoc b/docs/content/tutorial/step_03.ngdoc
index d7c75086..8866e49c 100644
--- a/docs/content/tutorial/step_03.ngdoc
+++ b/docs/content/tutorial/step_03.ngdoc
@@ -30,7 +30,8 @@ We made no changes to the controller.
 ## Template
 
 __`app/index.html`:__
-+ +```html+``` We added a standard HTML `` tag and used Angular's {@link api/ng.filter:filter filter} function to process the input for the @@ -88,7 +89,8 @@ The search feature was fully implemented via templates and data-binding, so we'l end-to-end test, to verify that the feature works. __`test/e2e/scenarios.js`:__ --@@ -52,7 +53,7 @@ __`app/index.html`:__
+
+```js
 describe('PhoneCat App', function() {
 
   describe('Phone list view', function() {
@@ -109,7 +111,7 @@ describe('PhoneCat App', function() {
     });
   });
 });
-
+```
 
 Even though the syntax of this test looks very much like our controller unit test written with
 Jasmine, the end-to-end test uses APIs of {@link guide/dev_guide.e2e-testing Angular's end-to-end
@@ -168,7 +170,7 @@ ngBindTemplate} directives, which are invisible to the user while the page is lo
 
 * Add the following end-to-end test into the `describe` block within `test/e2e/scenarios.js`:
 
-  
+  ```js
     it('should display the current filter value within an element with id "status"',
         function() {
       expect(element('#status').text()).toMatch(/Current filter: \s*$/);
@@ -180,7 +182,7 @@ ngBindTemplate} directives, which are invisible to the user while the page is lo
       //alternative version of the last assertion that tests just the value of the binding
       using('#status').expect(binding('query')).toBe('nexus');
     });
-  
+  ```
 
   Refresh the browser tab with the end-to-end test runner to see the test fail. To make the test
 pass, edit the `index.html` template to add a `div` or `p` element with `id` `"status"` and content
diff --git a/docs/content/tutorial/step_04.ngdoc b/docs/content/tutorial/step_04.ngdoc
index 612619a4..adf362b6 100644
--- a/docs/content/tutorial/step_04.ngdoc
+++ b/docs/content/tutorial/step_04.ngdoc
@@ -24,7 +24,8 @@ The most important differences between Steps 3 and 4 are listed below. You can s
 ## Template
 
 __`app/index.html`:__
-+ +```html Search: Sort by:+``` We made the following changes to the `index.html` template: @@ -65,7 +66,8 @@ necessary! ## Controller __`app/js/controllers.js`:__ -
+
+```js
 var phonecatApp = angular.module('phonecatApp', []);
 
 phonecatApp.controller('PhoneListCtrl', function ($scope) {
@@ -83,7 +85,7 @@ phonecatApp.controller('PhoneListCtrl', function ($scope) {
 
   $scope.orderProp = 'age';
 });
-
+```
 
 * We modified the `phones` model - the array of phones - and added an `age` property to each phone
 record. This property is used to order phones by age.
@@ -107,7 +109,8 @@ The changes we made should be verified with both a unit test and an end-to-end t
 the unit test first.
 
 __`test/unit/controllersSpec.js`:__
-
+
+```js
 describe('PhoneCat controllers', function() {
 
   describe('PhoneListCtrl', function(){
@@ -130,7 +133,7 @@ describe('PhoneCat controllers', function() {
     });
   });
 });
-
+```
 
 
 The unit test now verifies that the default ordering property is set.
@@ -146,7 +149,8 @@ You should now see the following output in the Karma tab:
 Let's turn our attention to the end-to-end test.
 
 __`test/e2e/scenarios.js`:__
-
+
+```js
 ...
     it('should be possible to control phone order via the drop down select box',
         function() {
@@ -164,7 +168,7 @@ __`test/e2e/scenarios.js`:__
                    "Motorola XOOM\u2122 with Wi-Fi"]);
     });
 ...
-
+```
 
 The end-to-end test verifies that the ordering mechanism of the select box is working correctly.
 
diff --git a/docs/content/tutorial/step_05.ngdoc b/docs/content/tutorial/step_05.ngdoc
index e32739a1..357bbf5b 100644
--- a/docs/content/tutorial/step_05.ngdoc
+++ b/docs/content/tutorial/step_05.ngdoc
@@ -25,7 +25,8 @@ The `app/phones/phones.json` file in your project is a dataset that contains a l
 stored in the JSON format.
 
 Following is a sample of the file:
-
+
+```js
 [
  {
   "age": 13,
@@ -36,7 +37,7 @@ Following is a sample of the file:
  },
 ...
 ]
-
+```
 
 
 ## Controller
@@ -52,7 +53,8 @@ and control) and loosely coupled (dependencies between components are not resolv
 components themselves, but by the DI subsystem).
 
 __`app/js/controllers.js:`__
-
+
+```js
 var phonecatApp = angular.module('phonecatApp', []);
 
 phonecatApp.controller('PhoneListCtrl', function ($scope, $http) {
@@ -62,7 +64,7 @@ phonecatApp.controller('PhoneListCtrl', function ($scope, $http) {
 
   $scope.orderProp = 'age';
 });
-
+```
 
 `$http` makes an HTTP GET request to our web server, asking for `phone/phones.json` (the url is
 relative to our `index.html` file). The server responds by providing the data in the json file.
@@ -115,31 +117,37 @@ There are two ways to overcome issues caused by minification:
 * You can create a `$inject` property on the controller function which holds an array of strings.
   Each string in the array is the name of the service to inject for the corresponding parameter.
   In the case of our example we would write:
-
+
+```js
     function PhoneListCtrl($scope, $http) {...}
     PhoneListCtrl.$inject = ['$scope', '$http'];
     phonecatApp.controller('PhoneListCtrl', PhoneListCtrl);
-
+```
+
 * Use the inline bracket notation which wraps the function to be injected into an array of strings
   (representing the dependency names) followed by the function to be injected:
-
+
+```js
     function PhoneListCtrl($scope, $http) {...}
     phonecatApp.controller('PhoneListCtrl', ['$scope', '$http', PhoneListCtrl]);
-
+```
+
 Both of these methods work with any function that can be injected by Angular, so it's up to your
 project's style guide to decide which one you use.
 
 When using the second method, it is common to provide the constructor function inline as an
 anonymous function when registering the controller:
-
+
+```js
     phonecatApp.controller('PhoneListCtrl', ['$scope', '$http', function($scope, $http) {...}]);
-
+```
 
 From this point onward, we're going to use the inline method in the tutorial. With that in mind,
 let's add the annotations to our `PhoneListCtrl`:
 
 __`app/js/controllers.js:`__
-
+
+```js
 var phonecatApp = angular.module('phonecatApp', []);
 
 phonecatApp.controller('PhoneListCtrl', ['$scope', '$http',
@@ -150,7 +158,7 @@ phonecatApp.controller('PhoneListCtrl', ['$scope', '$http',
 
     $scope.orderProp = 'age';
   }]);
-
+```
 
 ## Test
 
@@ -162,7 +170,7 @@ constructor with some kind of fake `$http` implementation. However, the recommen
 is to create a controller in the test environment in the same way that angular does it in the
 production code behind the scenes, as follows:
 
-
+```js
 describe('PhoneCat controllers', function() {
 
   describe('PhoneListCtrl', function(){
@@ -182,7 +190,7 @@ describe('PhoneCat controllers', function() {
       scope = $rootScope.$new();
       ctrl = $controller('PhoneListCtrl', {$scope: scope});
     }));
-
+```
 
 Note: Because we loaded Jasmine and `angular-mocks.js` in our test environment, we got two helper
 methods {@link api/angular.mock.module module} and {@link api/angular.mock.inject inject} that we'll
@@ -219,7 +227,7 @@ the `$httpBackend.flush` method.
 Now we will make assertions to verify that the `phones` model doesn't exist on `scope` before
 the response is received:
 
-
+```js
     it('should create "phones" model with 2 phones fetched from xhr', function() {
       expect(scope.phones).toBeUndefined();
       $httpBackend.flush();
@@ -227,7 +235,7 @@ the response is received:
       expect(scope.phones).toEqual([{name: 'Nexus S'},
                                    {name: 'Motorola DROID'}]);
     });
-
+```
 
 * We flush the request queue in the browser by calling `$httpBackend.flush()`. This causes the
 promise returned by the `$http` service to be resolved with the trained response.
@@ -236,11 +244,11 @@ promise returned by the `$http` service to be resolved with the trained response
 
 Finally, we verify that the default value of `orderProp` is set correctly:
 
-
+```js
     it('should set the default value of orderProp model', function() {
       expect(scope.orderProp).toBe('age');
     });
-
+```
 
 You should now see the following output in the Karma tab:
 
diff --git a/docs/content/tutorial/step_06.ngdoc b/docs/content/tutorial/step_06.ngdoc
index 09052e8f..3eabeadb 100644
--- a/docs/content/tutorial/step_06.ngdoc
+++ b/docs/content/tutorial/step_06.ngdoc
@@ -25,7 +25,8 @@ Note that the `phones.json` file contains unique ids and image urls for each of
 urls point to the `app/img/phones/` directory.
 
 __`app/phones/phones.json`__ (sample snippet):
-
+
+```js
 [
   {
     ...
@@ -36,13 +37,14 @@ __`app/phones/phones.json`__ (sample snippet):
   },
   ...
 ]
-
+```
 
 
 ## Template
 
 __`app/index.html`:__
-
+
+```html
 ...
         
+
+```js
 ...
     it('should render phone specific links', function() {
       input('query').enter('nexus');
@@ -78,7 +81,7 @@ __`test/e2e/scenarios.js`__:
       expect(browser().location().url()).toBe('/phones/nexus-s');
     });
 ...
-
+```
 
 We added a new end-to-end test to verify that the app is generating correct links to the phone
 views that we will implement in the upcoming steps.
diff --git a/docs/content/tutorial/step_07.ngdoc b/docs/content/tutorial/step_07.ngdoc
index 2f752f6a..de3bdae6 100644
--- a/docs/content/tutorial/step_07.ngdoc
+++ b/docs/content/tutorial/step_07.ngdoc
@@ -71,7 +71,8 @@ both module systems can live side by side and fulfil their goals.
 ## The App Module
 
 __`app/js/app.js`:__
-
+
+```js
 var phonecatApp = angular.module('phonecatApp', [
   'ngRoute',
   'phonecatControllers'
@@ -92,7 +93,7 @@ phonecatApp.config(['$routeProvider',
         redirectTo: '/phones'
       });
   }]);
-
+```
 
 In order to configure our application with routes, we need to create a module for our application.
 We call this module `phonecatApp`. Notice the second argument passed to `angular.module`:
@@ -133,17 +134,19 @@ the module name as the value of the {@link api/ng.directive:ngApp ngApp}
 directive:
 
 __`app/index.html`:__
-+ +```html ... -+``` ## Controllers __`app/js/controllers.js`:__ -
+
+```js
 var phonecatControllers = angular.module('phonecatControllers', []);
 
 phonecatControllers.controller('PhoneListCtrl', ['$scope', '$http',
@@ -159,7 +162,7 @@ phonecatControllers.controller('PhoneDetailCtrl', ['$scope', '$routeParams',
   function($scope, $routeParams) {
     $scope.phoneId = $routeParams.phoneId;
   }]);
-
+```
 
 Again, note that we created a new module called `phonecatControllers`. For small AngularJS applications,
 it's common to create just one module for all of your controllers if there are just a few. For larger apps,
@@ -180,7 +183,8 @@ tag to your `index.html` file as shown below.
 
 
 __`app/index.html`:__
-+ +```html @@ -196,14 +200,15 @@ __`app/index.html`:__ -+``` Note that we removed most of the code in the `index.html` template and replaced it with a single line containing a div with the `ng-view` attribute. The code that we removed was placed into the `phone-list.html` template: __`app/partials/phone-list.html`:__ -
+ +```html+```-@@ -231,7 +236,7 @@ __`app/partials/phone-list.html`:__