From c2f2587a79aeb77aad66f081cf924a79348a698e Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Wed, 19 Jan 2011 15:42:11 -0800 Subject: fixed example rendering, add tests for it. --- src/services.js | 170 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 85 insertions(+), 85 deletions(-) (limited to 'src/services.js') diff --git a/src/services.js b/src/services.js index 1a7b91ac..aa4a2090 100644 --- a/src/services.js +++ b/src/services.js @@ -11,16 +11,16 @@ function angularServiceInject(name, fn, inject, eager) { * @workInProgress * @ngdoc service * @name angular.service.$window - * + * * @description * Is reference to the browser's window object. While window * is globally available in JavaScript, it causes testability problems, because * it is a global variable. In we always refer to it through the * $window service, so it may be overriden, removed or mocked for testing. - * + * * All expressions are evaluated with respect to current scope so they don't * suffer from window globality. - * + * * @example @@ -32,7 +32,7 @@ angularServiceInject("$window", bind(window, identity, window), [], EAGER); * @ngdoc service * @name angular.service.$document * @requires $window - * + * * @description * Reference to the browser window.document, but wrapped into angular.element(). */ @@ -45,7 +45,7 @@ angularServiceInject("$document", function(window){ * @ngdoc service * @name angular.service.$location * @requires $browser - * + * * @property {string} href * @property {string} protocol * @property {string} host @@ -55,15 +55,15 @@ angularServiceInject("$document", function(window){ * @property {string} hash * @property {string} hashPath * @property {Object.} hashSearch - * + * * @description * Parses the browser location url and makes it available to your application. * Any changes to the url are reflected into $location service and changes to * $location are reflected to url. * Notice that using browser's forward/back buttons changes the $location. - * + * * @example - clear hash | + clear hash | test hash
$location = {{$location}}
@@ -91,7 +91,7 @@ angularServiceInject("$location", function($browser) { * @ngdoc method * @name angular.service.$location#update * @methodOf angular.service.$location - * + * * @description * Update location object * Does not immediately update the browser @@ -127,7 +127,7 @@ angularServiceInject("$location", function($browser) { * @ngdoc method * @name angular.service.$location#updateHash * @methodOf angular.service.$location - * + * * @description * Update location hash part * @see update() @@ -288,13 +288,13 @@ angularServiceInject("$location", function($browser) { * @ngdoc service * @name angular.service.$log * @requires $window - * + * * @description * Is simple service for logging. Default implementation writes the message * into the browser's console (if present). - * + * * This is useful for debugging. - * + * * @example

Reload this page with open console, enter text and hit the log button...

Message: @@ -311,46 +311,46 @@ angularServiceInject("$log", function($window){ * @ngdoc method * @name angular.service.$log#log * @methodOf angular.service.$log - * + * * @description * Write a log message */ log: consoleLog('log'), - + /** * @workInProgress * @ngdoc method * @name angular.service.$log#warn * @methodOf angular.service.$log - * + * * @description * Write a warning message */ warn: consoleLog('warn'), - + /** * @workInProgress * @ngdoc method * @name angular.service.$log#info * @methodOf angular.service.$log - * + * * @description * Write an information message */ info: consoleLog('info'), - + /** * @workInProgress * @ngdoc method * @name angular.service.$log#error * @methodOf angular.service.$log - * + * * @description * Write an error message */ error: consoleLog('error') }; - + function consoleLog(type) { var console = $window.console || {}; var logFn = console[type] || console.log || noop; @@ -374,17 +374,17 @@ angularServiceInject("$log", function($window){ * @ngdoc service * @name angular.service.$exceptionHandler * @requires $log - * + * * @description * Any uncaught exception in is delegated to this service. * The default implementation simply delegates to $log.error which logs it into * the browser console. - * + * * When unit testing it is useful to have uncaught exceptions propagate * to the test so the test will fail rather than silently log the exception * to the browser console. For this purpose you can override this service with - * a simple rethrow. - * + * a simple rethrow. + * * @example */ angularServiceInject('$exceptionHandler', function($log){ @@ -459,9 +459,9 @@ angularServiceInject('$updateView', serviceUpdateViewFactory, ['$browser']); * @name angular.service.$hover * @requires $browser * @requires $document - * + * * @description - * + * * @example */ angularServiceInject("$hover", function(browser, document) { @@ -514,11 +514,11 @@ angularServiceInject("$hover", function(browser, document) { * @workInProgress * @ngdoc service * @name angular.service.$invalidWidgets - * + * * @description * Keeps references to all invalid widgets found during validation. * Can be queried to find whether there are any invalid widgets currently displayed. - * + * * @example */ angularServiceInject("$invalidWidgets", function(){ @@ -608,45 +608,45 @@ function switchRouteMatcher(on, when, dstName) { * @ngdoc service * @name angular.service.$route * @requires $location - * + * * @property {Object} current Name of the current route * @property {Array.} routes List of configured routes - * + * * @description * Watches $location.hashPath and tries to map the hash to an existing route * definition. It is used for deep-linking URLs to controllers and views (HTML partials). - * + * * $route is typically used in conjunction with {@link angular.widget.ng:view ng:view} widget. - * + * * @example

- This example shows how changing the URL hash causes the $route - to match a route against the URL, and the [[ng:include]] pulls in the partial. - Try changing the URL in the input box to see changes. + This example shows how changing the URL hash causes the $route + to match a route against the URL, and the [[ng:include]] pulls in the partial. + Try changing the URL in the input box to see changes.

- + -Chose: -Moby | -Moby: Ch1 | -Gatsby | +Chose: +Moby | +Moby: Ch1 | +Gatsby | Gatsby: Ch4
$location={{$location}}
@@ -664,31 +664,31 @@ angularServiceInject('$route', function(location) { dirty = 0, $route = { routes: routes, - + /** * @workInProgress * @ngdoc method * @name angular.service.$route#onChange * @methodOf angular.service.$route - * + * * @param {function()} fn Function that will be called on route change - * + * * @description * Register a handler function that will be called when route changes */ onChange: bind(onChange, onChange.push), - + /** * @workInProgress * @ngdoc method * @name angular.service.$route#when * @methodOf angular.service.$route - * + * * @param {string} path Route path (matched against $location.hash) * @param {Object} params Mapping information to be assigned to `$route.current` on route * match. * @returns {Object} route object - * + * * @description * Add new route */ @@ -732,9 +732,9 @@ angularServiceInject('$route', function(location) { * @requires $browser * @requires $xhr.error * @requires $log - * + * * @description - * + * * @example */ angularServiceInject('$xhr', function($browser, $error, $log){ @@ -773,9 +773,9 @@ angularServiceInject('$xhr', function($browser, $error, $log){ * @ngdoc service * @name angular.service.$xhr.error * @requires $log - * + * * @description - * + * * @example */ angularServiceInject('$xhr.error', function($log){ @@ -791,9 +791,9 @@ angularServiceInject('$xhr.error', function($log){ * @requires $xhr * @requires $xhr.error * @requires $log - * + * * @description - * + * * @example */ angularServiceInject('$xhr.bulk', function($xhr, $error, $log){ @@ -885,9 +885,9 @@ angularServiceInject('$defer', function($browser, $exceptionHandler, $updateView * @ngdoc service * @name angular.service.$xhr.cache * @requires $xhr - * + * * @description - * + * * @example */ angularServiceInject('$xhr.cache', function($xhr, $defer, $log){ @@ -942,7 +942,7 @@ angularServiceInject('$xhr.cache', function($xhr, $defer, $log){ * @requires $xhr * * @description - * Is a factory which creates a resource object which lets you interact with + * Is a factory which creates a resource object which lets you interact with * RESTful * server-side data sources. * Resource object has action methods which provide high-level behaviors without @@ -1051,7 +1051,7 @@ angularServiceInject('$xhr.cache', function($xhr, $defer, $log){ {get:{method:'JSON', params:{visibility:'@self'}}, replies: {method:'JSON', params:{visibility:'@self', comments:'@comments'}}} ); } - + BuzzController.prototype = { fetch: function() { this.activities = this.Activity.get({userId:this.userId}); @@ -1069,9 +1069,9 @@ angularServiceInject('$xhr.cache', function($xhr, $defer, $log){

- - {{item.actor.name}} - Expand replies: {{item.links.replies[0].count}} + + {{item.actor.name}} + Expand replies: {{item.links.replies[0].count}}

{{item.object.content | html}}
@@ -1091,13 +1091,13 @@ angularServiceInject('$resource', function($xhr){ * @ngdoc service * @name angular.service.$cookies * @requires $browser - * + * * @description * Provides read/write access to browser's cookies. - * + * * Only a simple Object is exposed and by adding or removing properties to/from * this object, new cookies are created/deleted at the end of current $eval. - * + * * @example */ angularServiceInject('$cookies', function($browser) { @@ -1181,7 +1181,7 @@ angularServiceInject('$cookies', function($browser) { * @ngdoc service * @name angular.service.$cookieStore * @requires $cookies - * + * * @description * Provides a key-value (string-object) storage, that is backed by session cookies. * Objects put or retrieved from this storage are automatically serialized or @@ -1196,10 +1196,10 @@ angularServiceInject('$cookieStore', function($store) { * @ngdoc method * @name angular.service.$cookieStore#get * @methodOf angular.service.$cookieStore - * + * * @description * Returns the value of given cookie key - * + * * @param {string} key Id to use for lookup. * @returns {Object} Deserialized cookie value. */ @@ -1212,10 +1212,10 @@ angularServiceInject('$cookieStore', function($store) { * @ngdoc method * @name angular.service.$cookieStore#put * @methodOf angular.service.$cookieStore - * + * * @description * Sets a value for given cookie key - * + * * @param {string} key Id for the `value`. * @param {Object} value Value to be stored. */ @@ -1228,10 +1228,10 @@ angularServiceInject('$cookieStore', function($store) { * @ngdoc method * @name angular.service.$cookieStore#remove * @methodOf angular.service.$cookieStore - * + * * @description * Remove given cookie - * + * * @param {string} key Id of the key-value pair to delete. */ remove: function(key) { -- cgit v1.2.3