mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-21 17:00:24 +00:00
doc(typos): fix couple of typos in the docs
Minor documentation fixes. Should not be any code changes. One test changed due to dependency on text in documentation.
This commit is contained in:
parent
f93e9bfa81
commit
a01cf6d39e
14 changed files with 45 additions and 38 deletions
|
|
@ -145,7 +145,7 @@ var _undefined = undefined,
|
|||
* @param {Object|Array} obj Object to iterate over.
|
||||
* @param {function()} iterator Iterator function.
|
||||
* @param {Object} context Object to become context (`this`) for the iterator function.
|
||||
* @returns {Objet|Array} Reference to `obj`.
|
||||
* @returns {Object|Array} Reference to `obj`.
|
||||
*/
|
||||
function forEach(obj, iterator, context) {
|
||||
var key;
|
||||
|
|
@ -875,7 +875,7 @@ function toKeyValue(obj) {
|
|||
|
||||
|
||||
/**
|
||||
* we need our custom mehtod because encodeURIComponent is too agressive and doesn't follow
|
||||
* We need our custom mehtod because encodeURIComponent is too agressive and doesn't follow
|
||||
* http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path
|
||||
* segments:
|
||||
* segment = *pchar
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ function Browser(window, document, body, XHR, $log) {
|
|||
* The listener gets called with either HashChangeEvent object or simple object that also contains
|
||||
* `oldURL` and `newURL` properties.
|
||||
*
|
||||
* NOTE: this api is intended for use only by the $location service. Please use the
|
||||
* Note: this api is intended for use only by the $location service. Please use the
|
||||
* {@link angular.service.$location $location service} to monitor hash changes in angular apps.
|
||||
*
|
||||
* @param {function(event)} listener Listener function to be called when url hash changes.
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ Template.prototype = {
|
|||
* The compilation is a process of walking the DOM tree and trying to match DOM elements to
|
||||
* {@link angular.markup markup}, {@link angular.attrMarkup attrMarkup},
|
||||
* {@link angular.widget widgets}, and {@link angular.directive directives}. For each match it
|
||||
* executes coresponding markup, attrMarkup, widget or directive template function and collects the
|
||||
* executes corresponding markup, attrMarkup, widget or directive template function and collects the
|
||||
* instance functions into a single template function which is then returned.
|
||||
*
|
||||
* The template function can then be used once to produce the view or as it is the case with
|
||||
|
|
@ -118,7 +118,7 @@ Template.prototype = {
|
|||
* root scope is created.
|
||||
* * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the
|
||||
* `template` and call the `cloneAttachFn` function allowing the caller to attach the
|
||||
* cloned elements to the DOM document at the approriate place. The `cloneAttachFn` is
|
||||
* cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is
|
||||
* called as: <br/> `cloneAttachFn(clonedElement, scope)` where:
|
||||
*
|
||||
* * `clonedElement` - is a clone of the original `element` passed into the compiler.
|
||||
|
|
@ -234,7 +234,7 @@ Compiler.prototype = {
|
|||
* not a problem, but under some circumstances the values for data
|
||||
* is not available until after the full view is computed. If such
|
||||
* values are needed before they are computed the order of
|
||||
* evaluation can be change using ng:eval-order
|
||||
* evaluation can be changed using ng:eval-order
|
||||
*
|
||||
* @element ANY
|
||||
* @param {integer|string=} [priority=0] priority integer, or FIRST, LAST constant
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ function getter(instance, path, unboundFn) {
|
|||
for ( var i = 0; i < len; i++) {
|
||||
key = element[i];
|
||||
if (!key.match(/^[\$\w][\$\w\d]*$/))
|
||||
throw "Expression '" + path + "' is not a valid expression for accesing variables.";
|
||||
throw "Expression '" + path + "' is not a valid expression for accessing variables.";
|
||||
if (instance) {
|
||||
lastInstance = instance;
|
||||
instance = instance[key];
|
||||
|
|
@ -202,7 +202,7 @@ function createScope(parent, providers, instanceCache) {
|
|||
* @description
|
||||
* Assigns a value to a property of the current scope specified via `property_chain`. Unlike in
|
||||
* JavaScript, if there are any `undefined` intermediary properties, empty objects are created
|
||||
* and assigned in to them instead of throwing an exception.
|
||||
* and assigned to them instead of throwing an exception.
|
||||
*
|
||||
<pre>
|
||||
var scope = angular.scope();
|
||||
|
|
@ -368,7 +368,7 @@ function createScope(parent, providers, instanceCache) {
|
|||
* parameters, `newValue` and `oldValue`.
|
||||
* @param {(function()|DOMElement)=} [exceptionHanlder=angular.service.$exceptionHandler] Handler
|
||||
* that gets called when `watchExp` or `listener` throws an exception. If a DOMElement is
|
||||
* specified as handler, the element gets decorated by angular with the information about the
|
||||
* specified as a handler, the element gets decorated by angular with the information about the
|
||||
* exception.
|
||||
* @param {boolean=} [initRun=true] Flag that prevents the first execution of the listener upon
|
||||
* registration.
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ angularDirective("ng:bind", function(expression, element){
|
|||
error = formatError(e);
|
||||
});
|
||||
this.$element = oldElement;
|
||||
// If we are HTML than save the raw HTML data so that we don't
|
||||
// If we are HTML then save the raw HTML data so that we don't
|
||||
// recompute sanitization since it is expensive.
|
||||
// TODO: turn this into a more generic way to compute this
|
||||
if (isHtml = (value instanceof HTML))
|
||||
|
|
|
|||
|
|
@ -40,10 +40,10 @@
|
|||
*
|
||||
* @param {number} amount Input to filter.
|
||||
* @param {string=} symbol Currency symbol or identifier to be displayed.
|
||||
* @returns {string} Formated number.
|
||||
* @returns {string} Formatted number.
|
||||
*
|
||||
* @css ng-format-negative
|
||||
* When the value is negative, this css class is applied to the binding making it by default red.
|
||||
* When the value is negative, this css class is applied to the binding making it (by default) red.
|
||||
*
|
||||
* @example
|
||||
<doc:example>
|
||||
|
|
@ -82,7 +82,7 @@ angularFilter.currency = function(amount, currencySymbol){
|
|||
* @description
|
||||
* Formats a number as text.
|
||||
*
|
||||
* If the input is not a number empty string is returned.
|
||||
* If the input is not a number an empty string is returned.
|
||||
*
|
||||
* @param {number|string} number Number to format.
|
||||
* @param {(number|string)=} [fractionSize=2] Number of decimal places to round the number to.
|
||||
|
|
@ -492,7 +492,7 @@ angularFilter.uppercase = uppercase;
|
|||
*
|
||||
* The input is sanitized by parsing the html into tokens. All safe tokens (from a whitelist) are
|
||||
* then serialized back to properly escaped html string. This means that no unsafe input can make
|
||||
* it into the returned string, however since our parser is more strict than a typical browser
|
||||
* it into the returned string, however, since our parser is more strict than a typical browser
|
||||
* parser, it's possible that some obscure input, which would be recognized as valid HTML by a
|
||||
* browser, won't make it through the sanitizer.
|
||||
*
|
||||
|
|
@ -581,7 +581,7 @@ angularFilter.html = function(html, option){
|
|||
*
|
||||
* @description
|
||||
* Finds links in text input and turns them into html links. Supports http/https/ftp/mailto and
|
||||
* plane email address links.
|
||||
* plain email address links.
|
||||
*
|
||||
* @param {string} text Input text.
|
||||
* @returns {string} Html-linkified text.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* @name angular.formatter
|
||||
* @description
|
||||
*
|
||||
* Formatters are used for translating data formats between those used in for display and those used
|
||||
* Formatters are used for translating data formats between those used for display and those used
|
||||
* for storage.
|
||||
*
|
||||
* Following is the list of built-in angular formatters:
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
* focus on the most commonly needed functionality and minimal footprint. For this reason only a
|
||||
* limited number of jQuery methods, arguments and invocation styles are supported.
|
||||
*
|
||||
* NOTE: All element references in angular are always wrapped with jQuery (lite) and are never
|
||||
* Note: All element references in angular are always wrapped with jQuery (lite) and are never
|
||||
* raw DOM references.
|
||||
*
|
||||
* ## Angular's jQuery lite implements these functions:
|
||||
|
|
@ -152,7 +152,7 @@ function JQLiteData(element, key, value) {
|
|||
|
||||
function JQLiteHasClass(element, selector, _) {
|
||||
// the argument '_' is important, since it makes the function have 3 arguments, which
|
||||
// is neede for delegate function to realize the this is a getter.
|
||||
// is needed for delegate function to realize the this is a getter.
|
||||
var className = " " + selector + " ";
|
||||
return ((" " + element.className + " ").replace(/[\n\t]/g, " ").indexOf( className ) > -1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@
|
|||
* Markup extensions do not themselves produce linking functions. Think of markup as a way to
|
||||
* produce shorthand for a {@link angular.widget widget} or a {@link angular.directive directive}.
|
||||
*
|
||||
* The most prominent example of an markup in angular is the built-in double curly markup
|
||||
* `{{expression}}`, which is a shorthand for `<span ng:bind="expression"></span>`.
|
||||
* The most prominent example of a markup in angular is the built-in double curly markup
|
||||
* `{{expression}}`, which is shorthand for `<span ng:bind="expression"></span>`.
|
||||
*
|
||||
* Create custom markup like this:
|
||||
*
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
* @description
|
||||
*
|
||||
* Attribute markup extends the angular compiler in a very similar way as {@link angular.markup}
|
||||
* except that it allows you to modify the state of the attribute text rather then the content of a
|
||||
* except that it allows you to modify the state of the attribute text rather than the content of a
|
||||
* node.
|
||||
*
|
||||
* Create custom attribute markup like this:
|
||||
|
|
@ -138,7 +138,7 @@ angularTextMarkup('option', function(text, textNode, parentElement){
|
|||
*
|
||||
* @description
|
||||
* Using <angular/> markup like {{hash}} in an href attribute makes
|
||||
* the page open to a wrong URL, ff the user clicks that link before
|
||||
* the page open to a wrong URL, if the user clicks that link before
|
||||
* angular has a chance to replace the {{hash}} with actual URL, the
|
||||
* link will be broken and will most likely return a 404 error.
|
||||
* The `ng:href` solves this problem by placing the `href` in the
|
||||
|
|
@ -251,7 +251,8 @@ angularTextMarkup('option', function(text, textNode, parentElement){
|
|||
* </div>
|
||||
* </pre>
|
||||
*
|
||||
* the HTML specs do not require browsers preserve the special attributes such as disabled.(The presense of them means true and absense means false)
|
||||
* The HTML specs do not require browsers to preserve the special attributes such as disabled.
|
||||
* (The presence of them means true and absence means false)
|
||||
* This prevents the angular compiler from correctly retrieving the binding expression.
|
||||
* To solve this problem, we introduce ng:disabled.
|
||||
*
|
||||
|
|
@ -281,7 +282,8 @@ angularTextMarkup('option', function(text, textNode, parentElement){
|
|||
* @name angular.directive.ng:checked
|
||||
*
|
||||
* @description
|
||||
* the HTML specs do not require browsers preserve the special attributes such as checked.(The presense of them means true and absense means false)
|
||||
* The HTML specs do not require browsers to preserve the special attributes such as checked.
|
||||
* (The presence of them means true and absence means false)
|
||||
* This prevents the angular compiler from correctly retrieving the binding expression.
|
||||
* To solve this problem, we introduce ng:checked.
|
||||
* @example
|
||||
|
|
@ -310,7 +312,8 @@ angularTextMarkup('option', function(text, textNode, parentElement){
|
|||
* @name angular.directive.ng:multiple
|
||||
*
|
||||
* @description
|
||||
* the HTML specs do not require browsers preserve the special attributes such as multiple.(The presense of them means true and absense means false)
|
||||
* The HTML specs do not require browsers to preserve the special attributes such as multiple.
|
||||
* (The presence of them means true and absence means false)
|
||||
* This prevents the angular compiler from correctly retrieving the binding expression.
|
||||
* To solve this problem, we introduce ng:multiple.
|
||||
*
|
||||
|
|
@ -345,7 +348,8 @@ angularTextMarkup('option', function(text, textNode, parentElement){
|
|||
* @name angular.directive.ng:readonly
|
||||
*
|
||||
* @description
|
||||
* the HTML specs do not require browsers preserve the special attributes such as readonly.(The presense of them means true and absense means false)
|
||||
* The HTML specs do not require browsers to preserve the special attributes such as readonly.
|
||||
* (The presence of them means true and absence means false)
|
||||
* This prevents the angular compiler from correctly retrieving the binding expression.
|
||||
* To solve this problem, we introduce ng:readonly.
|
||||
* @example
|
||||
|
|
@ -374,7 +378,8 @@ angularTextMarkup('option', function(text, textNode, parentElement){
|
|||
* @name angular.directive.ng:selected
|
||||
*
|
||||
* @description
|
||||
* the HTML specs do not require browsers preserve the special attributes such as selected.(The presense of them means true and absense means false)
|
||||
* The HTML specs do not require browsers to preserve the special attributes such as selected.
|
||||
* (The presence of them means true and absence means false)
|
||||
* This prevents the angular compiler from correctly retrieving the binding expression.
|
||||
* To solve this problem, we introduce ng:selected.
|
||||
* @example
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
* or 'XHR' (instead of {@link angular.service.$xhr}) then you may be changing the model
|
||||
* without angular knowledge and you may need to call '$updateView()' directly.
|
||||
*
|
||||
* NOTE: if you wish to update the view immediately (without delay), you can do so by calling
|
||||
* Note: if you wish to update the view immediately (without delay), you can do so by calling
|
||||
* {@link angular.scope.$eval} at any time from your code:
|
||||
* <pre>scope.$root.$eval()</pre>
|
||||
*
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* @name angular.service.$xhr
|
||||
* @function
|
||||
* @requires $browser $xhr delegates all XHR requests to the `$browser.xhr()`. A mock version
|
||||
* of the $browser exists which allows setting expectaitions on XHR requests
|
||||
* of the $browser exists which allows setting expectations on XHR requests
|
||||
* in your tests
|
||||
* @requires $xhr.error $xhr delegates all non `2xx` response code to this service.
|
||||
* @requires $log $xhr delegates all exceptions to `$log.error()`.
|
||||
|
|
@ -83,7 +83,7 @@
|
|||
* cookie called `XSRF-TOKEN` on first HTTP GET request. On subsequent non-GET requests the server
|
||||
* can verify that the cookie matches `X-XSRF-TOKEN` HTTP header, and therefore be sure that only
|
||||
* JavaScript running on your domain could have read the token. The token must be unique for each
|
||||
* user and must be verifiable by the server (to prevent the JavaScript making up its own tokens).
|
||||
* user and must be verifiable by the server (to prevent the JavaScript making up its own tokens).
|
||||
* We recommend that the token is a digest of your site's authentication cookie with
|
||||
* {@link http://en.wikipedia.org/wiki/Rainbow_table salt for added security}.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -287,7 +287,8 @@ extend(angularValidator, {
|
|||
if (value.match(/^\+\d{2,3} (\(\d{1,5}\))?[\d ]+\d$/)) {
|
||||
return null;
|
||||
}
|
||||
return "Phone number needs to be in 1(987)654-3210 format in North America or +999 (123) 45678 906 internationaly.";
|
||||
return "Phone number needs to be in 1(987)654-3210 format in North America " +
|
||||
"or +999 (123) 45678 906 internationally.";
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* @name angular.widget
|
||||
* @description
|
||||
*
|
||||
* An angular widget can be either a custom attribute that modifies an existing DOM elements or an
|
||||
* An angular widget can be either a custom attribute that modifies an existing DOM element or an
|
||||
* entirely new DOM element.
|
||||
*
|
||||
* During html compilation, widgets are processed after {@link angular.markup markup}, but before
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
* @description
|
||||
* The most common widgets you will use will be in the form of the
|
||||
* standard HTML set. These widgets are bound using the `name` attribute
|
||||
* to an expression. In addition they can have `ng:validate`, `ng:required`,
|
||||
* to an expression. In addition, they can have `ng:validate`, `ng:required`,
|
||||
* `ng:format`, `ng:change` attribute to further control their behavior.
|
||||
*
|
||||
* @usageContent
|
||||
|
|
@ -292,7 +292,7 @@ function compileFormatter(expr) {
|
|||
*
|
||||
* @description
|
||||
* The `ng:format` attribute widget formats stored data to user-readable text and parses the text
|
||||
* back to the stored form. You might find this useful for example if you collect user input in a
|
||||
* back to the stored form. You might find this useful, for example, if you collect user input in a
|
||||
* text field but need to store the data in the model as a list. Check out
|
||||
* {@link angular.formatter formatters} to learn more.
|
||||
*
|
||||
|
|
@ -437,7 +437,7 @@ function noopAccessor() { return { get: noop, set: noop }; }
|
|||
/*
|
||||
* TODO: refactor
|
||||
*
|
||||
* The table bellow is not quite right. In some cases the formatter is on the model side
|
||||
* The table below is not quite right. In some cases the formatter is on the model side
|
||||
* and in some cases it is on the view side. This is a historical artifact
|
||||
*
|
||||
* The concept of model/view accessor is useful for anyone who is trying to develop UI, and
|
||||
|
|
@ -1341,12 +1341,12 @@ angularWidget('@ng:repeat', function(expression, element){
|
|||
* Sometimes it is necessary to write code which looks like bindings but which should be left alone
|
||||
* by angular. Use `ng:non-bindable` to make angular ignore a chunk of HTML.
|
||||
*
|
||||
* NOTE: `ng:non-bindable` looks like a directive, but is actually an attribute widget.
|
||||
* Note: `ng:non-bindable` looks like a directive, but is actually an attribute widget.
|
||||
*
|
||||
* @element ANY
|
||||
*
|
||||
* @example
|
||||
* In this example there are two location where a siple binding (`{{}}`) is present, but the one
|
||||
* In this example there are two location where a simple binding (`{{}}`) is present, but the one
|
||||
* wrapped in `ng:non-bindable` is left alone.
|
||||
*
|
||||
* @example
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@ describe('ValidatorTest', function(){
|
|||
});
|
||||
|
||||
it('Phone', function() {
|
||||
var error = "Phone number needs to be in 1(987)654-3210 format in North America or +999 (123) 45678 906 internationaly.";
|
||||
var error = "Phone number needs to be in 1(987)654-3210 format in North America " +
|
||||
"or +999 (123) 45678 906 internationally.";
|
||||
assertEquals(angular.validator.phone("ab"), error);
|
||||
assertEquals(null, angular.validator.phone("1(408)757-3023"));
|
||||
assertEquals(null, angular.validator.phone("+421 (0905) 933 297"));
|
||||
|
|
|
|||
Loading…
Reference in a new issue