aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCaitlin Potter2014-02-06 14:02:18 +0000
committerPeter Bacon Darwin2014-02-16 19:03:40 +0000
commitf7d28cd377f06224247b950680517a187a7b6749 (patch)
tree20203b9f7bf60748bb752f325b1869415352a6f3 /src
parent2e641ac49f121a6e2cc70bd3879930b44a8a7710 (diff)
downloadangular.js-f7d28cd377f06224247b950680517a187a7b6749.tar.bz2
docs(all): convert <pre>/</pre> snippets to GFM snippets
Diffstat (limited to 'src')
-rw-r--r--src/Angular.js12
-rw-r--r--src/auto/injector.js60
-rw-r--r--src/loader.js12
-rw-r--r--src/ng/animate.js4
-rw-r--r--src/ng/cacheFactory.js20
-rw-r--r--src/ng/compile.js28
-rw-r--r--src/ng/directive/booleanAttrs.js28
-rw-r--r--src/ng/directive/input.js4
-rw-r--r--src/ng/directive/ngCloak.js4
-rw-r--r--src/ng/directive/ngCsp.js4
-rw-r--r--src/ng/directive/ngPluralize.js8
-rw-r--r--src/ng/directive/ngRepeat.js8
-rw-r--r--src/ng/directive/ngShowHide.js24
-rw-r--r--src/ng/exceptionHandler.js4
-rw-r--r--src/ng/filter.js8
-rw-r--r--src/ng/http.js24
-rw-r--r--src/ng/interpolate.js4
-rw-r--r--src/ng/parse.js4
-rw-r--r--src/ng/q.js16
-rw-r--r--src/ng/rootScope.js28
-rw-r--r--src/ngAnimate/animate.js24
-rw-r--r--src/ngMock/angular-mocks.js52
-rw-r--r--src/ngResource/resource.js20
-rw-r--r--src/ngRoute/routeParams.js4
24 files changed, 202 insertions, 202 deletions
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.
*
- <pre>
+ ```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']);
- </pre>
+ ```
*
* @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.
- <pre>
+ ```js
function foo(callback) {
var result = calculateResult();
(callback || angular.noop)(result);
}
- </pre>
+ ```
*/
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.
*
- <pre>
+ ```js
function transformer(transformationFn, value) {
return (transformationFn || angular.identity)(value);
};
- </pre>
+ ```
*/
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
- * <pre>
+ * ```js
* // create an injector
* var $injector = angular.injector(['ng']);
*
@@ -26,7 +26,7 @@
* $compile($document)($rootScope);
* $rootScope.$digest();
* });
- * </pre>
+ * ```
*
* 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.
*
- * <pre>
+ * ```js
* var $div = $('<div ng-controller="MyCtrl">{{content.label}}</div>');
* $(document.body).append($div);
*
@@ -48,7 +48,7 @@
* var scope = angular.element($div).scope();
* $compile($div)(scope);
* });
- * </pre>
+ * ```
*/
@@ -110,20 +110,20 @@ function annotate(fn) {
*
* The following always holds true:
*
- * <pre>
+ * ```js
* var $injector = angular.injector();
* expect($injector.get('$injector')).toBe($injector);
* expect($injector.invoke(function($injector){
* return $injector;
* }).toBe($injector);
- * </pre>
+ * ```
*
* # 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.
*
- * <pre>
+ * ```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){}]);
- * </pre>
+ * ```
*
* ## 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.
- * <pre>
+ * ```js
* // Given
* function MyController($scope, $route) {
* // ...
@@ -223,7 +223,7 @@ function annotate(fn) {
*
* // Then
* expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
- * </pre>
+ * ```
*
* 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.
- * <pre>
+ * ```js
* // Given
* var MyController = function(obfuscatedScope, obfuscatedRoute) {
* // ...
@@ -242,7 +242,7 @@ function annotate(fn) {
*
* // Then
* expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
- * </pre>
+ * ```
*
* # 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:
*
- * <pre>
+ * ```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']);
- * </pre>
+ * ```
*
* @param {function|Array.<string|Function>} 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()}.
*
- * <pre>
+ * ```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 });
* }));
* });
- * </pre>
+ * ```
*/
/**
@@ -437,19 +437,19 @@ function annotate(fn) {
*
* @example
* Here is an example of registering a service
- * <pre>
+ * ```js
* $provide.factory('ping', ['$http', function($http) {
* return function ping() {
* return $http.send('/ping');
* };
* }]);
- * </pre>
+ * ```
* You would then inject and use this service like this:
- * <pre>
+ * ```js
* someModule.controller('Ctrl', ['ping', function(ping) {
* ping();
* }]);
- * </pre>
+ * ```
*/
@@ -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)}.
- * <pre>
+ * ```js
* var Ping = function($http) {
* this.$http = $http;
* };
@@ -484,13 +484,13 @@ function annotate(fn) {
* return this.$http.get('/ping');
* };
* $provide.service('ping', Ping);
- * </pre>
+ * ```
* You would then inject and use this service like this:
- * <pre>
+ * ```js
* someModule.controller('Ctrl', ['ping', function(ping) {
* ping.send();
* }]);
- * </pre>
+ * ```
*/
@@ -515,7 +515,7 @@ function annotate(fn) {
*
* @example
* Here are some examples of creating value services.
- * <pre>
+ * ```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;
* });
- * </pre>
+ * ```
*/
@@ -543,7 +543,7 @@ function annotate(fn) {
*
* @example
* Here a some examples of creating constants:
- * <pre>
+ * ```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;
* });
- * </pre>
+ * ```
*/
@@ -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()}.
- * <pre>
+ * ```js
* $provide.decorator('$log', ['$delegate', function($delegate) {
* $delegate.warn = $delegate.error;
* return $delegate;
* }]);
- * </pre>
+ * ```
*/
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}.
*
- * <pre>
+ * ```js
* // Create a new module
* var myModule = angular.module('myModule', []);
*
@@ -59,13 +59,13 @@ function setupModuleLoader(window) {
* // Configure existing providers
* $locationProvider.hashPrefix('!');
* });
- * </pre>
+ * ```
*
* Then you can create an injector and load your modules like this:
*
- * <pre>
+ * ```js
* var injector = angular.injector(['ng', 'MyModule'])
- * </pre>
+ * ```
*
* 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.
*
- * <pre>
+ * ```js
* module.animation('.animation-name', function($inject1, $inject2) {
* return {
* eventName : function(element, done) {
@@ -217,7 +217,7 @@ function setupModuleLoader(window) {
* }
* }
* })
- * </pre>
+ * ```
*
* 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.
*
*
- *<pre>
+ * ```js
* return {
* eventFn : function(element, done) {
* //code to run the animation
@@ -46,7 +46,7 @@ var $AnimateProvider = ['$provide', function($provide) {
* }
* }
* }
- *</pre>
+ * ```
*
* @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.
*
- * <pre>
+ * ```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});
*
- * </pre>
+ * ```
*
*
* @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:
- * <pre>
+ * ```html
* <html ng-app>
* <head>
* <script type="text/ng-template" id="templateId.html">
@@ -210,29 +210,29 @@ function $CacheFactoryProvider() {
* </head>
* ...
* </html>
- * </pre>
+ * ```
*
* **Note:** the `script` tag containing the template does not need to be included in the `head` of
* the document, but it must be below the `ng-app` definition.
*
* Adding via the $templateCache service:
*
- * <pre>
+ * ```js
* var myApp = angular.module('myApp', []);
* myApp.run(function($templateCache) {
* $templateCache.put('templateId.html', 'This is the content of the template');
* });
- * </pre>
+ * ```
*
* To retrieve the template later, simply use it in your HTML:
- * <pre>
+ * ```html
* <div ng-include=" 'templateId.html' "></div>
- * </pre>
+ * ```
*
* or get it via Javascript:
- * <pre>
+ * ```js
* $templateCache.get('templateId.html')
- * </pre>
+ * ```
*
* See {@link ng.$cacheFactory $cacheFactory}.
*
diff --git a/src/ng/compile.js b/src/ng/compile.js
index 219f99ae..dd8d001c 100644
--- a/src/ng/compile.js
+++ b/src/ng/compile.js
@@ -50,7 +50,7 @@
*
* Here's an example directive declared with a Directive Definition Object:
*
- * <pre>
+ * ```js
* var myModule = angular.module(...);
*
* myModule.directive('directiveName', function factory(injectables) {
@@ -83,7 +83,7 @@
* };
* return directiveDefinitionObject;
* });
- * </pre>
+ * ```
*
* <div class="alert alert-warning">
* **Note:** Any unspecified options will use the default value. You can see the default values below.
@@ -91,7 +91,7 @@
*
* Therefore the above can be simplified as:
*
- * <pre>
+ * ```js
* var myModule = angular.module(...);
*
* myModule.directive('directiveName', function factory(injectables) {
@@ -102,7 +102,7 @@
* // or
* // return function postLink(scope, iElement, iAttrs) { ... }
* });
- * </pre>
+ * ```
*
*
*
@@ -256,9 +256,9 @@
*
* #### `compile`
*
- * <pre>
+ * ```js
* function compile(tElement, tAttrs, transclude) { ... }
- * </pre>
+ * ```
*
* The compile function deals with transforming the template DOM. Since most directives do not do
* template transformation, it is not used often. Examples that require compile functions are
@@ -301,9 +301,9 @@
* #### `link`
* This property is used only if the `compile` property is not defined.
*
- * <pre>
+ * ```js
* function link(scope, iElement, iAttrs, controller, transcludeFn) { ... }
- * </pre>
+ * ```
*
* The link function is responsible for registering DOM listeners as well as updating the DOM. It is
* executed after the template has been cloned. This is where most of the directive logic will be
@@ -361,7 +361,7 @@
* the only way to easily get the actual value because during the linking phase the interpolation
* hasn't been evaluated yet and so the value is at this time set to `undefined`.
*
- * <pre>
+ * ```js
* function linkingFn(scope, elm, attrs, ctrl) {
* // get the attribute value
* console.log(attrs.ngModel);
@@ -374,7 +374,7 @@
* console.log('ngModel has changed value to ' + value);
* });
* }
- * </pre>
+ * ```
*
* Below is an example using `$compileProvider`.
*
@@ -465,14 +465,14 @@
*
* - If you are not asking the linking function to clone the template, create the DOM element(s)
* before you send them to the compiler and keep this reference around.
- * <pre>
+ * ```js
* var element = $compile('<p>{{total}}</p>')(scope);
- * </pre>
+ * ```
*
* - if on the other hand, you need the element to be cloned, the view reference from the original
* example would not point to the clone, but rather to the original template that was cloned. In
* this case, you can access the clone via the cloneAttachFn:
- * <pre>
+ * ```js
* var templateElement = angular.element('<p>{{total}}</p>'),
* scope = ....;
*
@@ -481,7 +481,7 @@
* });
*
* //now we have reference to the cloned DOM via `clonedElement`
- * </pre>
+ * ```
*
*
* For information on how the compiler works, see the
diff --git a/src/ng/directive/booleanAttrs.js b/src/ng/directive/booleanAttrs.js
index d2ba61df..b49105cd 100644
--- a/src/ng/directive/booleanAttrs.js
+++ b/src/ng/directive/booleanAttrs.js
@@ -16,14 +16,14 @@
* The `ngHref` directive solves this problem.
*
* The wrong way to write it:
- * <pre>
+ * ```html
* <a href="http://www.gravatar.com/avatar/{{hash}}"/>
- * </pre>
+ * ```
*
* The correct way to write it:
- * <pre>
+ * ```html
* <a ng-href="http://www.gravatar.com/avatar/{{hash}}"/>
- * </pre>
+ * ```
*
* @element A
* @param {template} ngHref any string which can contain `{{}}` markup.
@@ -106,14 +106,14 @@
* `{{hash}}`. The `ngSrc` directive solves this problem.
*
* The buggy way to write it:
- * <pre>
+ * ```html
* <img src="http://www.gravatar.com/avatar/{{hash}}"/>
- * </pre>
+ * ```
*
* The correct way to write it:
- * <pre>
+ * ```html
* <img ng-src="http://www.gravatar.com/avatar/{{hash}}"/>
- * </pre>
+ * ```
*
* @element IMG
* @param {template} ngSrc any string which can contain `{{}}` markup.
@@ -132,14 +132,14 @@
* `{{hash}}`. The `ngSrcset` directive solves this problem.
*
* The buggy way to write it:
- * <pre>
+ * ```html
* <img srcset="http://www.gravatar.com/avatar/{{hash}} 2x"/>
- * </pre>
+ * ```
*
* The correct way to write it:
- * <pre>
+ * ```html
* <img ng-srcset="http://www.gravatar.com/avatar/{{hash}} 2x"/>
- * </pre>
+ * ```
*
* @element IMG
* @param {template} ngSrcset any string which can contain `{{}}` markup.
@@ -154,11 +154,11 @@
* @description
*
* The following markup will make the button enabled on Chrome/Firefox but not on IE8 and older IEs:
- * <pre>
+ * ```html
* <div ng-init="scope = { isDisabled: false }">
* <button disabled="{{scope.isDisabled}}">Disabled</button>
* </div>
- * </pre>
+ * ```
*
* The HTML specification does not require browsers to preserve the values of boolean attributes
* such as disabled. (Their presence means true and their absence means false.)
diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js
index ced50167..1a357805 100644
--- a/src/ng/directive/input.js
+++ b/src/ng/directive/input.js
@@ -861,14 +861,14 @@ var VALID_CLASS = 'ng-valid',
* @property {Array.<Function>} $formatters Array of functions to execute, as a pipeline, whenever
the model value changes. Each function is called, in turn, passing the value through to the
next. Used to format / convert values for display in the control and validation.
- * <pre>
+ * ```js
* function formatter(value) {
* if (value) {
* return value.toUpperCase();
* }
* }
* ngModel.$formatters.push(formatter);
- * </pre>
+ * ```
*
* @property {Array.<Function>} $viewChangeListeners Array of functions to execute whenever the
* view value has changed. It is called with no arguments, and its return value is ignored.
diff --git a/src/ng/directive/ngCloak.js b/src/ng/directive/ngCloak.js
index 0ef5090f..42b0224f 100644
--- a/src/ng/directive/ngCloak.js
+++ b/src/ng/directive/ngCloak.js
@@ -18,11 +18,11 @@
* `angular.min.js`.
* For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
*
- * <pre>
+ * ```css
* [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
* display: none !important;
* }
- * </pre>
+ * ```
*
* When this css rule is loaded by the browser, all html elements (including their children) that
* are tagged with the `ngCloak` directive are hidden. When Angular encounters this directive
diff --git a/src/ng/directive/ngCsp.js b/src/ng/directive/ngCsp.js
index 9dc93f81..38508bb4 100644
--- a/src/ng/directive/ngCsp.js
+++ b/src/ng/directive/ngCsp.js
@@ -29,13 +29,13 @@
*
* @example
* This example shows how to apply the `ngCsp` directive to the `html` tag.
- <pre>
+ ```html
<!doctype html>
<html ng-app ng-csp>
...
...
</html>
- </pre>
+ ```
*/
// ngCsp is not implemented as a proper directive any more, because we need it be processed while we bootstrap
diff --git a/src/ng/directive/ngPluralize.js b/src/ng/directive/ngPluralize.js
index a33735e9..d6ad861f 100644
--- a/src/ng/directive/ngPluralize.js
+++ b/src/ng/directive/ngPluralize.js
@@ -36,13 +36,13 @@
*
* The following example shows how to configure ngPluralize:
*
- * <pre>
+ * ```html
* <ng-pluralize count="personCount"
when="{'0': 'Nobody is viewing.',
* 'one': '1 person is viewing.',
* 'other': '{} people are viewing.'}">
* </ng-pluralize>
- *</pre>
+ *```
*
* In the example, `"0: Nobody is viewing."` is an explicit number rule. If you did not
* specify this rule, 0 would be matched to the "other" category and "0 people are viewing"
@@ -62,7 +62,7 @@
* The offset attribute allows you to offset a number by any desired value.
* Let's take a look at an example:
*
- * <pre>
+ * ```html
* <ng-pluralize count="personCount" offset=2
* when="{'0': 'Nobody is viewing.',
* '1': '{{person1}} is viewing.',
@@ -70,7 +70,7 @@
* 'one': '{{person1}}, {{person2}} and one other person are viewing.',
* 'other': '{{person1}}, {{person2}} and {} other people are viewing.'}">
* </ng-pluralize>
- * </pre>
+ * ```
*
* Notice that we are still using two plural categories(one, other), but we added
* three explicit number rules 0, 1 and 2.
diff --git a/src/ng/directive/ngRepeat.js b/src/ng/directive/ngRepeat.js
index f83bb88f..41146fdc 100644
--- a/src/ng/directive/ngRepeat.js
+++ b/src/ng/directive/ngRepeat.js
@@ -30,7 +30,7 @@
* up to and including the ending HTML tag where **ng-repeat-end** is placed.
*
* The example below makes use of this feature:
- * <pre>
+ * ```html
* <header ng-repeat-start="item in items">
* Header {{ item }}
* </header>
@@ -40,10 +40,10 @@
* <footer ng-repeat-end>
* Footer {{ item }}
* </footer>
- * </pre>
+ * ```
*
* And with an input of {@type ['A','B']} for the items variable in the example above, the output will evaluate to:
- * <pre>
+ * ```html
* <header>
* Header A
* </header>
@@ -62,7 +62,7 @@
* <footer>
* Footer B
* </footer>
- * </pre>
+ * ```
*
* The custom start and end points for ngRepeat also support all other HTML directive syntax flavors provided in AngularJS (such
* as **data-ng-repeat-start**, **x-ng-repeat-start** and **ng:repeat-start**).
diff --git a/src/ng/directive/ngShowHide.js b/src/ng/directive/ngShowHide.js
index c4754bee..a6b47b9c 100644
--- a/src/ng/directive/ngShowHide.js
+++ b/src/ng/directive/ngShowHide.js
@@ -11,13 +11,13 @@
* in AngularJS and sets the display style to none (using an !important flag).
* For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
*
- * <pre>
+ * ```html
* <!-- when $scope.myValue is truthy (element is visible) -->
* <div ng-show="myValue"></div>
*
* <!-- when $scope.myValue is falsy (element is hidden) -->
* <div ng-show="myValue" class="ng-hide"></div>
- * </pre>
+ * ```
*
* When the ngShow expression evaluates to false then the ng-hide CSS class is added to the class attribute
* on the element causing it to become hidden. When true, the ng-hide CSS class is removed
@@ -38,7 +38,7 @@
*
* If you wish to change the hide behavior with ngShow/ngHide then this can be achieved by
* restating the styles for the .ng-hide class in CSS:
- * <pre>
+ * ```css
* .ng-hide {
* //!annotate CSS Specificity|Not to worry, this will override the AngularJS default...
* display:block!important;
@@ -48,7 +48,7 @@
* top:-9999px;
* left:-9999px;
* }
- * </pre>
+ * ```
*
* Just remember to include the important flag so the CSS override will function.
*
@@ -64,7 +64,7 @@
* you must also include the !important flag to override the display property
* so that you can perform an animation when the element is hidden during the time of the animation.
*
- * <pre>
+ * ```css
* //
* //a working example can be found at the bottom of this page
* //
@@ -77,7 +77,7 @@
* .my-element.ng-hide-add.ng-hide-add-active { ... }
* .my-element.ng-hide-remove { ... }
* .my-element.ng-hide-remove.ng-hide-remove-active { ... }
- * </pre>
+ * ```
*
* @animations
* addClass: .ng-hide - happens after the ngShow expression evaluates to a truthy value and the just before contents are set to visible
@@ -168,13 +168,13 @@ var ngShowDirective = ['$animate', function($animate) {
* in AngularJS and sets the display style to none (using an !important flag).
* For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
*
- * <pre>
+ * ```hrml
* <!-- when $scope.myValue is truthy (element is hidden) -->
* <div ng-hide="myValue"></div>
*
* <!-- when $scope.myValue is falsy (element is visible) -->
* <div ng-hide="myValue" class="ng-hide"></div>
- * </pre>
+ * ```
*
* When the ngHide expression evaluates to true then the .ng-hide CSS class is added to the class attribute
* on the element causing it to become hidden. When false, the ng-hide CSS class is removed
@@ -195,7 +195,7 @@ var ngShowDirective = ['$animate', function($animate) {
*
* If you wish to change the hide behavior with ngShow/ngHide then this can be achieved by
* restating the styles for the .ng-hide class in CSS:
- * <pre>
+ * ```css
* .ng-hide {
* //!annotate CSS Specificity|Not to worry, this will override the AngularJS default...
* display:block!important;
@@ -205,7 +205,7 @@ var ngShowDirective = ['$animate', function($animate) {
* top:-9999px;
* left:-9999px;
* }
- * </pre>
+ * ```
*
* Just remember to include the important flag so the CSS override will function.
*
@@ -221,7 +221,7 @@ var ngShowDirective = ['$animate', function($animate) {
* you must also include the !important flag to override the display property so
* that you can perform an animation when the element is hidden during the time of the animation.
*
- * <pre>
+ * ```css
* //
* //a working example can be found at the bottom of this page
* //
@@ -234,7 +234,7 @@ var ngShowDirective = ['$animate', function($animate) {
* .my-element.ng-hide-add.ng-hide-add-active { ... }
* .my-element.ng-hide-remove { ... }
* .my-element.ng-hide-remove.ng-hide-remove-active { ... }
- * </pre>
+ * ```
*
* @animations
* removeClass: .ng-hide - happens after the ngHide expression evaluates to a truthy value and just before the contents are set to hidden
diff --git a/src/ng/exceptionHandler.js b/src/ng/exceptionHandler.js
index 13f775ef..c2c77f64 100644
--- a/src/ng/exceptionHandler.js
+++ b/src/ng/exceptionHandler.js
@@ -15,14 +15,14 @@
*
* ## Example:
*
- * <pre>
+ * ```js
* angular.module('exceptionOverride', []).factory('$exceptionHandler', function () {
* return function (exception, cause) {
* exception.message += ' (caused by "' + cause + '")';
* throw exception;
* };
* });
- * </pre>
+ * ```
*
* This example will override the normal action of `$exceptionHandler`, to make angular
* exceptions fail hard when they happen, instead of just logging to the console.
diff --git a/src/ng/filter.js b/src/ng/filter.js
index 8e4254e2..c78f526e 100644
--- a/src/ng/filter.js
+++ b/src/ng/filter.js
@@ -9,7 +9,7 @@
* Dependency Injected. To achieve this a filter definition consists of a factory function which is
* annotated with dependencies and is responsible for creating a filter function.
*
- * <pre>
+ * ```js
* // Filter registration
* function MyModule($provide, $filterProvider) {
* // create a service to demonstrate injection (not always needed)
@@ -28,12 +28,12 @@
* };
* });
* }
- * </pre>
+ * ```
*
* The filter function is registered with the `$injector` under the filter name suffix with
* `Filter`.
*
- * <pre>
+ * ```js
* it('should be the same instance', inject(
* function($filterProvider) {
* $filterProvider.register('reverse', function(){
@@ -43,7 +43,7 @@
* function($filter, reverseFilter) {
* expect($filter('reverse')).toBe(reverseFilter);
* });
- * </pre>
+ * ```
*
*
* For more information about how angular filters work, and how to create your own filters, see
diff --git a/src/ng/http.js b/src/ng/http.js
index aa8c4071..011b33a8 100644
--- a/src/ng/http.js
+++ b/src/ng/http.js
@@ -202,7 +202,7 @@ function $HttpProvider() {
* that is used to generate an HTTP request and returns a {@link ng.$q promise}
* with two $http specific methods: `success` and `error`.
*
- * <pre>
+ * ```js
* $http({method: 'GET', url: '/someUrl'}).
* success(function(data, status, headers, config) {
* // this callback will be called asynchronously
@@ -212,7 +212,7 @@ function $HttpProvider() {
* // called asynchronously if an error occurs
* // or server returns response with an error status.
* });
- * </pre>
+ * ```
*
* Since the returned value of calling the $http function is a `promise`, you can also use
* the `then` method to register callbacks, and these callbacks will receive a single argument –
@@ -241,10 +241,10 @@ function $HttpProvider() {
* POST/PUT requests require request data to be provided as well, shortcut methods
* were created:
*
- * <pre>
+ * ```js
* $http.get('/someUrl').success(successCallback);
* $http.post('/someUrl', data).success(successCallback);
- * </pre>
+ * ```
*
* Complete list of shortcut methods:
*
@@ -369,7 +369,7 @@ function $HttpProvider() {
* resolved with a rejection.
*
*
- * <pre>
+ * ```js
* // register the interceptor as a service
* $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {
* return {
@@ -422,7 +422,7 @@ function $HttpProvider() {
* }
* };
* });
- * </pre>
+ * ```
*
* # Response interceptors (DEPRECATED)
*
@@ -440,7 +440,7 @@ function $HttpProvider() {
* injected with dependencies (if specified) and returns the interceptor — a function that
* takes a {@link ng.$q promise} and returns the original or a new promise.
*
- * <pre>
+ * ```js
* // register the interceptor as a service
* $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {
* return function(promise) {
@@ -466,7 +466,7 @@ function $HttpProvider() {
* // same as above
* }
* });
- * </pre>
+ * ```
*
*
* # Security Considerations
@@ -490,15 +490,15 @@ function $HttpProvider() {
* Angular will automatically strip the prefix before processing it as JSON.
*
* For example if your server needs to return:
- * <pre>
+ * ```js
* ['one','two']
- * </pre>
+ * ```
*
* which is vulnerable to attack, your server can return:
- * <pre>
+ * ```js
* )]}',
* ['one','two']
- * </pre>
+ * ```
*
* Angular will strip the prefix, before processing the JSON.
*
diff --git a/src/ng/interpolate.js b/src/ng/interpolate.js
index 0665fd25..abc54b43 100644
--- a/src/ng/interpolate.js
+++ b/src/ng/interpolate.js
@@ -99,11 +99,11 @@ function $InterpolateProvider() {
* interpolation markup.
*
*
- <pre>
+ ```js
var $interpolate = ...; // injected
var exp = $interpolate('Hello {{name | uppercase}}!');
expect(exp({name:'Angular'}).toEqual('Hello ANGULAR!');
- </pre>
+ ```
*
*
* @param {string} text The text with markup to interpolate.
diff --git a/src/ng/parse.js b/src/ng/parse.js
index f84c8fa7..043be76c 100644
--- a/src/ng/parse.js
+++ b/src/ng/parse.js
@@ -1091,7 +1091,7 @@ function getterFn(path, options, fullExp) {
*
* Converts Angular {@link guide/expression expression} into a function.
*
- * <pre>
+ * ```js
* var getter = $parse('user.name');
* var setter = getter.assign;
* var context = {user:{name:'angular'}};
@@ -1101,7 +1101,7 @@ function getterFn(path, options, fullExp) {
* setter(context, 'newValue');
* expect(context.user.name).toEqual('newValue');
* expect(getter(context, locals)).toEqual('local');
- * </pre>
+ * ```
*
*
* @param {string} expression String expression to compile.
diff --git a/src/ng/q.js b/src/ng/q.js
index 38a63f53..09448fd4 100644
--- a/src/ng/q.js
+++ b/src/ng/q.js
@@ -15,7 +15,7 @@
* From the perspective of dealing with error handling, deferred and promise APIs are to
* asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming.
*
- * <pre>
+ * ```js
* // for the purpose of this example let's assume that variables `$q`, `scope` and `okToGreet`
* // are available in the current lexical scope (they could have been injected or passed in).
*
@@ -47,7 +47,7 @@
* }, function(update) {
* alert('Got notification: ' + update);
* });
- * </pre>
+ * ```
*
* At first it might not be obvious why this extra complexity is worth the trouble. The payoff
* comes in the way of guarantees that promise and deferred APIs make, see
@@ -119,14 +119,14 @@
* Because calling the `then` method of a promise returns a new derived promise, it is easily
* possible to create a chain of promises:
*
- * <pre>
+ * ```js
* promiseB = promiseA.then(function(result) {
* return result + 1;
* });
*
* // promiseB will be resolved immediately after promiseA is resolved and its value
* // will be the result of promiseA incremented by 1
- * </pre>
+ * ```
*
* It is possible to create chains of any length and since a promise can be resolved with another
* promise (which will defer its resolution further), it is possible to pause/defer resolution of
@@ -146,7 +146,7 @@
*
* # Testing
*
- * <pre>
+ * ```js
* it('should simulate promise', inject(function($q, $rootScope) {
* var deferred = $q.defer();
* var promise = deferred.promise;
@@ -166,7 +166,7 @@
* $rootScope.$apply();
* expect(resolvedValue).toEqual(123);
* }));
- * </pre>
+ * ```
*/
function $QProvider() {
@@ -357,7 +357,7 @@ function qFactory(nextTick, exceptionHandler) {
* current promise, you have to "rethrow" the error by returning a rejection constructed via
* `reject`.
*
- * <pre>
+ * ```js
* promiseB = promiseA.then(function(result) {
* // success: do something and resolve promiseB
* // with the old or a new result
@@ -372,7 +372,7 @@ function qFactory(nextTick, exceptionHandler) {
* }
* return $q.reject(reason);
* });
- * </pre>
+ * ```
*
* @param {*} reason Constant, message, exception or an object representing the rejection reason.
* @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`.
diff --git a/src/ng/rootScope.js b/src/ng/rootScope.js
index d5be52b0..6c2cf130 100644
--- a/src/ng/rootScope.js
+++ b/src/ng/rootScope.js
@@ -93,13 +93,13 @@ function $RootScopeProvider(){
* compiled HTML template is executed.)
*
* Here is a simple scope snippet to show how you can interact with the scope.
- * <pre>
+ * ```html
* <file src="./test/ng/rootScopeSpec.js" tag="docs1" />
- * </pre>
+ * ```
*
* # Inheritance
* A scope can inherit from a parent scope, as in this example:
- * <pre>
+ * ```js
var parent = $rootScope;
var child = parent.$new();
@@ -110,7 +110,7 @@ function $RootScopeProvider(){
child.salutation = "Welcome";
expect(child.salutation).toEqual('Welcome');
expect(parent.salutation).toEqual('Hello');
- * </pre>
+ * ```
*
*
* @param {Object.<string, function()>=} providers Map of service factory which need to be
@@ -244,7 +244,7 @@ function $RootScopeProvider(){
*
*
* # Example
- * <pre>
+ * ```js
// let's assume that scope was dependency injected as the $rootScope
var scope = $rootScope;
scope.name = 'misko';
@@ -293,7 +293,7 @@ function $RootScopeProvider(){
scope.$digest();
expect(scope.foodCounter).toEqual(1);
- * </pre>
+ * ```
*
*
*
@@ -372,7 +372,7 @@ function $RootScopeProvider(){
*
*
* # Example
- * <pre>
+ * ```js
$scope.names = ['igor', 'matias', 'misko', 'james'];
$scope.dataCount = 4;
@@ -391,7 +391,7 @@ function $RootScopeProvider(){
//now there's been a change
expect($scope.dataCount).toEqual(3);
- * </pre>
+ * ```
*
*
* @param {string|Function(scope)} obj Evaluated as {@link guide/expression expression}. The
@@ -520,7 +520,7 @@ function $RootScopeProvider(){
* In unit tests, you may need to call `$digest()` to simulate the scope life cycle.
*
* # Example
- * <pre>
+ * ```js
var scope = ...;
scope.name = 'misko';
scope.counter = 0;
@@ -538,7 +538,7 @@ function $RootScopeProvider(){
scope.name = 'adam';
scope.$digest();
expect(scope.counter).toEqual(1);
- * </pre>
+ * ```
*
*/
$digest: function() {
@@ -717,14 +717,14 @@ function $RootScopeProvider(){
* expressions.
*
* # Example
- * <pre>
+ * ```js
var scope = ng.$rootScope.Scope();
scope.a = 1;
scope.b = 2;
expect(scope.$eval('a+b')).toEqual(3);
expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);
- * </pre>
+ * ```
*
* @param {(string|function())=} expression An angular expression to be executed.
*
@@ -800,7 +800,7 @@ function $RootScopeProvider(){
* ## Life cycle
*
* # Pseudo-Code of `$apply()`
- * <pre>
+ * ```js
function $apply(expr) {
try {
return $eval(expr);
@@ -810,7 +810,7 @@ function $RootScopeProvider(){
$root.$digest();
}
}
- * </pre>
+ * ```
*
*
* Scope's `$apply()` method transitions through the following stages:
diff --git a/src/ngAnimate/animate.js b/src/ngAnimate/animate.js
index c257921b..fbf05162 100644
--- a/src/ngAnimate/animate.js
+++ b/src/ngAnimate/animate.js
@@ -37,7 +37,7 @@
*
* Below is an example of how to apply animations to a directive that supports animation hooks:
*
- * <pre>
+ * ```html
* <style type="text/css">
* .slide.ng-enter, .slide.ng-leave {
* -webkit-transition:0.5s linear all;
@@ -55,7 +55,7 @@
* to trigger the CSS transition/animations
* -->
* <ANY class="slide" ng-include="..."></ANY>
- * </pre>
+ * ```
*
* Keep in mind that if an animation is running, any child elements cannot be animated until the parent element's
* animation has completed.
@@ -67,7 +67,7 @@
*
* The following code below demonstrates how to perform animations using **CSS transitions** with Angular:
*
- * <pre>
+ * ```html
* <style type="text/css">
* /&#42;
* The animate class is apart of the element and the ng-enter class
@@ -95,11 +95,11 @@
* <div class="view-container">
* <div ng-view class="reveal-animation"></div>
* </div>
- * </pre>
+ * ```
*
* The following code below demonstrates how to perform animations using **CSS animations** with Angular:
*
- * <pre>
+ * ```html
* <style type="text/css">
* .reveal-animation.ng-enter {
* -webkit-animation: enter_sequence 1s linear; /&#42; Safari/Chrome &#42;/
@@ -118,7 +118,7 @@
* <div class="view-container">
* <div ng-view class="reveal-animation"></div>
* </div>
- * </pre>
+ * ```
*
* Both CSS3 animations and transitions can be used together and the animate service will figure out the correct duration and delay timing.
*
@@ -136,7 +136,7 @@
* the animation. The style property expected within the stagger class can either be a **transition-delay** or an
* **animation-delay** property (or both if your animation contains both transitions and keyframe animations).
*
- * <pre>
+ * ```css
* .my-animation.ng-enter {
* /&#42; standard transition code &#42;/
* -webkit-transition: 1s linear all;
@@ -157,7 +157,7 @@
* /&#42; standard transition styles &#42;/
* opacity:1;
* }
- * </pre>
+ * ```
*
* Staggering animations work by default in ngRepeat (so long as the CSS class is defined). Outside of ngRepeat, to use staggering animations
* on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this
@@ -166,7 +166,7 @@
*
* The following code will issue the **ng-leave-stagger** event on the element provided:
*
- * <pre>
+ * ```js
* var kids = parent.children();
*
* $animate.leave(kids[0]); //stagger index=0
@@ -180,7 +180,7 @@
* $animate.leave(kids[5]); //stagger index=0
* $animate.leave(kids[6]); //stagger index=1
* }, 100, false);
- * </pre>
+ * ```
*
* Stagger animations are currently only supported within CSS-defined animations.
*
@@ -188,7 +188,7 @@
* In the event that you do not want to use CSS3 transitions or CSS3 animations or if you wish to offer animations on browsers that do not
* yet support CSS transitions/animations, then you can make use of JavaScript animations defined inside of your AngularJS module.
*
- * <pre>
+ * ```js
* //!annotate="YourApp" Your AngularJS Module|Replace this or ngModule with the module that you used to define your application.
* var ngModule = angular.module('YourApp', ['ngAnimate']);
* ngModule.animation('.my-crazy-animation', function() {
@@ -217,7 +217,7 @@
* removeClass: function(element, className, done) { }
* };
* });
- * </pre>
+ * ```
*
* JavaScript-defined animations are created with a CSS-like class selector and a collection of events which are set to run
* a javascript callback function. When an animation is triggered, $animate will look for a matching animation which fits
diff --git a/src/ngMock/angular-mocks.js b/src/ngMock/angular-mocks.js
index 1c276f29..fe25254f 100644
--- a/src/ngMock/angular-mocks.js
+++ b/src/ngMock/angular-mocks.js
@@ -195,7 +195,7 @@ angular.mock.$Browser.prototype = {
* information.
*
*
- * <pre>
+ * ```js
* describe('$exceptionHandlerProvider', function() {
*
* it('should capture log messages and exceptions', function() {
@@ -216,7 +216,7 @@ angular.mock.$Browser.prototype = {
* });
* });
* });
- * </pre>
+ * ```
*/
angular.mock.$ExceptionHandlerProvider = function() {
@@ -327,10 +327,10 @@ angular.mock.$LogProvider = function() {
* Array of messages logged using {@link ngMock.$log#log}.
*
* @example
- * <pre>
+ * ```js
* $log.log('Some Log');
* var first = $log.log.logs.unshift();
- * </pre>
+ * ```
*/
$log.log.logs = [];
/**
@@ -341,10 +341,10 @@ angular.mock.$LogProvider = function() {
* Array of messages logged using {@link ngMock.$log#info}.
*
* @example
- * <pre>
+ * ```js
* $log.info('Some Info');
* var first = $log.info.logs.unshift();
- * </pre>
+ * ```
*/
$log.info.logs = [];
/**
@@ -355,10 +355,10 @@ angular.mock.$LogProvider = function() {
* Array of messages logged using {@link ngMock.$log#warn}.
*
* @example
- * <pre>
+ * ```js
* $log.warn('Some Warning');
* var first = $log.warn.logs.unshift();
- * </pre>
+ * ```
*/
$log.warn.logs = [];
/**
@@ -369,10 +369,10 @@ angular.mock.$LogProvider = function() {
* Array of messages logged using {@link ngMock.$log#error}.
*
* @example
- * <pre>
+ * ```js
* $log.error('Some Error');
* var first = $log.error.logs.unshift();
- * </pre>
+ * ```
*/
$log.error.logs = [];
/**
@@ -383,10 +383,10 @@ angular.mock.$LogProvider = function() {
* Array of messages logged using {@link ngMock.$log#debug}.
*
* @example
- * <pre>
+ * ```js
* $log.debug('Some Error');
* var first = $log.debug.logs.unshift();
- * </pre>
+ * ```
*/
$log.debug.logs = [];
};
@@ -606,7 +606,7 @@ function padNumber(num, digits, trim) {
* incomplete we might be missing some non-standard methods. This can result in errors like:
* "Date.prototype.foo called on incompatible Object".
*
- * <pre>
+ * ```js
* var newYearInBratislava = new TzDate(-1, '2009-12-31T23:00:00Z');
* newYearInBratislava.getTimezoneOffset() => -60;
* newYearInBratislava.getFullYear() => 2010;
@@ -615,7 +615,7 @@ function padNumber(num, digits, trim) {
* newYearInBratislava.getHours() => 0;
* newYearInBratislava.getMinutes() => 0;
* newYearInBratislava.getSeconds() => 0;
- * </pre>
+ * ```
*
*/
angular.mock.TzDate = function (offset, timestamp) {
@@ -961,7 +961,7 @@ angular.mock.dump = function(object) {
* The following code shows how to setup and use the mock backend when unit testing a controller.
* First we create the controller under test:
*
- <pre>
+ ```js
// The controller code
function MyController($scope, $http) {
var authToken;
@@ -982,11 +982,11 @@ angular.mock.dump = function(object) {
});
};
}
- </pre>
+ ```
*
* Now we setup the mock backend and create the test specs:
*
- <pre>
+ ```js
// testing controller
describe('MyController', function() {
var $httpBackend, $rootScope, createController;
@@ -1052,7 +1052,7 @@ angular.mock.dump = function(object) {
$httpBackend.flush();
});
});
- </pre>
+ ```
*/
angular.mock.$HttpBackendProvider = function() {
this.$get = ['$rootScope', createHttpBackendMock];
@@ -1441,9 +1441,9 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
* Typically, you would call this method following each test case that asserts requests using an
* "afterEach" clause.
*
- * <pre>
+ * ```js
* afterEach($httpBackend.verifyNoOutstandingExpectation);
- * </pre>
+ * ```
*/
$httpBackend.verifyNoOutstandingExpectation = function() {
$rootScope.$digest();
@@ -1462,9 +1462,9 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
* Typically, you would call this method following each test case that asserts requests using an
* "afterEach" clause.
*
- * <pre>
+ * ```js
* afterEach($httpBackend.verifyNoOutstandingRequest);
- * </pre>
+ * ```
*/
$httpBackend.verifyNoOutstandingRequest = function() {
if (responses.length) {
@@ -1726,7 +1726,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
* To setup the application to run with this http backend, you have to create a module that depends
* on the `ngMockE2E` and your application modules and defines the fake backend:
*
- * <pre>
+ * ```js
* myAppDev = angular.module('myAppDev', ['myApp', 'ngMockE2E']);
* myAppDev.run(function($httpBackend) {
* phones = [{name: 'phone1'}, {name: 'phone2'}];
@@ -1741,7 +1741,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
* $httpBackend.whenGET(/^\/templates\//).passThrough();
* //...
* });
- * </pre>
+ * ```
*
* Afterwards, bootstrap your app with this new module.
*/
@@ -2010,7 +2010,7 @@ if(window.jasmine || window.mocha) {
*
* ## Example
* Example of what a typical jasmine tests looks like with the inject method.
- * <pre>
+ * ```js
*
* angular.module('myApplicationModule', [])
* .value('mode', 'app')
@@ -2044,7 +2044,7 @@ if(window.jasmine || window.mocha) {
* });
* });
*
- * </pre>
+ * ```
*
* @param {...Function} fns any number of functions which will be injected using the injector.
*/
diff --git a/src/ngResource/resource.js b/src/ngResource/resource.js
index a75aab61..2ee9cbbc 100644
--- a/src/ngResource/resource.js
+++ b/src/ngResource/resource.js
@@ -156,13 +156,13 @@ function shallowClearAndCopy(src, dst) {
* instance of the resource class. The actions `save`, `remove` and `delete` are available on it
* as methods with the `$` prefix. This allows you to easily perform CRUD operations (create,
* read, update, delete) on server-side data like this:
- * <pre>
+ * ```js
var User = $resource('/user/:userId', {userId:'@id'});
var user = User.get({userId:123}, function() {
user.abc = true;
user.$save();
});
- </pre>
+ ```
*
* It is important to realize that invoking a $resource object method immediately returns an
* empty reference (object or array depending on `isArray`). Once the data is returned from the
@@ -206,7 +206,7 @@ function shallowClearAndCopy(src, dst) {
*
* # Credit card resource
*
- * <pre>
+ * ```js
// Define CreditCard class
var CreditCard = $resource('/user/:userId/card/:cardId',
{userId:123, cardId:'@id'}, {
@@ -239,7 +239,7 @@ function shallowClearAndCopy(src, dst) {
// POST: /user/123/card {number:'0123', name:'Mike Smith'}
// server returns: {id:789, number:'0123', name: 'Mike Smith'};
expect(newCard.id).toEqual(789);
- * </pre>
+ * ```
*
* The object returned from this function execution is a resource "class" which has "static" method
* for each action in the definition.
@@ -250,19 +250,19 @@ function shallowClearAndCopy(src, dst) {
* all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD
* operations (create, read, update, delete) on server-side data.
- <pre>
+ ```js
var User = $resource('/user/:userId', {userId:'@id'});
var user = User.get({userId:123}, function() {
user.abc = true;
user.$save();
});
- </pre>
+ ```
*
* It's worth noting that the success callback for `get`, `query` and other methods gets passed
* in the response that came from the server as well as $http header getter function, so one
* could rewrite the above example and get access to http headers as:
*
- <pre>
+ ```js
var User = $resource('/user/:userId', {userId:'@id'});
User.get({userId:123}, function(u, getResponseHeaders){
u.abc = true;
@@ -271,11 +271,11 @@ function shallowClearAndCopy(src, dst) {
//putResponseHeaders => $http header getter
});
});
- </pre>
+ ```
* # Creating a custom 'PUT' request
* In this example we create a custom method on our resource to make a PUT request
- * <pre>
+ * ```js
* var app = angular.module('app', ['ngResource', 'ngRoute']);
*
* // Some APIs expect a PUT request in the format URL/object/ID
@@ -300,7 +300,7 @@ function shallowClearAndCopy(src, dst) {
*
* // This will PUT /notes/ID with the note object in the request payload
* }]);
- * </pre>
+ * ```
*/
angular.module('ngResource', ['ng']).
factory('$resource', ['$http', '$q', function($http, $q) {
diff --git a/src/ngRoute/routeParams.js b/src/ngRoute/routeParams.js
index 977a26bc..81347bae 100644
--- a/src/ngRoute/routeParams.js
+++ b/src/ngRoute/routeParams.js
@@ -27,14 +27,14 @@ ngRouteModule.provider('$routeParams', $RouteParamsProvider);
* Instead you can use `$route.current.params` to access the new route's parameters.
*
* @example
- * <pre>
+ * ```js
* // Given:
* // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby
* // Route: /Chapter/:chapterId/Section/:sectionId
* //
* // Then
* $routeParams ==> {chapterId:1, sectionId:2, search:'moby'}
- * </pre>
+ * ```
*/
function $RouteParamsProvider() {
this.$get = function() { return {}; };