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 --- src/Angular.js | 12 ++++---- src/auto/injector.js | 60 ++++++++++++++++++++-------------------- src/loader.js | 12 ++++---- src/ng/animate.js | 4 +-- src/ng/cacheFactory.js | 20 +++++++------- src/ng/compile.js | 28 +++++++++---------- src/ng/directive/booleanAttrs.js | 28 +++++++++---------- src/ng/directive/input.js | 4 +-- src/ng/directive/ngCloak.js | 4 +-- src/ng/directive/ngCsp.js | 4 +-- src/ng/directive/ngPluralize.js | 8 +++--- src/ng/directive/ngRepeat.js | 8 +++--- src/ng/directive/ngShowHide.js | 24 ++++++++-------- src/ng/exceptionHandler.js | 4 +-- src/ng/filter.js | 8 +++--- src/ng/http.js | 24 ++++++++-------- src/ng/interpolate.js | 4 +-- src/ng/parse.js | 4 +-- src/ng/q.js | 16 +++++------ src/ng/rootScope.js | 28 +++++++++---------- src/ngAnimate/animate.js | 24 ++++++++-------- src/ngMock/angular-mocks.js | 52 +++++++++++++++++----------------- src/ngResource/resource.js | 20 +++++++------- src/ngRoute/routeParams.js | 4 +-- 24 files changed, 202 insertions(+), 202 deletions(-) (limited to 'src') diff --git a/src/Angular.js b/src/Angular.js index 04169818..99b6e67b 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -214,14 +214,14 @@ function isArrayLike(obj) { * It is worth noting that `.forEach` does not iterate over inherited properties because it filters * using the `hasOwnProperty` method. * -
+   ```js
      var values = {name: 'misko', gender: 'male'};
      var log = [];
      angular.forEach(values, function(value, key){
        this.push(key + ': ' + value);
      }, log);
      expect(log).toEqual(['name: misko', 'gender: male']);
-   
+ ``` * * @param {Object|Array} obj Object to iterate over. * @param {Function} iterator Iterator function. @@ -374,12 +374,12 @@ function inherit(parent, extra) { * @description * A function that performs no operations. This function can be useful when writing code in the * functional style. -
+   ```js
      function foo(callback) {
        var result = calculateResult();
        (callback || angular.noop)(result);
      }
-   
+ ``` */ function noop() {} noop.$inject = []; @@ -395,11 +395,11 @@ noop.$inject = []; * A function that returns its first argument. This function is useful when writing code in the * functional style. * -
+   ```js
      function transformer(transformationFn, value) {
        return (transformationFn || angular.identity)(value);
      };
-   
+ ``` */ function identity($) {return $;} identity.$inject = []; diff --git a/src/auto/injector.js b/src/auto/injector.js index 977b5774..dcfa2cc3 100644 --- a/src/auto/injector.js +++ b/src/auto/injector.js @@ -16,7 +16,7 @@ * * @example * Typical usage - *
+ * ```js
  *   // create an injector
  *   var $injector = angular.injector(['ng']);
  *
@@ -26,7 +26,7 @@
  *     $compile($document)($rootScope);
  *     $rootScope.$digest();
  *   });
- * 
+ * ``` * * Sometimes you want to get access to the injector of a currently running Angular app * from outside Angular. Perhaps, you want to inject and compile some markup after the @@ -40,7 +40,7 @@ * directive is added to the end of the document body by JQuery. We then compile and link * it into the current AngularJS scope. * - *
+ * ```js
  * var $div = $('
{{content.label}}
'); * $(document.body).append($div); * @@ -48,7 +48,7 @@ * var scope = angular.element($div).scope(); * $compile($div)(scope); * }); - *
+ * ``` */ @@ -110,20 +110,20 @@ function annotate(fn) { * * The following always holds true: * - *
+ * ```js
  *   var $injector = angular.injector();
  *   expect($injector.get('$injector')).toBe($injector);
  *   expect($injector.invoke(function($injector){
  *     return $injector;
  *   }).toBe($injector);
- * 
+ * ``` * * # Injection Function Annotation * * JavaScript does not have annotations, and annotations are needed for dependency injection. The * following are all valid ways of annotating function with injection arguments and are equivalent. * - *
+ * ```js
  *   // inferred (only works if code not minified/obfuscated)
  *   $injector.invoke(function(serviceA){});
  *
@@ -134,7 +134,7 @@ function annotate(fn) {
  *
  *   // inline
  *   $injector.invoke(['serviceA', function(serviceA){}]);
- * 
+ * ``` * * ## Inference * @@ -215,7 +215,7 @@ function annotate(fn) { * The simplest form is to extract the dependencies from the arguments of the function. This is done * by converting the function into a string using `toString()` method and extracting the argument * names. - *
+ * ```js
  *   // Given
  *   function MyController($scope, $route) {
  *     // ...
@@ -223,7 +223,7 @@ function annotate(fn) {
  *
  *   // Then
  *   expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
- * 
+ * ``` * * This method does not work with code minification / obfuscation. For this reason the following * annotation strategies are supported. @@ -232,7 +232,7 @@ function annotate(fn) { * * If a function has an `$inject` property and its value is an array of strings, then the strings * represent names of services to be injected into the function. - *
+ * ```js
  *   // Given
  *   var MyController = function(obfuscatedScope, obfuscatedRoute) {
  *     // ...
@@ -242,7 +242,7 @@ function annotate(fn) {
  *
  *   // Then
  *   expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
- * 
+ * ``` * * # The array notation * @@ -250,7 +250,7 @@ function annotate(fn) { * is very inconvenient. In these situations using the array notation to specify the dependencies in * a way that survives minification is a better choice: * - *
+ * ```js
  *   // We wish to write this (not minification / obfuscation safe)
  *   injector.invoke(function($compile, $rootScope) {
  *     // ...
@@ -272,7 +272,7 @@ function annotate(fn) {
  *   expect(injector.annotate(
  *      ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}])
  *    ).toEqual(['$compile', '$rootScope']);
- * 
+ * ``` * * @param {function|Array.} fn Function for which dependent service names need to * be retrieved as described above. @@ -359,7 +359,7 @@ function annotate(fn) { * The following example shows how to create a simple event tracking service and register it using * {@link auto.$provide#methods_provider $provide.provider()}. * - *
+ * ```js
  *  // Define the eventTracker provider
  *  function EventTrackerProvider() {
  *    var trackingUrl = '/track';
@@ -416,7 +416,7 @@ function annotate(fn) {
  *      expect(postSpy.mostRecentCall.args[1]).toEqual({ 'login': 1 });
  *    }));
  *  });
- * 
+ * ``` */ /** @@ -437,19 +437,19 @@ function annotate(fn) { * * @example * Here is an example of registering a service - *
+ * ```js
  *   $provide.factory('ping', ['$http', function($http) {
  *     return function ping() {
  *       return $http.send('/ping');
  *     };
  *   }]);
- * 
+ * ``` * You would then inject and use this service like this: - *
+ * ```js
  *   someModule.controller('Ctrl', ['ping', function(ping) {
  *     ping();
  *   }]);
- * 
+ * ``` */ @@ -473,7 +473,7 @@ function annotate(fn) { * @example * Here is an example of registering a service using * {@link auto.$provide#methods_service $provide.service(class)}. - *
+ * ```js
  *   var Ping = function($http) {
  *     this.$http = $http;
  *   };
@@ -484,13 +484,13 @@ function annotate(fn) {
  *     return this.$http.get('/ping');
  *   };
  *   $provide.service('ping', Ping);
- * 
+ * ``` * You would then inject and use this service like this: - *
+ * ```js
  *   someModule.controller('Ctrl', ['ping', function(ping) {
  *     ping.send();
  *   }]);
- * 
+ * ``` */ @@ -515,7 +515,7 @@ function annotate(fn) { * * @example * Here are some examples of creating value services. - *
+ * ```js
  *   $provide.value('ADMIN_USER', 'admin');
  *
  *   $provide.value('RoleLookup', { admin: 0, writer: 1, reader: 2 });
@@ -523,7 +523,7 @@ function annotate(fn) {
  *   $provide.value('halfOf', function(value) {
  *     return value / 2;
  *   });
- * 
+ * ``` */ @@ -543,7 +543,7 @@ function annotate(fn) { * * @example * Here a some examples of creating constants: - *
+ * ```js
  *   $provide.constant('SHARD_HEIGHT', 306);
  *
  *   $provide.constant('MY_COLOURS', ['red', 'blue', 'grey']);
@@ -551,7 +551,7 @@ function annotate(fn) {
  *   $provide.constant('double', function(value) {
  *     return value * 2;
  *   });
- * 
+ * ``` */ @@ -577,12 +577,12 @@ function annotate(fn) { * @example * Here we decorate the {@link ng.$log $log} service to convert warnings to errors by intercepting * calls to {@link ng.$log#error $log.warn()}. - *
+ * ```js
  *   $provide.decorator('$log', ['$delegate', function($delegate) {
  *     $delegate.warn = $delegate.error;
  *     return $delegate;
  *   }]);
- * 
+ * ``` */ diff --git a/src/loader.js b/src/loader.js index 7184cb47..cdb092f5 100644 --- a/src/loader.js +++ b/src/loader.js @@ -47,7 +47,7 @@ function setupModuleLoader(window) { * A module is a collection of services, directives, filters, and configuration information. * `angular.module` is used to configure the {@link auto.$injector $injector}. * - *
+     * ```js
      * // Create a new module
      * var myModule = angular.module('myModule', []);
      *
@@ -59,13 +59,13 @@ function setupModuleLoader(window) {
      *   // Configure existing providers
      *   $locationProvider.hashPrefix('!');
      * });
-     * 
+ * ``` * * Then you can create an injector and load your modules like this: * - *
+     * ```js
      * var injector = angular.injector(['ng', 'MyModule'])
-     * 
+ * ``` * * However it's more likely that you'll just use * {@link ng.directive:ngApp ngApp} or @@ -205,7 +205,7 @@ function setupModuleLoader(window) { * Defines an animation hook that can be later used with * {@link ngAnimate.$animate $animate} service and directives that use this service. * - *
+           * ```js
            * module.animation('.animation-name', function($inject1, $inject2) {
            *   return {
            *     eventName : function(element, done) {
@@ -217,7 +217,7 @@ function setupModuleLoader(window) {
            *     }
            *   }
            * })
-           * 
+ * ``` * * See {@link ngAnimate.$animateProvider#register $animateProvider.register()} and * {@link ngAnimate ngAnimate module} for more information. diff --git a/src/ng/animate.js b/src/ng/animate.js index 11a287e6..55eb0a3f 100644 --- a/src/ng/animate.js +++ b/src/ng/animate.js @@ -36,7 +36,7 @@ var $AnimateProvider = ['$provide', function($provide) { * triggered. * * - *
+   * ```js
    *   return {
      *     eventFn : function(element, done) {
      *       //code to run the animation
@@ -46,7 +46,7 @@ var $AnimateProvider = ['$provide', function($provide) {
      *       }
      *     }
      *   }
-   *
+ * ``` * * @param {string} name The name of the animation. * @param {function} factory The factory function that will be executed to return the animation diff --git a/src/ng/cacheFactory.js b/src/ng/cacheFactory.js index 32d179b4..9371ca58 100644 --- a/src/ng/cacheFactory.js +++ b/src/ng/cacheFactory.js @@ -7,7 +7,7 @@ * @description * Factory that constructs cache objects and gives access to them. * - *
+ * ```js
  * 
  *  var cache = $cacheFactory('cacheId');
  *  expect($cacheFactory.get('cacheId')).toBe(cache);
@@ -19,7 +19,7 @@
  *  // We've specified no options on creation
  *  expect(cache.info()).toEqual({id: 'cacheId', size: 2}); 
  * 
- * 
+ * ``` * * * @param {string} cacheId Name or id of the newly created cache. @@ -201,7 +201,7 @@ function $CacheFactoryProvider() { * `$templateCache` service directly. * * Adding via the `script` tag: - *
+ * ```html
  * 
  * 
  *