diff options
Diffstat (limited to 'src/ng')
| -rw-r--r-- | src/ng/animate.js | 4 | ||||
| -rw-r--r-- | src/ng/cacheFactory.js | 20 | ||||
| -rw-r--r-- | src/ng/compile.js | 28 | ||||
| -rw-r--r-- | src/ng/directive/booleanAttrs.js | 28 | ||||
| -rw-r--r-- | src/ng/directive/input.js | 4 | ||||
| -rw-r--r-- | src/ng/directive/ngCloak.js | 4 | ||||
| -rw-r--r-- | src/ng/directive/ngCsp.js | 4 | ||||
| -rw-r--r-- | src/ng/directive/ngPluralize.js | 8 | ||||
| -rw-r--r-- | src/ng/directive/ngRepeat.js | 8 | ||||
| -rw-r--r-- | src/ng/directive/ngShowHide.js | 24 | ||||
| -rw-r--r-- | src/ng/exceptionHandler.js | 4 | ||||
| -rw-r--r-- | src/ng/filter.js | 8 | ||||
| -rw-r--r-- | src/ng/http.js | 24 | ||||
| -rw-r--r-- | src/ng/interpolate.js | 4 | ||||
| -rw-r--r-- | src/ng/parse.js | 4 | ||||
| -rw-r--r-- | src/ng/q.js | 16 | ||||
| -rw-r--r-- | src/ng/rootScope.js | 28 |
17 files changed, 110 insertions, 110 deletions
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: |
