Compare commits

...

677 Commits

Author SHA1 Message Date
Peter Bacon Darwin e201f9040f docs(CHANGELOG): update with 1.3.19 changes 2015-09-15 13:34:09 +01:00
Peter Bacon Darwin 40e9bcd1b4 chore(scripts/publish): get dist-tag from package.json
Closes #12722
2015-09-14 21:45:20 +01:00
Matias Niemelä f98e038418 feat(ngAnimate): introduce $animate.flush for unit testing 2015-09-14 13:08:57 -07:00
Lucas Galfaso ec98c94ccb fix($parse): throw error when accessing a restricted property indirectly
When accessing an instance thru a computed member and the property is an array,
then also check the string value of the array.

Closes #12833
2015-09-13 16:35:46 +01:00
Pawel Kozlowski f13055a0a5 fix($http): propagate status -1 for timed out requests
Fixes #4491
Closes #8756
2015-09-07 14:34:10 +01:00
Peter Bacon Darwin 623ce1ad2c fix($location): don't crash if navigating outside the app base
Previously, if you navigate outside of the Angular application, say be clicking
the back button, the $location service would try to handle the url change
and error due to the URL not being valid for the application.

This fixes that issue by ensuring that a reload happens when you navigate
to a URL that is not within the application.

Closes #11667
2015-09-07 14:33:17 +01:00
Peter Bacon Darwin 34cf141838 refactor($location): compute appBaseNoFile only once 2015-09-07 14:33:17 +01:00
Martin Staffa 274e93537e fix(ngModel): validate pattern against the viewValue
Since the HTML5 pattern validation constraint validates the input value,
we should also validate against the viewValue. While this worked in
core up to Angular 1.2, in 1.3, we changed not only validation,
but the way `input[date]` and `input[number]` are handled - they parse
their input values into `Date` and `Number` respectively, which cannot
be validated by a regex.

Fixes #12344

BREAKING CHANGE:

The `ngPattern` and `pattern` directives will validate the regex
against the `viewValue` of `ngModel`, i.e. the value of the model
before the $parsers are applied. Previously, the modelValue
(the result of the $parsers) was validated.

This fixes issues where `input[date]` and `input[number]` cannot
be validated because the viewValue string is parsed into
`Date` and `Number` respectively (starting with Angular 1.3).
It also brings the directives in line with HTML5 constraint
validation, which validates against the input value.

This change is unlikely to cause applications to fail, because even
in Angular 1.2, the value that was validated by pattern could have
been manipulated by the $parsers, as all validation was done
inside this pipeline.

If you rely on the pattern being validated against the modelValue,
you must create your own validator directive that overwrites
the built-in pattern validator:

```
.directive('patternModelOverwrite', function patternModelOverwriteDirective() {
  return {
    restrict: 'A',
    require: '?ngModel',
    priority: 1,
    compile: function() {
      var regexp, patternExp;

      return {
        pre: function(scope, elm, attr, ctrl) {
          if (!ctrl) return;

          attr.$observe('pattern', function(regex) {
            /**
             * The built-in directive will call our overwritten validator
             * (see below). We just need to update the regex.
             * The preLink fn guaranetees our observer is called first.
             */
            if (isString(regex) && regex.length > 0) {
              regex = new RegExp('^' + regex + '$');
            }

            if (regex && !regex.test) {
              //The built-in validator will throw at this point
              return;
            }

            regexp = regex || undefined;
          });

        },
        post: function(scope, elm, attr, ctrl) {
          if (!ctrl) return;

          regexp, patternExp = attr.ngPattern || attr.pattern;

          //The postLink fn guarantees we overwrite the built-in pattern validator
          ctrl.$validators.pattern = function(value) {
            return ctrl.$isEmpty(value) ||
              isUndefined(regexp) ||
              regexp.test(value);
          };
        }
      };
    }
  };
});
```
2015-08-28 10:57:07 +02:00
Matias Niemelä f7622dcc0d docs(CHANGELOG): add changes for 1.3.18 2015-08-18 15:14:56 -07:00
Matias Niemelä 2c03a35743 fix($animate): clear class animations cache if animation is not started
Closes #12604
Closes #12603
2015-08-17 17:09:00 -07:00
Matias Niemelä 6b72598b87 fix($animate): do not throw errors if element is removed before animation starts
Closes #10205
2015-08-17 17:06:54 -07:00
Rouven Weßling 51e24d75c3 refactor(): remove more bits and pieces related to Internet Explorer 8
Closes #12407
2015-08-08 18:08:47 +02:00
Martin Staffa 64a142b58e fix(ngModel): correct minErr usage for correct doc creation
Remove the `new` from the minErr assignment, so the closure compiler
can detect the errors correctly. Also removes the leading $ from the
variable name to be consistent with the Angular.js file.

Closes #12386
Closes #12416
2015-08-08 18:08:15 +02:00
Martin Staffa 0026ebf2de docs($rootScope.Scope): remove obsolete line, and link to guide
The removed line pointed to a removed example. Re-adding the example
would have been of questionable value, as it introduced several
concepts without context. It's therefore better to link to the guide,
which provides a better introduction.

Closes #12167
2015-08-03 22:07:59 +02:00
Eric Adams a4f73c9f99 docs(guide/Dependency Injection): fix angular.injector arguments list
The original file included a code sample using `angular.injector(['myModule', 'ng'])`,
which appears to be incorrect when trying to retrieve anything attached to `myModule`.
Reversing the args fixes this.

Closes #12292
2015-08-03 22:06:35 +02:00
Satish Maurya bd5c4e5f0e docs(guide/Forms): display scope form / master data in examples
It will be good to have the binding results in the CSS classes /
binding to form / control state example, similar to the Simple Form
example.

Closes #12326
2015-08-03 22:06:27 +02:00
Steven 9742565d61 docs(guide): Facebook was mispelled as Faceb0ok
Fixes typo :>

Closes #12470
2015-08-03 22:05:45 +02:00
Strikeskids 6f33dfa8cc docs($rootScope.Scope): improve clarity describing $watch with no listener
The previous explanation in parentheses created a bit of confusion because the documentation stated to leave off the `listener`, but then said "be prepared for multiple calls to your listener". The new explanation clarifies that it is indeed the `watchExpression` that will be executed multiple times.

Closes #12429
2015-08-03 22:05:36 +02:00
Laisky.Cai 96f0c8df17 docs(guide/expression): replace tt by code
Replaces <tt> elements with <code> in expressions guide. Looks identical
in Chromium

Closes #12437

Conflicts:
	docs/content/guide/expression.ngdoc
2015-08-03 22:04:40 +02:00
Martin Staffa 53fb534889 docs(ngOptions): remove obsolete trkslct error page
Closes #12417
2015-08-03 22:02:33 +02:00
Blake Johnston 6271ac064c docs($compile): pluralize DOM element
Previous description includes singular `collection of DOM element`. Current change revises `element` to be plural.

Closes #12431
2015-08-03 22:02:25 +02:00
ColinFletch 2d71b5b053 docs(guide/Controllers): Syntax adjustments.
Closes #12379
2015-08-03 22:02:13 +02:00
Jesse Mandel a547dff09b docs(guide/module): fixed link to blog post 2015-07-19 16:38:37 +02:00
Andrew Passanisi 3f9517ea5b docs(error/ctrlfmt): fixed a small typo in ctrl error message
Closes #12320
2015-07-16 22:45:47 +02:00
Mohamed Samy 8b4ffdde7a docs(tutorial/7 - Routing): fix matching in test
It is corrected in github, but not in the angular.org site.
Copied it from https://github.com/angular/angular-phonecat/compare/step-6...step-7

Closes #12314
2015-07-16 22:45:40 +02:00
Nabil Kadimi e57240d87d docs(guide/Dependency Injection): minor punctuation fixes
Closes #12268
2015-07-16 22:45:29 +02:00
shoja a51b4e6dc4 docs($sce): correct typos
Line 548: Remove duplicate 'not' and clarify wording
Line 556: Remove period within parenthetical statement
Line 560: Clarify wording
Line 570: Capitalize 'E.g.' at the start of a sentence

Closes #12252
2015-07-16 22:45:21 +02:00
Steve Mao 215be0b0ab docs(CONTRIBUTING): revert is a modifier
EG: https://github.com/angular/angular.js/commit/462f444b06ae5cad3ccb761b1dba7131df01a655

Closes #12032
2015-07-13 13:26:45 +01:00
Steve Mao 7c5880f998 docs(CONTRIBUTING): state what is mandatory or optional
Closes #12032
2015-07-13 13:25:45 +01:00
Steve Mao 0d941a986a docs(CONTRIBUTING): how to write a breaking change
Closes #12032
2015-07-13 13:25:45 +01:00
Peter Bacon Darwin 8714cabdb7 docs(guide/controller): add a line about controller as 2015-07-13 13:22:28 +01:00
Peter Bacon Darwin cbab2923ef docs(guide/controller): add a line about controller as 2015-07-13 13:20:28 +01:00
niteshthakur dba7e20e96 docs(guide/controller): clarify that controllers are defined **by** a constructor function
A controller is a instantiated object created **from** a constructor function.
It was not accurate to describe a Controller **as** a constructor function.

Closes #11888
2015-07-13 13:20:28 +01:00
Peter Bacon Darwin 24dd9ea649 docs($routeChangeSuccess): note that resolve values are available on current route
Closes #11413
2015-07-13 13:11:15 +01:00
Rouven Weßling 8bd59a593b refactor(ngCsp): use document.head
The `head` property is available from IE9 onwards.

Closes #11905
2015-07-13 10:07:52 +01:00
Martin Staffa 9a1349d2e0 docs(CHANGLOG): add changes for 1.3.17 2015-07-06 22:22:45 +02:00
Raphael Jamet 7e6155a6f1 refactor($templateRequest): Remove useless dependencies in tests 2015-07-01 12:16:14 -07:00
Raphael Jamet 0f034444c3 docs($templateRequest): update the description with caching changes
The previous changes to $templateRequest were not documented, they now are.
2015-07-01 12:16:03 -07:00
Raphael Jamet 74ecea9f2d refactor($templateRequest): move $sce checks and trust the cache
Move all the calls to $sce.getTrustedUrl inside $templateRequest, and
also trust the contents of the cache. This allows prefetching templates
and to bypass the checks on things where they make no sense, like
templates specified in script tags.

Closes #12219
Closes #12220
Closes #12240
2015-07-01 12:15:57 -07:00
Peter Bacon Darwin 8d5c08c6b8 chore(doc-gen): update to dgeni-packages 0.10.17
Make proper use of the new `git` package in dgeni-packages
2015-06-23 05:10:21 -07:00
Tsuyoshi Yoshizawa 0bb57d538f fix($location): allow navigating outside the original base URL
Previously, if you navigated outside of the current base URL angular
crashed with a `Cannot call method 'charAt' of undefined` error.

Closes #11302
Closes #4776
2015-06-19 18:41:47 +01:00
Peter Bacon Darwin 61a3fb676a fix($browser): prevent infinite digest if changing hash when there is no hashPrefix
The `window.location.hash' setter will strip of a single leading hash character
if it exists from the fragment  before joining the fragment value to the href
with a new hash character.

This meant that if we want the fragment to lead with a hash character, we
must do `window.location.hash = '##test'` to ensure that the first hash
character in the fragment is not lost.

The `$location.hash` setter works differently and assumes that the value
passed is the the full fragment, i.e. it does not attempt to strip off a
single leading hash character.

Previously, if you called, `$location.hash('#test')`, the leading hash was
being stripped and the resulting url fragment did not contain this hash:
`$location.hash()`, then became 'test' rather than `#test`, which led to
an infinite digest.

Closes #10423
Closes #12145
2015-06-17 14:02:31 +01:00
Peter Bacon Darwin f486ebe80b fix($location): do not get caught in infinite digest in IE9
Thanks to @hamfastgamgee for getting this fix in place.

Closes #11439
Closes #11675
Closes #11935
Closes #12083
2015-06-12 14:42:40 +01:00
Peter Bacon Darwin 03190fd896 chore(ngMock): check that ngMock.$browser.pollFns exists before emptying 2015-06-12 14:42:30 +01:00
Caitlin Potter 340e4da2eb test($location): ensure mock window can be wrapped by jqLite
Fixin da build

Closes #12086
2015-06-12 14:37:54 +01:00
Peter Bacon Darwin 46e4fa87fb test($locationSpec): refactor and clean up tests 2015-06-12 14:37:33 +01:00
Peter Bacon Darwin 45d43b9234 test($logSpec): don't pollute the global namespace with helpers 2015-06-11 14:32:35 +01:00
Conny Sjöblom 6b28aef1c5 fix(linky): allow case insensitive scheme detection
Closes #12073
Closes #12074
2015-06-11 12:16:07 +01:00
Matias Niemelä 5a1b4a06f4 docs(CHANGELOG): add changes for 1.3.16 2015-06-05 13:29:27 -07:00
Matias Niemelä 12f08c5e14 docs(CHANGELOG): update with 1.4.0 2015-06-05 13:19:37 -07:00
Chris Akers 706a93ab69 fix($cookies): update $cookies to prevent duplicate cookie writes and play nice with external code
Update the ngCookies service to prevent repetitive writes via $browser.cookies()
Also it is possible for $cookies to get confused about cookies modified outside of $cookies and
see those changes as user changes via the $cookies service which would then be set again. This
unnecessary setting of cookies can duplicate or overwrite depending on the original cookie's
domain. This update prevents that scenario.

Closes #11490
Closes #11515
2015-06-04 22:46:10 -07:00
Henry Zhu c4ae7d261a chore(jscs): remove .jscs.json.todo, rename config to .jscsrc
Closes #11993
2015-06-02 10:32:24 +01:00
Matias Niemelä 0adc036426 fix(core): ensure that multiple requests to requestAnimationFrame are buffered
IE11 (and maybe some other browsers) do not optimize multiple calls to
rAF. This code makes that happen internally within the $$rAF service
before the next frame kicks in.

Closes #11791
2015-06-01 07:42:05 -07:00
Ron Tsui 1ee58612a2 docs(README): improve unusual phrasing
Closes #11958
2015-06-01 08:01:53 +01:00
Yi EungJun ddc7f85493 docs(guide/Directives): use more standard data-ng-model in example
Use data-ng-model instead of data-ng:model which is accepted for legacy reason.
The next "Normalization" section is saying:

> Best Practice: Prefer using the dash-delimited format (e.g. ng-bind for
> ngBind). If you want to use an HTML validating tool, you can instead use the
> data-prefixed version (e.g. data-ng-bind for ngBind). The other forms
> shown above are accepted for legacy reasons but we advise you to avoid
> them.

Closes #11960
2015-06-01 07:59:26 +01:00
Daniel 90621a6c89 docs(numberFilter): update to match handling of null and undefined
This changed in 2ae10f67fc, where null and
undefined are passed through.

Closes #11963
2015-06-01 07:57:16 +01:00
Michael Watts 0c59599a45 docs(guide/Scopes): capitalisation of word scope
Closes #11970
2015-06-01 07:50:27 +01:00
Peter Bacon Darwin 4a4db1e7e6 docs(README.closure.md): clarify sentence
Closes #11979
2015-06-01 07:48:50 +01:00
pholly 10d8b010d3 docs(guide/Expressions): added special case for one-time binding of object literals under Value stabilization algorithm
One time binding of object literals are treated differently than simple expressions. Added a link to Ben Nadel's article describing how object literals's keys are checked for undefined.

Closes #11982
2015-06-01 07:42:46 +01:00
Matias Niemelä 3881831906 revert: fix(ngAnimate): throw an error if a callback is passed to animate methods
This reverts commit 39b078bad4.
2015-05-21 12:09:31 -07:00
Peter Bacon Darwin 9e3f82bbaf fix(select): prevent unknown option being added to select when bound to null property
If a select directive was bound, using ng-model, to a property with a value of null this would
result in an unknown option being added to the select element with the value "? object:null ?".
This change prevents a null value from adding an unknown option meaning that the extra option is
not added as a child of the select element.

Since select (without ngOptions) can only have string value options then `null` was never a
viable option value, so this is not a breaking change.

Closes #11872
Closes #11875
2015-05-18 22:42:16 +01:00
Peter Bacon Darwin 05156143c8 docs(error//nocb): add error doc for invalid parameter 2015-05-14 14:01:27 -07:00
Peter Bacon Darwin 39b078bad4 fix(ngAnimate): throw an error if a callback is passed to animate methods
As of bf0f550 (released in 1.3.0) it is no longer
valid to pass a callback to the following functions: `enter`, `move`, `leave`, `addClass`,
`removeClass`, `setClass` and `animate`.

To prevent confusing error messages, this change asserts that this parameter is
not a function.

Closes #11826
Closes #11713
2015-05-14 14:01:22 -07:00
Peter Bacon Darwin 9055b4e041 docs(CHANGELOG): update with 1.4.0-rc.2 2015-05-12 19:53:44 +01:00
Martin Staffa 6224a3eefb Revert "perf(ngStyleDirective): use $watchCollection"
This reverts commit 4c8d8ad508,
because it broke lazy one-time binding for object literals.

Closes #11613
2015-05-08 18:54:35 +02:00
Martin Staffa a45a34c261 test(ngStyle): ensure lazy one-time binding is supported
Closes #11405
2015-05-08 18:54:34 +02:00
Peter Bacon Darwin ceeeb6b4b1 docs(angular.element): clarify when jquery must be loaded for Angular to use it
Closes #3716
2015-05-05 20:03:44 +01:00
Nick Anderson cbc5f1c114 test(ngRepeat): fix test setup for ngRepeat stability test
The repeated template contained `{{key}}:{{val}}` but the repeat expression
was `"item in items"`, so `key` and `val` were not actually available.

The tests were passing anyway, since they did not rely upon the actual
text content of the template.

Closes #11761
2015-05-05 19:58:38 +01:00
Peter Bacon Darwin 4dfb80d96f docs($location): fix trailing whitespace
Closes #11741
Closes #11744
2015-05-05 19:54:35 +01:00
Damien Nozay 368039b881 docs($location): explain difference between $location.host() and location.host.
Closes #11741
Closes #11744
2015-05-05 19:52:10 +01:00
Rich Snapp 647f3f55eb fix(jqLite): check for "length" in obj in isArrayLike to prevent iOS8 JIT bug from surfacing
Closes #11508
2015-05-05 17:55:20 +01:00
Peter Bacon Darwin c8de0e425f docs($injector): add array annotation to all injectable parameters
Closes #11507
2015-05-05 15:05:03 +01:00
Kevin Brogan 9717c8fe1f docs($provide): add array annotation type to $provide.decorator parameter
The $provide.decorator function, as per the documentation, "is called using
the auto.injector.invoke method and is therefore fully injectable."

The current @param contradicts this by stating that only a functions may
be used as an argument.

Closes #11507
2015-05-05 15:04:53 +01:00
Martin Staffa fee437f9cf docs(changelog): wrap jqLite example containing html with code block
This prevents the markdown parser from garbling the input and putting
out broken html.

Closes #11778
Fixes #11777
Fixes #11539
2015-05-01 21:00:44 +01:00
Leonardo Braga 861b1a3d9d docs(ngModel): improve formatting of $modelValue
Closes #11483
2015-04-30 22:55:21 +02:00
Rodrigo Parra 72ff49f40f docs(ngSwitch): Replace tt tag with code tag
Use of tt is discouraged, see:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tt
http://www.w3.org/wiki/HTML/Elements/tt

Closes #11509
2015-04-30 22:55:21 +02:00
Jeff Wesson 7a529992c8 docs(form): replace obsolete tt element
Removes the [**obsolete** HTML Teletype Text Element `<tt>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tt)
and replaces it with [`<code>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/code).
This adds more semanticity and is part of the [HTML5 specification](http://www.w3.org/TR/html5/text-level-semantics.html#the-code-element).

Closes #11570
2015-04-30 22:55:21 +02:00
Steve Mao e89d6829bc docs(ngCloak): remove information for ie7
IE7 is not supported. Also change `#template2` text to `'world'`.

Closes #11661
2015-04-30 22:55:20 +02:00
Ron Tsui 1b343e7bb6 style(docs): improve formatting in code comment
Closes #11674
2015-04-30 22:55:20 +02:00
thatType b3c022d672 docs(contribute): transpose "however" and "it's"
Transpose "however" and "it's" on line 156 for slightly better readability

Closes #11686
2015-04-30 22:55:20 +02:00
Georgios Kalpakas 9dd0fe35d1 fix(filterFilter): fix matching against null/undefined
Included fixes:

* Do not convert `null`/`undefined` to strings for substring matching in
  non-strict comparison mode. Prevents `null`/`undefined` from being matched
  against e.g. 'u'.
* Let `null` (as a top-level filter expression) match "deeply" (as do booleans,
  numbers and strings).
  E.g. let `filterFilter(arr, null)` match an item like `{someProp: null}`.

Fixes #11573

Closes #11617
2015-04-28 19:52:28 +02:00
Mike Calvanese 7560a8d2d6 fix(ngTouch): check undefined tagName for SVG event target
When target click element is an SVG, event.target.tagName and event.target.blur are undefined in Chrome v40 on iOS 8.1.3
2015-04-27 22:05:26 +01:00
gonengar c68357dbf8 docs(guide/Unit Testing): fixing the example for testing filter.
Hi there,
It seems that in the example which starts at line 256 there needs to
be an injection for $filter as in the previous example.

Closes #11410
2015-04-27 22:41:37 +02:00
Logesh Paul eaf6981499 docs(*): definition list readability improvement
Closes #11398
Closes #11187
2015-04-27 22:41:36 +02:00
Viktor Zozulyak 1cc24f3c4f docs(angular.injector): missing optional parameter mark
Closes #11528
2015-04-27 22:41:35 +02:00
yankee42 9e3e26328e docs(ngModel): use arguments.length instead of angular.isDefined(newName) to distinguish getter/setter usage
Closes #11604
2015-04-27 22:41:34 +02:00
Adam 82b2961868 docs(angular.element): css() api incompatibility.
"When a number is passed as the value, jQuery will convert it to a string and add px to the end of that string."
http://api.jquery.com/css/#css2

jqLite does not appear to do this.

I can submit if fix desired.

Closes #11614
2015-04-27 22:41:33 +02:00
Bruno Coelho 3cb10edca0 docs(guide/Scopes): remove unnecessary parenthesis
Closes #11645
2015-04-27 22:41:32 +02:00
Martin Staffa b64519fea7 fix(ngModel): allow setting model to NaN when asyncValidator is present
Closes #11315
Closes #11411
2015-04-03 07:12:39 +01:00
Peter Bacon Darwin 830c81d0f1 chore(dependencies): general update (including new dgeni-packages)
Closes #11095
2015-04-03 06:03:55 +01:00
Peter Bacon Darwin 66650bfb36 docs(toJson): improve option param documentation
With an upgrade to dgeni-packages 0.10.13, this style of optional param
is rendered more correctly.

See #11095
2015-04-03 06:03:44 +01:00
Peter Bacon Darwin 900b3a416c style($browserSpec): fix typo 2015-04-02 22:50:59 +01:00
Georgios Kalpakas f40252205e test(browerTrigger): ensure touch events initialize correctly on touch enabled Chrome
On certain browsers (e.g. on desktop Chrome with touch-events enabled),
using the `initTouchEvent()` method (introduced in 06a9f0a) did not
correctly initialize the event, nor did the event get dispatched on
the target element.

Using the `Event` constructor and manually attaching a `TouchList`,
works around the issue (although not a proper fix).

Fixes #11471
Closes #11493
2015-04-02 21:24:12 +01:00
Michał Gołębiowski 40441f6dfc fix(ngTouch): register touches properly when jQuery is used
If jQuery was used with Angular the touch logic was looking for touches
under the original event object. However, jQuery wraps all events, keeping
the original one under the originalEvent property and copies/normalizes some
of event properties. Not all properties are copied, e.g. touches which caused
them to not be recognized properly.

Thanks to @mcmar & @pomerantsev for original patch ideas.

Fixes #4001
Closes #8584
Closes #10797
Closes #11488
2015-04-02 14:06:08 +01:00
Michał Gołębiowski 1f65087126 feat(travis): run unit tests on iOS 8
Refs #11471
Closes #11479
2015-04-02 13:27:23 +01:00
Matias Niemelä d5c99ea42b fix(ngAnimate): ensure that minified repaint code isn't removed
Closes #9936
2015-03-31 14:04:00 -07:00
Peter Bacon Darwin bbc5fdde50 style(): remove unused property 2015-03-26 13:12:03 +00:00
Fred Sauer b5685e23f0 docs($route): add param info for $routeUpdate event
Closes #11419
2015-03-25 14:42:10 +00:00
Peter Bacon Darwin 5b26521de2 docs(filters): clarify filter name restrictions
See #10122
2015-03-23 11:59:38 +00:00
Martin Staffa abfbfd6c1c docs($compile): clarify link fn's controller argument
Also add "bindToController" to exampe directive definition object.

Closes #10815

Conflicts:
	src/ng/compile.js
2015-03-22 18:16:36 +01:00
Bradley Price a0e91c4ef7 docs($http): remove trailing comma
Remove trailing comma to keep the same flow with all other code examples on page.
2015-03-22 18:13:48 +01:00
wiseleo 3353fb84aa docs(orderBy): replace operator = with ===
Fix documentation error on line 20 incorrectly mentioning
an assignment operator in a comparison operation.
Code on line 235 uses strict comparison operator.

Closes #11392
Closes #11393
2015-03-22 18:13:48 +01:00
Yuvraj Patil 3a22c6461d docs(guide/Unit Testing): update Jasmine's description
Jasmine is a "behavior-driven development framework",
not a "test-driven development framework"

Closes #11383
2015-03-21 14:39:44 +01:00
Martin Staffa 54f5d82d4f docs(guide/scope): fix grammar
Closes #9829
2015-03-21 14:39:43 +01:00
Martin Staffa e80434c93f docs(guide/direcive): don't use shorthand in ddo
All the other examples use the full syntax.
Closes #11180
2015-03-21 14:39:43 +01:00
RaphStein 7dd5d7a523 docs(ngAria): change aria-live attribute value from polite to assertive
For ngMessages directive ngAria generates aria-live with value assertive and not polite.

Closes #11280
2015-03-21 14:39:43 +01:00
Wesley Cho 6198c0d9c0 docs($httpBackend): change to more friendly language
- Change s**t to more neutral word

Closes #11380
Closes #11364
2015-03-20 10:56:48 +00:00
Julie Ralph 1acde764d5 chore(ci): fix location of print logs from wait_for_browser_provider 2015-03-19 14:41:35 -07:00
Julie Ralph 3bdb39f667 chore(test): bump Protractor version to 2.0.0 2015-03-19 13:29:55 -07:00
Peter Bacon Darwin f231dda29d docs(input[number]): clarify that model must be of type number
The docs also now link through to the error doc, which contains a runnable
example of how to work around this restriction.

Closes #11157
Closes #11334
2015-03-19 14:35:16 +00:00
Peter Bacon Darwin 03f858ea5c chore(docs): improve error doc layout and linking
You can now link to an error by its name, namespace:name or error:namespace:name.
For example these would all link to https://docs.angularjs.org/error/$compile/ctreq

```
{@link ctreq}
{@link $compile:ctreq}
{@link error:$compile:ctreq}
```
2015-03-19 14:35:16 +00:00
Peter Bacon Darwin 4a26249946 docs(error/ngModel/numfmt): provide documentation for this error
See: https://github.com/angular/angular.js/commit/db044c408a7f8082758b96ab739348810c36e15a#commitcomment-7577199

Closes #11157
Closes #11334
2015-03-19 14:35:16 +00:00
Julie Ralph 06364c8cdc chore(ci): force travis to print logs after driver provider timeout
Travis does not do the after_script step if before_script fails,
so wait_for_browser_provider.sh was not printing out logs.
Force it to print them manually.
2015-03-17 16:58:19 -07:00
Martin Staffa 1c282af5ab fix(ngAria): handle elements with role="checkbox/menuitemcheckbox"
Fixes #11317
Closes #11321
2015-03-17 21:43:19 +00:00
Julie Ralph 45f006f6fb chore(ci): make wait_for_browser_provider time out after 2 minutes
Before, if something went wrong, wait_for_browser_provider.sh would
wait indefinitely, and logs would never get printed. Now, we'll bail
early, and get some actual logs on what the problem was.

Closes #11350
2015-03-17 20:40:22 +00:00
Peter Bacon Darwin 731e1f6534 fix($http): throw error if success and error methods do not receive a function
Closes #11330
Closes #11333
2015-03-17 19:14:28 +00:00
Wesley Cho 634e467172 fix($compile): throw error on invalid directive name
Directive names must start with a lower case letter.
Previously the compiler would quietly fail.
This change adds an assertion that fails if this is not the case.

Closes #11281
Closes #11109
2015-03-17 13:53:24 +00:00
Peter Bacon Darwin 2ca34a0cd3 docs(CHANGELOG): add changes for 1.4.0-beta.6 and 1.3.15 2015-03-17 12:08:27 +00:00
robiferentz 181e5ebc3f fix(jqLite): attr should ignore comment, text and attribute nodes
Follow jQuery handling of the `attr` function

Close #11038
2015-03-17 11:47:37 +00:00
svershin 874392464b docs(misc/Downloading): update o latest stable version
Updated the CDN link and description to 1.3.14

Closes #11327
2015-03-15 21:01:49 +00:00
rodyhaddad 7e7244402d chore(security): add warning banner to top of security sensitive files 2015-03-15 20:42:43 +00:00
Julie Ralph 4b94b9e34f chore(ci): bump sc version to 4.3.7 2015-03-13 09:36:28 -07:00
Izhaki a2e7f54320 docs(guide/directives): add some extra sub-headings for clarity
Added `Normalization` and `Directive types`` subheadings
to the `Matching directive` heading
2015-03-12 22:37:51 +01:00
Ciro Nunes 9b2e11b6fa docs($templateCache): highlight the $templateCache service
Closes #11294
2015-03-12 22:37:50 +01:00
Devyn Stott 2114a50c9a docs($log): Add debug button to example
Add debug button to example. It was in teh docs but not the example.

No breaking changes.
2015-03-12 22:37:49 +01:00
Marcin Wosinek 38f92c3a27 docs(ngMessage): move up ngMessages link 2015-03-12 22:37:47 +01:00
Amy 7dbf1ef2d1 docs(guide/Conceptual Overview): add a hyphen for clarity
Minor change, but the heading for "View independent business logic..."
would be more clear if it had a hyphen, "View-independent".
Perhaps it's because I'm new to javascript and its terminology,
but I read "View" as a verb rather than a noun on the first pass and
had to read on a bit to understand that it was, instead,
referring to The View. If you go just by grammar rules,
making "view independent" into the compound adjective,
"view-independent", makes it clear that it is modifying "business logic".
(http://www.grammarbook.com/punctuation/hyphens.asp - see Rule 1).

Conflicts:
	docs/content/guide/concepts.ngdoc
2015-03-12 22:37:46 +01:00
Peter Bacon Darwin e13aae1ed0 test(ngMock): test shallow copy of mock controller bindings
See #11239
2015-03-12 19:59:09 +00:00
Julie Ralph 36eacb172a chore(ci): turn off verbose logging for sauce connect
We have not used the verbose data from these logs for months,
and it makes the Travis UI very slow.
2015-03-11 10:55:02 -07:00
Peter Bacon Darwin f2683f956f fix(date filter): display localised era for G format codes
This implementation is limited to displaying only AD (CE) years correctly,
since we do not support the `u` style year format that can be used to represent
dates before 1 AD.

Closes #10503
Closes #11266
2015-03-11 12:19:00 +00:00
Peter Bacon Darwin 1a670aa466 chore(ngLocale): regenerate locale files to include ERA info 2015-03-11 12:18:42 +00:00
Peter Bacon Darwin 578425303f fix(ng/$locale): add ERA info in generic locale
This change also updates the closure i18n converter to pull in the ERA
info for generated locale files.
2015-03-11 12:18:17 +00:00
Rouven Weßling 528cf09e3f fix(rootScope): prevent memory leak when destroying scopes
Closes #11173
Closes #11169
2015-03-09 14:56:45 +00:00
bborowin c849098fbf docs($compile): clarify when require will throw
To make things less confusing, explicitly state that require
WILL NOT throw a compile error if a link function is not specified.

Closes #11206
stackoverflow.com/questions/28730346/require-ddo-option-of-angular-directive-does-not-throw-an-error-when-it-should
2015-03-08 20:42:39 +01:00
Edward Delaporte 145d397988 docs(orderBy): Start with a simpler example.
Per the question raised at this Stack Overflow question:
http://stackoverflow.com/questions/24048590/angularjs-ng-repeat-orderby-date-not-working

The first example on this page is too complex to convey
the simplest possible case for using this function.

Closes #11144
2015-03-08 18:54:40 +01:00
Elliot Bentley 26d4d0dc22 docs(ngDisabled): Clarify "incorrect" example
Add obvious label to example of incorrect usage.
To a user scanning the docs (ie. me) it's easy to miss the fact
that this top example doesn't actually work.

Closes #11192
2015-03-08 18:54:27 +01:00
jmarkevicius 64a9faaf8e docs(guide/Animations): change *then* to *than* 2015-03-08 14:00:46 +01:00
Anthony Zotti b7aba16839 docs(form): Add comma to line 319 for readability
Line 319 is hard to read on the first glimpse.

Currently the sentence reads:
"In Angular forms can be nested"

The sentence should read either
"In Angular, forms can be nested"
or
"Forms can be nested in angular"

I changed it to the former in this pull request.

Closes #11271
2015-03-08 14:00:46 +01:00
b0ri5 a72e1c4767 docs(tutorial/0 - Bootstrapping): Add a "the" before "imperative / manual way"
I'm assuming "imperative / manual" is modifying "way" in which case I think "the" is needed.

I don't really know grammar, but as a native speaker it sounds odd without "the".

Closes #11269
2015-03-08 14:00:46 +01:00
Martin Staffa 6545212d24 docs(tutorial/0 - Bootstrapping): clarify where the callback is registered
Closes #11270
2015-03-08 14:00:45 +01:00
Peter Bacon Darwin 3fabbdb804 docs(isNumber): fix link to isFinite 2015-03-06 11:58:11 +00:00
Peter Bacon Darwin ce8be9c47f docs(isNumber): add info about using isFinite to exclude NaN
Closes #11230
2015-03-06 11:36:26 +00:00
Caitlin Potter b3878a36d9 feat(ngMock): allow mock $controller service to set up controller bindings
Adds a new mock for the $controller service, in order to simplify testing using the
bindToController feature.

```js
var dictionaryOfControllerBindings = {
  data: [
    { id: 0, phone: '...', name: '...' },
    { id: 1, phone: '...', name: '...' },
  ]
};

// When the MyCtrl constructor is called, `this.data ~= dictionaryOfControllerBindings.data`
$controller(MyCtrl, myLocals, dictionaryOfControllerBindings);
```

Closes #9425
Closes #11239
2015-03-06 10:55:33 +00:00
gdi2290 ebd84e8008 fix($animate): applyStyles from options on leave
Closes #10068
2015-03-04 14:26:38 +00:00
Peter Bacon Darwin e721169738 chore(privateMocks): use global angular to access helpers in they
When using `they` in modules such as `ngMessages` we do not have access to
the internal helper functions.
2015-03-04 13:13:34 +00:00
Matias Niemelä cdfbe25c00 chore(privateMocks): replace multiple occurrences of $prop for they() 2015-03-04 12:28:07 +00:00
Peter Bacon Darwin 0d4b15a4c9 chore(gruntFile): add tthey and xthey to ddescribe-iit check 2015-03-04 12:28:07 +00:00
Peter Bacon Darwin 0dd061c239 style(privateMocks): remove unnecessary comment 2015-03-04 12:28:06 +00:00
Peter Bacon Darwin 7288be25a7 feat(ngMock): add they helpers for testing multiple specs
There are now three new test helpers: `they`, `tthey` and `xthey`, which
will create multiple `it`, `iit` and `xit` blocks, respectively, parameterized
by each item in a collection that is passed.

(with tests and ammendments by @petebacondarwin)

Closes #10864
2015-03-04 12:27:45 +00:00
Steve Mao 2b279dd8a1 docs(CONTRIBUTING): add whitespaces for consistent styling
Closes #11214
2015-03-04 12:26:46 +00:00
Casey Howard 63b9956faf fix(filterFilter): Fix filtering using an object expression when the filter value is undefined
Fixes #10419
Closes #10424
2015-03-02 22:19:14 +00:00
Caitlin Potter 92767c098f fix($browser): don't crash if history.state access causes error in IE
Reportedly, MSIE can throw under certain conditions when fetching this attribute.
We don't have a reliable reproduction for this but it doesn't do any real harm
to wrap access to this variable in a try-catch block.

Fixes #10367
Closes #10369
2015-03-02 20:30:06 +00:00
Brian Ford 2fe9b1dd9e docs(TRIAGING.md): improve process around PRs plz! label
Closes #10375
2015-03-02 19:43:46 +00:00
Marcy Sutton b9ad91cf1e feat(ngAria): add button role to ngClick
Closes #9254
Closes #10318
2015-03-02 13:49:17 +00:00
Peter Bacon Darwin 40752a520a test(aria): clean up test style and rename helper
Also removes unnecessary calls to `$apply`
2015-03-02 13:49:17 +00:00
Marcy Sutton 21369943fa feat(ngAria): add roles to custom inputs
This change adds the missing roles: `slider`, `radio`, `checkbox`

Closes #10012
Closes #10318
2015-03-02 13:49:17 +00:00
Jason Bedard 190ea883c5 fix(form): allow dynamic form names which initially evaluate to blank
Conflicts:
	src/ng/directive/form.js

Closes #11096
2015-03-01 16:35:04 +01:00
Josh Kramer 3a093123ef docs(ngModel): fix contenteditable description
contenteditable is supported in many more browsers than Angular itself is.

http://caniuse.com/#feat=contenteditable

Closes #11172
2015-02-28 18:05:42 +01:00
Pawel Kozlowski b8e8f9af78 fix(Angular): properly compare RegExp with other objects for equality
Fixes #11204

Closes #11205
2015-02-28 10:58:41 +01:00
Dav 01161a0e9f fix(filterFilter): do not throw an error if property is null when comparing objects
Closes #10991
Closes #10992
Closes #11116
2015-02-27 21:47:46 +00:00
Adam Bradley 75abbd525f fix(templateRequest): avoid throwing syntax error in Android 2.3
Android 2.3 throws an `Uncaught SyntaxError: Unexpected token finally`
pointing at this line. Change `.finally` to bracket notation.

Fixes #11089
Closes #11051
Closes #11088
2015-02-25 16:40:19 +00:00
Julie Ralph 01a725a769 chore(ci): update Karma to 0.12.32-beta.0
This will hopefully make the CI more stable because of its updated
version of socket.io.
2015-02-24 13:16:06 -08:00
Peter Bacon Darwin f5781dbb60 docs(CHANGELOG): add changes for 1.4.0-beta.5 and 1.3.14 2015-02-24 17:52:09 +00:00
Peter Bacon Darwin 59205d7809 chore(bower/publish): run local precommit script if available
Closes #11164
2015-02-24 17:22:45 +00:00
Martin Staffa 0cf170df16 chore(grunt): use path.normalize in grunt shell:npm-install
This makes the command runnable on Windows clients.
2015-02-23 20:51:37 +01:00
Tero Parviainen 05a3b088fd docs(ngRepeat): extend description of tracking and duplicates
Add a section to the documentation on how tracking between items and DOM
elements is done, and why duplicates are not allowed in the collection.

Describe how the default tracking behaviour can be substituted with track by.

Tweak the wording in the `track by` section to discuss “tracking expressions”
instead of “tracking functions”.

Closes #8153
2015-02-23 20:17:09 +01:00
Martin Staffa 65df5da07a docs(ngDisabled): clarify the explanation of attributes & interpolation
Closes #11032
Closes #11133
2015-02-22 22:17:22 +01:00
Igor Minar 0689c3697f chore(npm): update dependencies 2015-02-21 19:03:50 -08:00
Igor Minar 0f53c29954 chore(travis,grunt): extract the npm install and cache busting logic into install-dependencies.sh
So now we are DRY.

Added extra error checking and improved the grunt file init setup so that stdio is visible in console.

Closes #11110
2015-02-21 18:55:19 -08:00
Igor Minar 11bfe85598 chore(grunt): blow away cached node_modules when npm-shrinkwrap.json changes
this replicates the travis setup in grunt from the previous commit

the reason why we duplicate this rather than having just a single place for this code is so that
we can individually time the actions on travis
2015-02-21 18:55:07 -08:00
Igor Minar 93c503fa16 chore(travis): don't break the build when travis cache is empty
`du` returns error code 2 when any of the directories don't exist which breaks the build.

this scenario is common when the cache was emptied or when travis is building forks that don't have travis cache enabled
2015-02-21 18:54:55 -08:00
Igor Minar 9d4e948e82 chore(travis): blow away cached node_modules when npm-shrinkwrap.json changes
`npm install` blindly accepts the node_modules cache and doesn't verify if it matches requirements in the current npm-shrinkwrap.json.

This means that if we are using travis cache and npm-shrinkwrap.json changes npm will keep on using the old dependencies, in spite of the guarantees that shrinkwrap claims to offer.

https://github.com/angular/angular.js/pull/11110#issuecomment-75302946

With this change, we will blow away the node_modules directory if the shrinkwrap changes compared to the one
used to populate node_modules.
2015-02-21 18:54:24 -08:00
Igor Minar 26f19d0399 chore(karma): use karma 0.12.31 instead of a custom fork
Previously Vojta set us up to use a custom fork of Karma that used socket.io 1.3.4. This change moves us to an official release of Karma but downgrades socket.io back to 0.9.16.

We now need to hurry up and finish the socket.io upgrade in karma which was blocked on shrinkwrap issues in Angular that are resolved with the previous few commits in this PR.

Conflicts:
	npm-shrinkwrap.clean.json
	npm-shrinkwrap.json
2015-02-21 18:54:08 -08:00
Igor Minar 5cd2e2291b chore(clean-shrinkwrap): drop from property from the clean shrinkwrap
it usually contains urls to temp directories which are not interesting, the info
we do want to preserve is in the `resolved` property and we do keep that one.

Conflicts:
	npm-shrinkwrap.clean.json
2015-02-21 18:41:10 -08:00
Igor Minar 69bbbe675e chore(clean-shrinkwrap): preserve git+https:// resolved property
previously we thought that git:// was enough, but we also want git+https:// otherwise we can miss important info
in clean shrinkwrap file

Conflicts:
	npm-shrinkwrap.clean.json
2015-02-21 18:40:11 -08:00
Igor Minar 825de1cdf2 chore(npm/travis): upgrade to npm 2.5 and require it via package.json
currently karma's dependencies don't install on node 0.12 or io.js so we'll just update npm in hope that that
this will mitigate "cb() never called!" erorrs. See: https://travis-ci.org/angular/angular.js/jobs/51474043#L2181
2015-02-21 18:40:11 -08:00
Igor Minar e5318c61ee chore(npm): don't clean npm-shrinkwrap.json instead generate npm-shrinkwrap.clean.json
Previously we would clean up npm-shrinkwarp.json file in order to achieve serialization
stability, which would then allow us to create human readable diffs that allow code reviews
of npm-shrinkwrap to be meaningful.

This cleanup process does have an impact on the functionality of npm which was only recently
discovered by Vojta, when we tried to update to new Karma version. See: Automattic/engine.io-client#370

According to Julie, the root cause of these issues is npm/npm/#3581.

The workaround implemented in this commit is not to interfere with npm-shrinkwrap.json file, but instead
preserve the cleaned up version of its content in npm-shrinkwrap.clean.json which can then be used to
produce human readable diffs for code reviews of npm dependency updates.
2015-02-21 18:37:56 -08:00
Igor Minar 67b40a19fb chore(travis): turn on caching for node_modules and bower_components directories
The cache behavior is documented at http://docs.travis-ci.com/user/caching/

This commit also disabled our custom caching via npm-bundler-deps.sh
2015-02-21 18:36:37 -08:00
Martin Staffa 5fbac749c9 docs($resource): fix list level
Closes #11055
2015-02-13 23:54:11 +01:00
Julie Ralph 0daadeb3d3 chore(ci): make all browserstack tests allowed failures 2015-02-13 10:20:34 -08:00
Peter Bacon Darwin 6b7625a095 fix(ngModel): fix issues when parserName is same as validator key
For $validate(), it is necessary to store the parseError state
in the controller. Otherwise, if the parser name equals a validator
key, $validate() will assume a parse error occured if the validator
is invalid.

Also, setting the validity for the parser now happens after setting
validity for the validator key. Otherwise, the parse key is set,
and then immediately afterwards the validator key is unset
(because parse errors remove all other validations).

Fixes #10698
Closes #10850
Closes #11046
2015-02-13 12:34:44 +00:00
Rouven Weßling ab7e0cd100 refactor(ngSanitize): remove workarounds for IE8
Closes #10758
2015-02-13 11:52:05 +00:00
Peter Bacon Darwin dee5f7fea5 test(ngSanitize): add tests for decodeEntities 2015-02-13 11:52:05 +00:00
Julie Ralph 140d149cee chore(ci): update to use the latest sauce connect (4.3 to 4.3.6) 2015-02-12 13:19:42 -08:00
Peter Bacon Darwin 4d65ddddf8 docs(FAQ): update the zipped file size 2015-02-12 11:59:53 +00:00
Tobyee abfce5327c fix(input): create max and/or min validator regardless of initial value
Also adds corresponding tests for ngMin / ngMax.

Fixes #10307
Closes #10327
2015-02-10 23:39:49 +01:00
Martin Staffa 944c150e6c fix(ngAria): correctly set "checked" attr for checkboxes and radios
Make sure the checked attribute is set correctly for:
- checkboxes with string and integer models using ngTrueValue /
ngFalseValue
- radios with integer models
- radios with boolean models using ngValue

Fixes #10389
Fixes #10212
2015-02-10 22:35:36 +01:00
Peter Bacon Darwin d8dc53d215 chore(CHANGELOG): add release name! 2015-02-09 11:16:46 +00:00
Peter Bacon Darwin 0ec206f5a6 chore(CHANGELOG): update to 1.4.0-beta.4 and 1.3.13 2015-02-09 10:39:03 +00:00
Lucas Galfaso ce49d4d61b fix(sanitize): handle newline characters inside <script> for IE
Tweak the regex used match characters inside <script> and <style> to a IE
compatible regex.
2015-02-07 19:21:53 +01:00
Marcy Sutton 69ee593fd2 fix(ngAria): ensure native controls fire a single click
Closes #10388
Closes #10766
2015-02-07 10:27:29 +00:00
Shahar Talmi 39ddef6829 fix(ngMock): handle cases where injector is created before tests
This caused an exception for people who created an injector before the tests actually began to run. Since the array was initialized only in beforeEach, anyone accessing it before that would throw. This is solved easily but initializing the array immediately.

Closes #10967
2015-02-06 03:47:32 +02:00
Lucas Galfaso 11aedbd741 fix(sanitize): handle newline characters inside special tags
Handle newlines characters when they are present inside <script> and <style> tags.

Closes #10943
2015-02-04 15:28:49 +01:00
Lukas Elmer e4d1e12f7f chore(docs): fix nav scrolling for non-mobile screens
Closes #10936
2015-02-04 13:37:28 +00:00
Morris Singer 9c2b32d6f3 docs(guide/forms): improve wording
Closes #01937
2015-02-04 13:17:07 +00:00
dtritus 4b3a590b00 fix($location): prevent page reload if initial url has empty hash at the end
If initial url has empty hash at the end, $location replaces it with url
without hash causing an unwanted page reload.

Closes #10397
Closes #10960
2015-02-04 12:49:20 +00:00
Peter Bacon Darwin 7f50e97628 docs(CHANGELOG): update changelog for 1.4.0-beta.3 and 1.3.12 2015-02-03 20:53:22 +00:00
Peter Bacon Darwin e5ee6123fc docs(CHANGELOG): update changelog for 1.4.0-beta.3 and 1.3.12 2015-02-02 20:26:52 +00:00
Chris 923b6aba0d docs(guide): update "AngularJS" book link
Added latest 2014 revision "AngularJS: Up and Running" with Amazon link.
"AngularJS" was previous 2013 version.

Closes #10920
2015-02-02 14:03:17 +00:00
Hannah Howard 955e20eb61 fix ($compile): keep prototype properties for template URL directives
Previously, if a directive definition object was defined with methods like `compile`
provided on the prototype rather than the instance, the Angular compiler failed
to use these methods when the directive had a `templateURL`. This change ensures
that these prototypical methods are not lost.

This enables developers to define their directives using "classes" such as
in CoffeeScript or ES6.

Closes #10926
2015-02-02 12:01:31 +00:00
Henry Zhu 286a40751c style(*): add jscs rule disallowKeywordsOnNewLine: "else" 2015-01-30 12:47:37 +00:00
Henry Zhu eca0535457 style(*): add jscs rule requireSpaceBeforeKeywords
Closes #10772
2015-01-30 12:47:37 +00:00
Henry Zhu 7ace77a5d7 style(*): add jscs rule requireSpacesInForStatement
Closes #10772
2015-01-30 12:47:36 +00:00
Henry Zhu 7f362af153 style(*): add jscs rule disallowSpacesInCallExpression
Closes #10772
2015-01-30 12:47:36 +00:00
Henry Zhu 35dee2abac style(*): add jscs rule disallowKeywordsOnNewLine: "else"
Closes #10772
2015-01-30 12:47:36 +00:00
Peter Bacon Darwin 29c926201d chore(npm): update grunt-jscs to 1.2.0 (jscs to 1.10.0), fix styles
Closes #10772
2015-01-30 12:47:36 +00:00
Peter Bacon Darwin 9b6852a8c9 chore(doc-gen): update to dgeni-packages 0.10.8
Closes https://github.com/angular/dgeni-packages/pull/105
2015-01-30 11:03:39 +00:00
Rohit Kandhal 53efc8d5d0 docs(tutorial/step-11): update link to Jasmine matchers
Closes #10909
2015-01-29 23:01:34 +00:00
Martin Staffa 0b8461c9cb test(validators): minlength and required must use viewValue in $isEmpty 2015-01-29 23:30:29 +01:00
Martin Staffa abd8e2a9eb fix(validators): maxlength should use viewValue for $isEmpty
Closes #10898
2015-01-29 23:30:28 +01:00
Ian Young bc4dadc894 docs(ngHide): use proper selector when overriding the CSS
The animation selector gives the default styles greater specificity that
should be matched when overriding.

Closes #10902
Closes #10913
2015-01-29 22:13:21 +00:00
Caitlin Potter ec53089bb1 chore($controller): don't use new for minErr instance
minErr creates a new error anyways, it's not meant to be called as a constructor.
2015-01-29 16:27:57 -05:00
Martin Staffa 7bb50e2823 docs(guide/production): clarification in disabling debug data
Closes #10762
2015-01-29 20:01:40 +01:00
Caitlin Potter 632b2ddd34 fix($controller): throw better error when controller expression is bad
Previously, the error was a JS runtime error when trying to access a property of `null`. But, it's
a bit nicer to throw a real error and provide a description of how to fix it. Developer ergonomics
and all that.

Closes #10875
Closes #10910
2015-01-29 12:52:45 -05:00
Vojta Jina 7caad2205a fix($parse): remove references to last arguments to a fn call
This can be an issue if running (and killing) multiple apps/injectors on
the same page. The `args` array holds references to all previous arguments
to a function call and thus they cannot be garbage-collected.

In a regular (one app/injector on a page) app, this is not an issue.

Closes #10894
2015-01-29 14:53:54 +00:00
Wes Alvaro 9bf5f89659 routeParams are {!Object<string, string>}
Calling Object.keys on null is a TypeError. And the mapping should be string -> string.

Closes #10896
2015-01-29 14:40:02 +00:00
Owen Smith f41ca4a53e fix(ngRoute): dont duplicate optional params into query
When calling updateParams with properties which were optional, but
previously undefined, they would be duplicated into the query params as
well as into the path.

Closes #10689
2015-01-29 10:36:03 +00:00
marc 0bcd0872d8 fix(ngScenario): Allow ngScenario to handle lazy-loaded and manually bootstrapped applications
I know protractor is preferred, and ngScenario is only in maintenance mode. But, we are limited to
ngScenario based on the devices/browsers we are targeting (no web-driver available). So, we need
to address the bug where ngScenario does not work with manual bootstrap and also has issues if
angular.resumeBootstrap is not yet defined (race condition when lazy-loading).

Closes #10723
2015-01-29 10:15:54 +00:00
Shahar Talmi 6ec5946094 feat(ngMocks): cleanup $inject annotations after each test
this will help in detecting unannotated functions both in apps and angular core in case only part of the tests are run with strictDi
2015-01-28 14:09:41 +00:00
Agrumas 784ea8e160 chore(i18n): regenerate locales due to closure library update
This includes change to the currency symbol of Lithuania.

Closes #10855
Closes #10856
2015-01-27 10:31:37 +00:00
Peter Bacon Darwin 6ec53bdfd3 chore(i18n): update closure library to latest
This includes changed to Lithuanian currency and Mynamar Burmese date formats

Closes #10855
Closes #10856
2015-01-27 10:31:37 +00:00
Caitlin Potter d1b6480dcf docs(CHANGELOG.md): remove reverted form change 2015-01-26 18:58:27 -05:00
Jeff Cross ef6fed3ef8 revert: fix(form): ignore properties in $error prototype chain
This reverts commit adf91fe6ee.
2015-01-26 14:20:52 -08:00
Caitlin Potter 473dee5786 docs(CHANGELOG.md): add changelog notes for v1.3.11 and v1.4.0-beta.2
Closes #10876
2015-01-26 16:12:24 -05:00
Caitlin Potter 779e3f6b5f fix(htmlAnchorDirective): remove "element !== target element" check
It's not really needed due to the way click events are dispatched and propagated

Closes #10866
2015-01-25 23:42:25 -05:00
Vinti Maheshwari 71bca00651 chore(gruntFile): ensure build is run before test:modules
Closes #10188
2015-01-25 02:33:29 +00:00
Peter Bacon Darwin 9a9fce0abc test($location): ensure that link rewriting is actually being tested
If the link URL is not within the given base URL then the link would not
be rewritten anyway.

See https://github.com/angular/angular.js/pull/9906/files#r19813651
2015-01-25 00:40:57 +00:00
Peter Bacon Darwin 939ca37cfe fix($location): don't rewrite when link is shift-clicked
Closes #9904
Closes #9906
2015-01-25 00:36:44 +00:00
Peter Bacon Darwin 4ae8a2a4b6 docs(input): update example to use ngModel best practices
Update the rest of the directives to use object properties for models.

Closes #10851
2015-01-24 22:42:50 +00:00
Mark Hoffmeyer 113d3954b9 docs(input[checkbox]): update example to use ngModel best practices
It's not required for the example to function, but it prevents scope weirdness/unexpected
behavior when using directives (especially with ngTransclude!). I think it's a good pattern
to encourage and might prevent a bug down the road for for people who just scan for the
monospace font. See
[Understanding Scopes](https://github.com/angular/angular.js/wiki/Understanding-Scopes)
for mgModel best practices.

Closes #10851
2015-01-24 22:41:55 +00:00
samilamti 7cb5983750 docs(guide/Introduction): define CRUD and add punctuation
Added description of what CRUD means.
Improved readability: Ensured that colons were followed by a capital letter
and added some sprinkled commas.

Closes #10804
2015-01-24 10:57:53 +00:00
Caitlin Potter 2b149ca6d4 fix(openPlunkr): enable cmd+click for us mac users :> 2015-01-23 16:49:00 -05:00
Mike Haggerty e77866c18c feat(openPlunkr): enable ctrl+click
This change allows users to ctrl+click on the "Edit in Plunker"
button which will set the posted form's target attribute to
"_blank" instead of "_self" which is the default.

Closes #10641
Closes #10826
2015-01-23 16:49:00 -05:00
Rouven Weßling 0dc6418d20 test($rootScope) test the correct setting of the constructor in Internet Explorer 11
Closes #10759
2015-01-23 21:33:15 +00:00
Caitlin Potter 837a077578 fix(htmlAnchorDirective): don't add event listener if replaced, ignore event if target is different element
Previously, when an `a` tag element used a directive with a replacing template, and did not include an `href` or `name` attribute
before linkage, the anchor directive would always prevent default.

Now, the anchor directive will not register an event listener at all if the original directive is replaced with a non-anchor, and
will ignore events which do not target the linked element.

Closes #4262
Closes #10849
2015-01-23 15:40:23 -05:00
Caitlin Potter adf91fe6ee fix(form): ignore properties in $error prototype chain
Closes #10469
Closes #10727
2015-01-23 14:37:48 +00:00
Boshen Chen dea1c0d34c docs(ngInit): fix code block not being displayed in the note section
Closes #10791
2015-01-20 23:23:43 +01:00
Pawel Kozlowski f533acc9aa docs(CHANGELOG): add changes for 1.3.10 and 1.4.0-beta.1 2015-01-20 20:48:20 +01:00
Alexandr Subbotin d01cae2a0d fix(ngRepeat) do not allow $id and $root as aliases
Currently user can use `$id` or `$root` as alias in ng-repeat directive that leads to rewriting
these scope-related variables. This commit fixes this behavior by throwing an error when user try
to use these values.

Closes #10778
2015-01-20 19:31:56 +01:00
Pawel Kozlowski d015c8a80b fix(ngController): allow bound constructor fns as controllers
Fixes #10784
Closes #10790
2015-01-20 19:31:47 +01:00
Alexandr Subbotin 8d2717146b refactor($templateRequest): remove repeated decrementation and unnecessary local variable
Closes #10780
2015-01-20 19:31:35 +01:00
Pawel Kozlowski 3d598dae64 docs(ngClass): fix jscs style errors 2015-01-20 19:31:23 +01:00
Evan Spiler 0a58986f52 docs(ngClass): fix formatting
Closes #10793
2015-01-20 19:31:12 +01:00
thorn0 6e69b85f9a docs(angular.bootstrap): passed fns are called on config stage
Closes #10789
2015-01-20 19:31:02 +01:00
Caitlin Potter 7a9e336028 fix($compile): support class directives on SVG elements
Closes #10736
Closes #10756
2015-01-20 19:18:33 +01:00
Matias Niemelä 9b8df52aa9 fix($animate): ensure no transitions are applied when an empty inline style object is provided
Closes #10613
Closes #10770
2015-01-19 14:38:24 +00:00
Peter Bacon Darwin 7fab29fbe1 docs(ngRepeat): document the sorting of object keys
See #6210
2015-01-19 09:18:53 +00:00
Peter Bacon Darwin 1a47fcbb8b chore(travis): update browsers to the latest version
Update the used browsers to the latest versions available

Closes #10620
2015-01-19 08:50:39 +00:00
Peter Bacon Darwin ffd4dab611 test(privateMocks): fix for the latest version of Safari 2015-01-19 08:50:39 +00:00
Martin Staffa 13edaa95c7 test(form): test if $pending inputs are correctly removed
It's a separate test because $pending behaves differently from $error
- the property is completely removed when no pending inputs / forms
are left.
2015-01-16 21:50:24 +01:00
Martin Staffa 47b1f54bba refactor(ngModel): clarify the arguments of $setValidity 2015-01-16 21:50:23 +01:00
Martin Staffa cdc7280dd3 fix(form): clean up success state of controls when they are removed
Fixes #10509
2015-01-16 21:50:23 +01:00
Martin Staffa 0bb282bc6d docs(migration): in 1.3, global controllers are disabled by default
Closes #10775
2015-01-16 21:35:21 +01:00
Sekib Omazic fdb09ef858 docs($rootScope.Scope): Simple typo
Closes 10767
2015-01-16 21:35:21 +01:00
Sekib Omazic 5e69cb2f9f docs(ngInclude): Typo fixed
Typo fixed
2015-01-16 21:35:21 +01:00
Sekib Omazic 5c2da38e3f docs(ngMessages): --typos.length
Merci~

Closes #10769
2015-01-15 15:46:58 -05:00
Marcin Wosinek 3a799df0f1 docs(design): highlight source button when focused 2015-01-15 14:01:21 +00:00
Kiran Rao 511c765a44 docs(CONTRIBUTING): add colons for consistent styling
Closes #10744
2015-01-15 13:54:53 +00:00
Martin Mouterde bf55d76d27 docs(date): fix milliseconds syntax description
There is no need to prefix 'sss' with ',' or '.'.

Closes #10680
2015-01-15 13:42:42 +00:00
anyong c9efc80cd0 docs(tutorial/0): remind users to refresh page
On line 32-34 after reverting to step-0 and starting the webserver, the
browser may have already cached the master branch of the app and the user
will see the master version in their browser. I just added a reminder to
tell them to refresh the page if this happens!

Closes #10615
2015-01-15 13:16:14 +00:00
Kok-Hou Chia fa15f2a6df docs(tutorial/7): correct typos
Closes #10587
2015-01-15 13:16:14 +00:00
Tyler Morgan c023a0bfbb docs(guide/Directives): demonstrate how to pass data from isolate to parent scope
It looks like this used to be in the Angular docs as per this thread:
https://groups.google.com/d/msg/angular/3CHdR_THaNw/AxqKwUw5t0oJ. I recently
spent some time trying to get this to work and was very frustrated by lack of
documentation.

Closes #10567
2015-01-15 13:16:14 +00:00
Olivier Giulieri b470e005e8 docs(css): fix position and size of Table of Contents "close" button
Closes #10555
2015-01-15 13:16:14 +00:00
Jonathan Gruber c959191882 docs(tutorial/step_10): Added missing semicolon
Added a missing semicolon in definition of $scope.setImage.

Closes #10752
2015-01-14 09:42:58 -05:00
Caitlin Potter e4adebd07a revert: chore(npm): Make require()-able as part of publish script
This reverts commit c5686c5271.

(We wanted to get some feedback before doin this)
2015-01-13 14:29:29 -05:00
Peter Bacon Darwin ac94f6125f docs(CHANGELOG): add changes for 1.3.9 and 1.4.0-beta.0 2015-01-13 00:58:04 +00:00
Ben Clinkinbeard c5686c5271 chore(npm): Make require()-able as part of publish script
(This has not been tested locally with browserify --- but it should work!
If it doesn't, please file a bug rather than just leaving a comment on this
commit :)

Closes #10731
2015-01-12 19:09:46 -05:00
Julie Ralph 7fdb54d12b chore(testing): bump protractor to version 1.6.0 2015-01-12 11:47:47 -08:00
Jason Bedard 869008140a fix($parse): allow use of locals in assignments Fixes #4664 2015-01-12 13:38:34 +00:00
Julie Ralph 26ee32ec79 chore(travis): split out the docs e2e tests into their own travis job
Previously, they were in the 'unit' job to save travis VMs, but this
was confusing and made it more difficult to track down errors easily.
2015-01-09 14:29:26 -08:00
Julie Ralph a06193f97b chore(travis): make browserstack unit tests allowed failures 2015-01-09 10:45:23 -08:00
Uri Goldshtein ba9dee170c docs(guide/index): add angular-easyfb with Facebook login to login libraries
Merci~

Closes #5792
2015-01-06 13:41:45 -05:00
Andrey Pushkarev d4b60ada1e fix(filterFilter): use isArray() to determine array type
In JavaScript, an array is a special type of object, therefore typeof [] returns object.
Added corresponding unit tests.

Changed condition for array type to isArray.

Closes #10621
2015-01-02 13:26:51 -05:00
Rus1 b839f73ad0 docs(ngInclude): replace <tt> with <code>
Using obsolete <tt> HTML tag may not be good for Angular examples

Closes #10594
2014-12-30 15:48:19 -05:00
Peter Bacon Darwin aee32931fd test(input): split tests into smaller files
This is complement to the previous commit.
It also refactors the input compile helpers to make it cleaner and more
consistent.
2014-12-24 23:26:34 +00:00
Peter Bacon Darwin 7ee5f46bbc refact(input): split input.js into smaller files
The input.js file is unnecessarily large, containing many directives including the
vast `ngModel`. This change moves ngModel and a few other directives into their
own files, which will make maintenance easier.
2014-12-24 13:01:03 +00:00
David Souther 2b97854bf4 feat(ngMock/$exceptionHandler): log errors when rethrowing
Now the `rethrow` mode will also record a log of the error in the same
way as the `log` mode.

Closes #10540
Closes #10564
2014-12-23 18:35:49 +00:00
David Souther 316ee8f7ca test($exceptionHandlerProvider): call inject() to run tests
In the current angular-mocksSpec, the tests for $exceptionHandlerProvider
call `module` to run tests on `$exceptionHandlerProvider.mode()`, but do
not call `inject()` to pump the module definitions.

Closes #10563
2014-12-23 18:11:21 +00:00
gokulkrishh 2e18f44fcd docs(guide/*): spelling/grammar improvements
Closes #10552
2014-12-22 10:44:54 -05:00
Caitlin Potter c85d064ecf docs($rootScope): remove erroneous closing parenthesis
Closes #10549
2014-12-22 08:34:29 -05:00
Kevin Primat 7b9b82281a docs(guide/location): add missing definite article
The sentence was missing a definite article so was unclear. Added one to clarify.

Closes #10547
2014-12-22 08:25:24 -05:00
Olivier Giulieri aab632b330 docs(guide): fix spaces
Closes #10539
2014-12-22 01:08:06 +00:00
gdi2290 4c8d8ad508 perf(ngStyleDirective): use $watchCollection
Since we are simply watching a flat object collection it is more performant
to use $watchCollection than a deepWatch...

Closes #10535
2014-12-22 00:58:45 +00:00
Dan Cancro 3a8f3dc9ea docs(guide/index): Link to starter options
Add a link to a comparison spreadsheet of alternative generators, examples,
tutorials and seeds that one can use to get started on a new Angular project.

Closes #10526
2014-12-22 00:30:30 +00:00
Robert Haritonov c139e68d99 docs(tutorial/12): fix path to jquery in bower
Closes #10504
2014-12-22 00:21:27 +00:00
Shahar Talmi 2caec44632 refactor(limitTo): no need for all those checks if we use slice
Closes #10537
2014-12-21 10:03:43 +00:00
leticialozano eae848a712 docs($http): fix typo
Closes #10534
2014-12-20 14:21:54 +01:00
Brian Ford 47a55ca767 docs(changelog): release notes for 1.3.8 prophetic-narwhal 2014-12-19 13:22:00 -08:00
sandeep 3d78bf3fa8 docs(guide/index): add book Responsive Web Design with AngularJS
This book explores the AngularJS features that can help a developer for building a responsive application.

Merçi beaucoup~

Closes #10513
2014-12-18 23:58:21 -05:00
Brian Ford 6e80d0ad54 docs(guide/$location): improve formatting 2014-12-18 15:01:51 -08:00
Ben Nelson ae637acdfb docs(api/index): grammar is important and so should you
I changed the word "into" to "within".
Original description underneath ngAnimate reads: "Use ngAnimate to enable animation features into your application".
I changed the text to read: "Use ngAnimate to enable animation features within your application".
The change in wording makes the description read better and gives it a more professional feel.

Closes #10517
2014-12-18 13:49:01 -05:00
Pawel Kozlowski 661f6d9ecf fix(orderBy): compare timestamps when sorting date objects
Fixes #10512
Closes #10516
2014-12-18 19:41:25 +01:00
Olivier Giulieri 56a7abd38f docs(guide): fix typo
Closes #10511
2014-12-18 18:43:30 +01:00
olexme 7d70dcdab1 docs($animate): fix misleading $animate.cancel example
The given example is wrong, you can't cancel the promise returned by "then"
since it is not the one originally tracked by "addClass".

Closes #10498
2014-12-17 20:14:22 +00:00
Todd Skinner 9e6161e579 docs($httpBackend): correct grammar
Closes #10496
2014-12-17 11:15:20 +00:00
Georgios Kalpakas bd28c74c1d fix(filterFilter): make $ match properties on deeper levels as well
Closes #10401
2014-12-17 10:17:07 +01:00
kwypchlo cd77c089ba perf(limitTo): replace for loop with slice 2014-12-16 22:43:46 +01:00
kwypchlo 83f88c1818 refactor(orderBy): remove unneeded function wrapping 2014-12-16 22:42:13 +01:00
Georgios Kalpakas fb2c585897 fix(filterFilter): let expression object {$: '...'} also match primitive items
Closes #10428
2014-12-16 22:40:34 +01:00
Kevin Primat bdbe4fd34a docs(Angular): improve sentence flow
Closes #10482
2014-12-16 19:04:05 +01:00
Kevin Primat 0b4e150aa5 docs(Angular): fix punctuation
Closes #10481
2014-12-16 19:02:02 +01:00
Jack Kingsman e091bb7dbb docs(error/badcfg): add missing "but"
Sentence meaning was unclear; added what I assumed should have been a "but"

Closes #10473
2014-12-16 14:31:24 +00:00
marmalade b62c858499 docs(guide/Scopes): fix capitalization
This sentence should begin with a capital 'R', not a lower case one.

Closes #10472
2014-12-16 14:29:53 +00:00
Chi Kei Chan 4a18274670 docs(guide/E2E Testing): add '-' to 'end-to-end'
Closes #10458
2014-12-16 14:28:45 +00:00
Zachary Lopez e3bf1ed217 docs(angular.identity): add @param and @returns tags
Closes #10457
2014-12-16 14:26:29 +00:00
Chi Kei Chan a5f037d033 docs($templateRequest): fix run-on sentence
The description of $templateRequest contains a run-on sentence that makes it confusing to understand.

ORGINAL: If the HTTP request fails or the response data of the HTTP request is empty then a `$compile` error will be thrown (the exception can be thwarted by setting the 2nd parameter of the function to true).

NEW: If the HTTP request fails or the response data of the HTTP request is empty, a `$compile` error will be thrown (the exception can be thwarted by setting the 2nd parameter of the function to true).

Closes #10456
2014-12-16 14:25:18 +00:00
Alexander Tseung 25152bb218 docs(tutorial/index): improve capitalization
Improve capitalization in acronyms for better clarity.
2014-12-16 14:21:27 +00:00
Aleksey Bobyr 24eb528b05 docs(guide/expression): update diff list between JavaScript and Angular expressions
add paragraphs about function declaration, comma and void operators and
RegExp to the diff list in the beginning of articule

Closes #10418
Closes #10452
2014-12-16 14:21:01 +00:00
thorn0 d161cc6b25 docs(select): improve formatting and wording
The part about using `select as` and `track by` together was hard to read.
And it wasn't clear what happens if they're used together.

Closes #10409
2014-12-16 14:18:51 +00:00
Jesús Rodríguez Rodríguez d604f941e8 fix(CHANGELOG): missing version number for 1.2.28
Well, the version number was missing there.
2014-12-16 12:44:07 +01:00
Peter Bacon Darwin 85758ce3af docs(CHANGELOG): remove reverted commit 2014-12-16 07:56:13 +00:00
Caitlin Potter 924e68c7d5 fix(ngAria): trigger digest on ng-click via keypress, pass $event to expression
Minor improvement to ng-click directive from ngAria. Now, if bindings are updated
during the click handler, the DOM will be updated as well. Additionally, the $event
object is passed in to the expression via locals, as is done for core event directives.

Closes #10442
Closes #10443
Closes #10447
2014-12-15 20:47:53 -05:00
Peter Bacon Darwin f297aa5d0a chore(CHANGELOG): update with changes for 1.2.28 2014-12-15 22:14:51 +00:00
Brenard Cubacub 337ce67612 docs(API Reference): fix punctuation
Closes #10453
2014-12-15 21:27:29 +01:00
Todd Skinner 8b56c08327 docs(angular.copy): fix grammar
Closes #10459
2014-12-15 21:24:53 +01:00
Peter Bacon Darwin 32eec67023 chore(CHANGELOG): update with v1.3.7 changes 2014-12-15 19:21:28 +00:00
Georgios Kalpakas fd1528a6c8 chore(CHANGELOG): add breaking change note for #9757 2014-12-15 18:48:06 +00:00
Chi Kei Chan 6cb5fbf5ef docs(error/badname): fix grammatical error
Closes #10460
2014-12-15 19:07:58 +01:00
Alexander Tseung f6644c720e docs(tutorial/step_08): fix capitalization
Closes #10466
2014-12-15 19:05:05 +01:00
Chi Kei Chan 0d9aafba3b docs(angular.fromJson): replace the word "Thingy"
Replace the word "thingy" with "JSON string" to specify what thingy means.

Closes #10468
2014-12-15 19:03:06 +01:00
Julie Ralph 0524e92d2e docs(migration): add end to end upgrade info to migration doc
There are a couple of changes to some Protractor tests that need to be made
when migrating from AngularJS 1.2 to 1.3 - document these in the migration
guide.

See https://github.com/angular/protractor/issues/1480

Closes #10377
2014-12-15 13:46:21 +00:00
Shahar Talmi 9b96cea462 feat($rootScope): allow passing locals argument to $evalAsync
Closes #10390
2014-12-15 13:45:12 +00:00
Jason Bedard c90ad96808 fix($parse): a chain of field accessors should use a single getterFn 2014-12-15 13:03:05 +01:00
Lucas Galfaso 69f69db1e0 revert($compile): use createMap() for $$observe listeners when initialized from attr interpolation
This reverts commit 8e28bb4c2f.
2014-12-14 13:32:55 +01:00
Jason Bedard 8e28bb4c2f fix($compile): use createMap() for $$observe listeners when initialized from attr interpolation 2014-12-14 12:41:04 +01:00
Pawel Kozlowski ab41e48493 docs(dateFilter): fix docs to match implementation for week no formatting
The existing documentation claims that dateFilter determines week no
according to the ISO8601 standard, but this is not the case as illustrated
by tests in this PR. More specifically, the implementation deviates from
ISO8601 in 2 important aspects:
- impl assumes Sun to be the first day of a week, ISO8601 mandates Mon
- impl allows weeks 0 (for years starting on Fri, Sat) while ISO8601
would mark them as a week 52/53 of a previous year.

Fixes #10314
Closes #10313

Closes #10445
2014-12-14 11:28:46 +01:00
Sekib Omazic ef640cbc2a fix(ngRepeat): allow extra whitespaces in (key,value) part of micro-syntax
e.g. (  aaa  ,   bbb  ) will be accepted by parser

Fixes #6827
Closes #6833
2014-12-14 10:22:38 +01:00
Ruben Vicario Gonzalez 081fef60b2 docs(tutorial/index): improve punctuation
Closes #10449
2014-12-14 09:50:28 +01:00
Wes 99d1a438b6 docs(Courses): fix syntax issue in developer guide
The courses section should use commas between links to differentiate the instances of each link

Closes #10448
2014-12-13 21:27:18 -05:00
Dan Tennery-Spalding 6bd4292c24 docs(API Reference): corrected two typos - two missing commas
In the ngAnimate section, there were two commas missing from two sentences. This is inconsistent with the grammar used in the rest of the API documentation and made the document (slightly) more difficult to read. The two sentences are shown below, with the new commas added:

1. "Once defined, the animation can be triggered"
                           ^
                    comma added

2. "Once registered, the animation can be triggered"
                              ^
                    comma added

Closes #10447
2014-12-13 20:17:54 -05:00
Aleksandar Djindjic e0663312fb docs($rootScope): clean up inheritance example
Closes #10441
2014-12-13 18:06:50 +01:00
Jason Bedard 9ae0c01c2b perf($compile): only re-$interpolate attribute values at link time if changed since compile 2014-12-13 12:56:39 +01:00
Jon Hoguet 79b3b8b686 chore($location): use $window instead of window
Fix one place were there was a reference to `window` and not to `$window`
2014-12-13 12:52:42 +01:00
Pawel Kozlowski 1b740974f5 feat($http): pass response status code to data transform functions
Fixes #10324
Closes #6734

Closes #10440
2014-12-12 19:51:34 +01:00
Georgios Kalpakas b9bdbe615c fix($http): only parse as JSON when opening/closing brackets match
Previously, due to weak JSON-detecting RegExp, string like `[...}` and
`{...]` would be considered JSON (even if they obviously aren't) and an
expection would be thrown while trying to parse them.

This commit makes sure the opening and closing brackets match. This
doesn't completely eliminate false positives (e.g. `[]{}[]`), but does
help reduce them.

Closes #10349
Closes #10357
2014-12-12 18:46:00 +01:00
Stefan 6617b42bc7 docs(guide/Forms): added link to input type "date"
Closes #10415
2014-12-11 21:19:32 +01:00
Vojta Jina 8a907eb3ff chore(travis): run the build twice (BS and SL)
Temporarily run the each job twice:
- using BrowserStack
- using SauceLabs
2014-12-11 09:52:00 -08:00
Rouven Weßling aac3c4aa63 chore($$raf) remove moz prefix for requestAnimationFrame
This drops support for Firefox 22 and older.

The moz-prefix is still supported, but there is an effort to drop it eventually:
https://bugzilla.mozilla.org/show_bug.cgi?id=909154

Closes #9577
2014-12-10 16:01:02 -05:00
Pawel Kozlowski d162f152b8 refactor($http): avoid re-creating execHeaders function
The execHeaders function was being re-defined inside mergeHeaders
function. Additionally it was mutating its arguments.

Closes #10359
2014-12-10 20:57:28 +01:00
Rouven Weßling 4025883803 fix($http): don't convert FormData objects to JSON
This won't enable FormData uploads in itself, as the Content-Type is automatically set to application/json.

Closes #10373
2014-12-10 19:06:07 +01:00
thorn0 c437d0a470 docs(CHANGELOG.md): better group changes in 1.3.6
Closes #10392
2014-12-10 19:04:00 +01:00
Danny Callaghan 5d28d19623 docs(guide/Animations): fix punctuation
Closes #10398
2014-12-10 19:01:42 +01:00
Caitlin Potter 7fd2dc11ca chore(bower/unpublish.sh): add angular-messages and angular-aria
The unpublish script was not set to unpublish those packages

Closes #10379
2014-12-09 16:20:06 -05:00
Julie Ralph 63db09753e style(testability): throw a more informative error when getting testability
The angular.getTestability method requires an element parameter to determine
which Angular application to use. Currently, if the element provided is
undefined or outside of an Angular app, the error message is 'cannot read
property get of undefined'. Improving to a more relevant error message.
2014-12-09 11:48:38 -08:00
Caitlin Potter a097aa95b7 fix(orderBy): do not try to call valueOf/toString on null
8bfeddb5d6 added changes to make relational operator work as it
normally would in JS --- unfortunately, this broke due to my failure to account for typeof null
being "object".

This refactoring attempts to convert object values to primitives still, in a fashion similar to
the SortCompare (and subsequently the ToString() algorithm) from ES, in order to account for `null`
and also simplify code to some degree.

BREAKING CHANGE:

Previously, if either value being compared in the orderBy comparator was null or undefined, the
order would not change. Now, this order behaves more like Array.prototype.sort, which by default
pushes `null` behind objects, due to `n` occurring after `[` (the first characters of their
stringified forms) in ASCII / Unicode. If `toString` is customized, or does not exist, the
behaviour is undefined.

Closes #10385
Closes #10386
2014-12-09 13:34:27 -05:00
Pawel Kozlowski b3dfb38359 refactor($http): avoid using closure vars in serverRequest fn
Closes #10361
2014-12-09 19:24:52 +01:00
Pawel Kozlowski 3b5ba87797 refactor($http): drop superfluous argument to sendReq
Closes #10360
2014-12-09 18:50:17 +01:00
Grzegorz Marzencki e50002baed docs($resource): fix typo
Closes #10383
2014-12-09 18:12:22 +01:00
Brian Scoles a8089166f5 docs(guide/Expressions): fix grammar, flow and punctuation
Closes #10384
2014-12-09 18:10:08 +01:00
Wesley Cho d8e3707860 feat($compile): add support for ng-attr with camelCased attributes
SVG attributes are case sensitive and some have upper case letters in them
This change ensures that we can identify these, when being used with the `ng-attr`
directive, by encoding upper case letters with a preceding underscore.

For example to apply `ng-attr` to the `viewBox` attribute we could write
`ng-attr-view_box` - or any of the other variants: `ng:attr:view_box`,
`data-ng-attr-view_box`, etc.

Closes #9845
Closes #10194
2014-12-09 11:34:27 +00:00
Caitlin Potter ca4df475e1 docs(CHANGELOG.md): remove the closes ... from 2dc34a96 notes 2014-12-08 19:12:15 -05:00
Caitlin Potter 02c9dc6e16 docs(CHANGELOG): add v1.3.6 changes
Closes #10376
2014-12-08 19:10:34 -05:00
Tobias Davis 6ad109e745 docs($interval): correcting example code indentation
Bueno!

Closes #10372
2014-12-08 16:29:39 -05:00
Georgios Kalpakas c5cba6e9c1 chore(changelog): add test for addition of trailing newline
Adds tests for the functionality added by #9550.

Closes #10358
2014-12-08 13:04:15 -05:00
active-low 924d3c6bfe docs(contributing): correct push -f command
`git push -f` needs branch specification

In all cases, please consult the git manpages before consulting angular's contributing guide
when you need help with git, thx ^^

Closes #10356
2014-12-08 11:05:49 -05:00
Giuseppe Caruso ee29819dba docs(guide/controllers): Just a typo
Gingerbreak would break testing. :)

Oh my gosh he's right, it totally w/ould. That is so embarrassing!

Closes #10353
2014-12-08 10:50:03 -05:00
Clark DuVall 41f03e4b02 docs(ngView): remove multiple position: relative
Closes #10363
2014-12-08 09:04:13 +01:00
Shahar Talmi facfec9841 fix(http): preserve config object when resolving from cache
Fixes #9004
Closes #9030
2014-12-06 10:16:28 +01:00
Vojta Jina e2d1969d68 chore(grunt): remove unused code 2014-12-05 19:13:24 -08:00
Vojta Jina f380cd220c chore(travis): clean up browserstack/saucelabs scripts 2014-12-05 19:13:24 -08:00
Vojta Jina 2db0aabee3 chore(travis): enable both SauceLabs and BrowserStack
Setting env var `BROWSER_PROVIDER` to `browserstack` or `saucelabs`
determines which browser provider will be used.

This does not affect the build as all jobs are set to use SauceLabs.

Switch to Karma with Socket.io 1.x, which solves some issues(*) with BS.
Thus removing `config.transports` as it is not used anymore
(Socket.io 1.x starts with polling and tries to upgrade if available).

(*) folks from BS were fiddling with socket.io configuration to get it stable.
See https://github.com/dhimil/karma/commit/4c04011850bf66a8a7556cd76ad662c568399481
This is not necessary with Socket.io 1.x.
2014-12-05 19:13:23 -08:00
Ciro Nunes ee42cfea04 refactor(ngAria): remove local camelCase method
Closes #10338
Closes #10337
2014-12-05 22:13:24 +00:00
Ciro Nunes fbbf6ac161 docs(compile): document $attrs.$normalize
Closes #10345
2014-12-05 14:18:56 -05:00
Clay Anderson a1c5f2b4f0 docs(guide/forms): enhanced form examples to utilize $touched
The "Binding to form and control state" example now makes use of
control states that were introduced in 1.3.
For example, users are now informed of validation requirements upon
clicking 'Save'.

Closes #10066
2014-12-05 15:28:21 +01:00
Martin Staffa 2d6a0a1dc1 fix(ngModelController): always use the most recent viewValue for validation
This fixes issues where a parser calls $setViewValue. This is a common
strategy for manipulating the $viewValue while the user is entering
data into an input field.

When the $viewValue was changed inside the parser, the new viewValue
would be committed, parsed and used for validation. The original parser
however would run after that and pass the original (outdated) viewValue
on to the validators, which could cause false positives, e.g. for
minlength.

Fixes #10126
Fixes #10299
2014-12-05 14:36:41 +01:00
Mads Konradsen 0c4f9fa574 docs(ie): remove fixes needed for IE8 since we don't support it now
Closes #10330
Closes #10316
2014-12-05 12:20:34 +00:00
Peter Bacon Darwin 7ad66527ba docs(guide/migration): add info about change that could break isolated directive usage
Closes #10236
2014-12-05 11:32:25 +00:00
Caitlin Potter f2e7f875e2 feat($$jqLite): export jqLite as a private service
This makes it easy to use jqLite's nicer class API (compared to jQuery) in modules
like ngAnimate.
2014-12-04 18:05:07 -05:00
Caitlin Potter 40a537c25f fix(ngAnimate): do not use jQuery class API
jQeury's class API causes problems with SVG elements --- using jqLite in all cases
prevents issues.

Closes #10024
Closes #10329
2014-12-04 18:05:00 -05:00
Brian Ford cb192293f4 docs($animate): improve formatting of inline code 2014-12-04 13:15:09 -08:00
Pawel Kozlowski 8c3a42cd68 refactor($templateRequest): avoid double calls to $templateCache.put
Closes #10265
2014-12-04 21:24:06 +01:00
Peter Bacon Darwin 96e7897fef docs($location.ihshprfx): remove docs for unused error 2014-12-04 12:52:43 +00:00
Peter Bacon Darwin 2dc34a9699 fix($location): allow hash fragments with hashPrefix in hash-bang location urls
Previously if there was a hash fragment but no hashPrefix we would throw an error.
Now we assume that the hash-bang path is empty and that the hash is a valid fragment.

This prevents unnecessary exceptions where we clear the hashBang path, say by
navigating back to the base url, where the $browser leaves an empty hash symbol
on the URL to ensure there is no browser reload.

BREAKING CHANGE:

We no longer throw an `ihshprfx` error if the URL after the base path
contains only a hash fragment.  Previously, if the base URL was `http://abc.com/base/`
and the hashPrefix is `!` then trying to parse `http://abc.com/base/#some-fragment`
would have thrown an error. Now we simply assume it is a normal fragment and
that the path is empty, resulting `$location.absUrl() === "http://abc.com/base/#!/#some-fragment"`.

This should not break any applications, but you can no longer rely on receiving the
`ihshprfx` error for paths that have the syntax above. It is actually more similar
to what currently happens for invalid extra paths anyway:  If the base URL
and hashPrfix are set up as above, then `http://abc.com/base/other/path` does not
throw an error but just ignores the extra path: `http://abc.com/base`.

Closes #9629
Closes #9635
Closes #10228
Closes #10308
2014-12-04 12:49:31 +00:00
Peter Bacon Darwin 10ac594809 fix($browser): prevent infinite digests when clearing the hash of a url
By using `location.hash` to update the current browser location when only
the hash has changed, we prevent the browser from attempting to reload.

Closes #9629
Closes #9635
Closes #10228
Closes #10308
2014-12-04 12:49:31 +00:00
Jason Bedard d21dff21ed fix(ngmodel): fixing many keys incorrectly marking inputs as dirty 2014-12-03 16:47:35 -05:00
Jason Bedard 55d9db56a6 fix(inputs): ignoring input events in IE caused by placeholder changes or focus/blur on inputs with placeholders
Closes #9265
2014-12-03 16:46:55 -05:00
Lucas Galfaso 579aa59324 chore(docs): fix jscs error
Removed a triling whitespace
2014-12-03 21:45:47 +01:00
Steve Shaffer b9e5eaf669 docs(select): Updated ngOptions track by examples
Made the example shown consistent with the advice above it regarding not using
`select as` and `track by` in the same comprehension expression.  Also changed
references to `trackexpr` to `track by` since `trackexpr` is not defined
except in the examples.

Added filter + track by example for ngOptions

The documentation for ngRepeat includes such an example specifying the proper
order for filters and and "track by" clauses in the comprehension expression,
but these docs for ngOptions do not.
2014-12-03 21:31:43 +01:00
Justin 228281eecc docs($location): improve $location.hash() example
Closes #10300
2014-12-03 21:11:27 +01:00
Pawel Kozlowski acb066e84a fix(ngMock): allow numeric timeouts in $httpBackend mock
Fixes #4891
2014-12-03 21:06:33 +01:00
Lucas Galfaso ed1243ffc7 fix(parse): fix operators associativity
Make the operators `&&`, `==`, `!=`, `===`, `!==`, `<`, `>`, `<=`, `>=`
follow Javascript left-to-right associativity
2014-12-03 20:53:20 +01:00
Caitlin Potter 3aa5752894 fix(orderBy): make object-to-primtiive behaviour work for objects with null prototype 2014-12-03 14:19:25 -05:00
Caitlin Potter 8bfeddb5d6 fix(orderBy): maintain order in array of objects when predicate is not provided
In ES262, there are two properties which are used to get a primitive value from an Object:

- valueOf() -- a method which returns a primitive value represented by the Object
- toString() -- a method which returns a string value representing the Object.

When comparing objects using relational operators, the abstract operation ToPrimitive(O, TypeHint) is used,
which will use these methods to retrieve a value.

This CL emulates the behaviour of ToPrimitive(), and ensures that no ordering occurs if the retrieved value
is identical.

This behaviour was previously used for Date objects, however it can be safely made generic as it applies to
all objects.

Closes #9566
Closes #9747
Closes #10311
2014-12-03 14:19:24 -05:00
hartz89 015111fd79 docs(ngTransclude): improve markup consistency
Closes #10298
2014-12-03 19:38:00 +01:00
Julien Valéry cc0fbe37d4 docs($compile): fix spelling
Closes #10296
2014-12-03 19:21:38 +01:00
Jason Bedard 1b640f9665 test($interpolate): adding tests for watching $interpolate functions
Closes #10119
2014-12-03 19:15:08 +01:00
Caitlin Potter 32806caf13 docs(guide/css-styling): form controls are not always input elements
People frequently write custom form controls using the `ngModel` directive, this just
refactors the text to be more clear that this is possible (imho).
2014-12-02 22:00:00 -05:00
Caitlin Potter 9c113aa4af style(guide/css-styling): remove trailing whitespace
Pretty self-explanatory, no mystery here.
2014-12-02 22:00:00 -05:00
Caitlin Potter 9a616eade4 refactor(toJson): remove breaking change from previous CL
Closes #10297
2014-12-02 17:32:39 -05:00
Caitlin Potter 7daf4e0125 test(toJson): add extra test cases for new pretty behaviour 2014-12-02 17:32:38 -05:00
Rahul Doshi 1191edba4e feat(jsonFilter): add optional arg to define custom indentation
also change toJson function to accomodate passing in of number of spaces

Closes #9771
2014-12-02 17:32:38 -05:00
Philipp Denzler c8c9bbc412 docs(guide/Working With CSS): ng-touched/untouched
Add description for ng-touched and ng-untouched CSS classes.

Closes #10302
2014-12-02 17:13:34 -05:00
Lucas Galfaso 429938da1f fix($parse): Follow JavaScript context for unbound functions
Use `undefined` as the context when a function is ounbound.
E.g. when executing `foo()()`, then `foo()` is executed using the
scope as the context, the function returned by `foo()` will
have an `undefined` context
2014-12-02 22:45:32 +01:00
Georgios Kalpakas a75537d461 fix(filterFilter): don't match primitive sub-expressions against any prop
Basically, implement the logic detailed in the 2nd point of
https://github.com/angular/angular.js/pull/9757#issuecomment-63544399
2014-12-02 13:52:21 -05:00
Georgios Kalpakas 5ced914cc8 fix(filterFilter): ignore function properties and account for inherited properties
Closes #9984
2014-12-02 13:52:21 -05:00
Georgios Kalpakas a631a759d2 test(filter): test expression object with inherited properties
Related to #9984
2014-12-02 13:52:21 -05:00
Georgios Kalpakas f7cf846045 fix(filterFilter): correctly handle deep expression objects
Previously, trying to use a deep expression object (i.e. an object whose
properties can be objects themselves) did not work correctly.
This commit refactors `filterFilter`, making it simpler and adding support
for filtering collections of arbitrarily deep objects.

Closes #7323
Closes #9698
Closes #9757
2014-12-02 13:52:11 -05:00
Pawel Kozlowski 96c61fe756 fix(numberFilter): numbers rounding to zero shouldn't be negative
Closes #10278
2014-12-02 19:36:39 +01:00
chasefleming 915a891ad4 fix(linky): make urls starting with www. links, like markdown
It's super cool!

Closes #10290
2014-12-02 13:25:54 -05:00
Carson McDonald 8df47db72f docs(guide/scope): fix typo
Closes #10289
2014-12-02 19:21:02 +01:00
Olivier Combe 013b522c9e feat($injector): print caller name in "unknown provider" errors (when available)
NGEUROPE!!!!!

Closes #8135
Closes #9721
2014-12-02 12:19:15 -05:00
Mike Stickel 7c6be43e83 fix(ngSanitize): exclude smart quotes at the end of the link
When smart quotes are included in content filtered through linky, any
smart quote at the end of a URL string was being included in the link
text and the href.

Closes #7307
2014-12-02 12:11:35 +00:00
Peter Bacon Darwin e93710fe0e fix($location): strip off empty hash segments when comparing
The url is the same whether or not there is an empty `#` marker at the end.
This prevents unwanted calls to update the browser, since the browser is
automatically applying an empty hash if necessary to prevent page reloads.

Closes #9635
2014-12-02 12:04:59 +00:00
Marcy Sutton 5481e2cfcd feat(ngAria): bind keypress on ng-click w/ option
Closes #10288
2014-12-01 19:15:57 -05:00
Georgios Kalpakas c6b57f1ec6 docs(guide/accessibility): fix dangling links 2014-12-01 14:43:04 -08:00
Pawel Kozlowski 240e0d5c8e docs(CHANGELOG): add v1.3.5 changes 2014-12-01 22:29:36 +01:00
Martin Staffa 9fa73cb4e7 fix(select): use strict compare when removing option from ctrl
Otherwise, if the removed option was the empty option (value ''),
and the currently selected option had a value of 0, the select
would think that the currently selected option had been removed,
causing the unknown option to be added again.

Fixes #9714
Fixes #10115
Closes #10203
2014-12-01 19:54:14 +01:00
Pawel Kozlowski f6458826ac fix($emplateRequest): propagate rejection reason when ignoreRequestError flag is set
Closes #10266
2014-12-01 19:50:13 +01:00
Pawel Kozlowski ab2531143e refactor($templateRequest): simplify filtering out of transform functions
Closes #10264
2014-12-01 19:31:53 +01:00
Shahar Talmi 9a83f9d2fa fix(ngMock): annotate $RootScopeDecorator
Fixes #10273
Closes #10275
Closes #10277
2014-12-01 19:25:43 +01:00
Peter Bacon Darwin 3f07eb227d test($location): fix test of {rewriteLinks:false}
The test for not rewriting links was invalid and just happened to be
passing by chance (false-positive).
2014-12-01 13:39:27 +00:00
Peter Bacon Darwin 446e5669a1 test($location): fix typo 2014-12-01 13:38:47 +00:00
Peter Bacon Darwin b264be40bc revert: fix(Angular.js): toKeyValue is not serializing null values
This commit contained broken tests and was not ready to be merged.

(reverted from commit 814c9847e8)
2014-12-01 12:42:18 +00:00
Josh Kurz 814c9847e8 fix(Angular.js): toKeyValue is not serializing null values
Signed-off-by: Josh Kurz <jkurz25@gmail.com>
2014-11-30 20:35:14 -05:00
Jesse Palmer dde613f18e chore(docs): fix dangling links warning in $http API
Closes #10270
2014-11-30 12:50:41 +01:00
Chris Tanseer e6a2527cdf docs($rootElement): fix minor grammatical errors
Closes #10269
2014-11-29 23:19:32 +01:00
Caitlin Potter d0351c4803 style(ngHref): make jscs happy ;-; 2014-11-28 22:28:39 -06:00
Sagar Ranglani b2b6d74ae5 docs(ngHref): fix poor paragraph construction
It was bad.

In order to improve the docs, the inclusion of the last sentence would help define `ngHref` well.

Closes #10254
2014-11-28 22:09:18 -06:00
Lucas Galfaso 30694c8027 fix(select): fix several issues when moving options between groups
* When an option was moved to a previous group, the group that
loose the option would remove the label from the controller
* When an entire option group was removed, the options in the
group were mot removed from the controller

Closes #10166
2014-11-27 20:40:43 +00:00
Ates Goral 655ac6474b docs(guide/ie): fixed minor typo
Closes #10251
2014-11-27 21:14:01 +01:00
Eric Theise e5a9b265ba docs(tutorial): fix grammar
Should either be "a different version" or "different versions";
this goes with the latter.

Closes #10249
2014-11-27 19:02:31 +01:00
Danny Shekhtman e2b9eccde0 docs(guide): fix typo
Closes #10245
2014-11-27 08:53:05 +01:00
Sugan Krishnan 9b3d9656a6 docs($compile): fix grammar
Closes #10231
2014-11-27 08:52:13 +01:00
Caitlin Potter 1e6a5b29a6 style(*): IE9 does still have issues with apply on some native functions
This partially reverts 8f05ca5552

Related to #10242
2014-11-26 21:51:31 +00:00
Caitlin Potter 8f05ca5552 style(*): IE is a real browser, and chakra is pretty solid
- IE9+ do not have issues with Function.prototype.bind() on builtin fns (asked Brian Terlson)
  (NOTE: there may still be corner cases where builtins will not have `bind()` --- this may
  need to be reverted on complaint).
- HTMLScriptElement#text is an IDL-spec'd attribute, and we use it in all cases --- so the
  comment was sort of nonsense.
- The value of `msie` does not depend on whether the user is using a "real" browser or not.

Closes #10242
2014-11-26 14:36:33 -06:00
Lucas Galfaso 2ec8d1ffc0 fix(linky): encode all double quotes when serializing email addresses
When encoding a URL or an email address, then escape all double quotes

Closes #10090
2014-11-26 21:35:11 +01:00
Shahar Talmi 08cd5c19c7 fix(ngMock): respond did not always take a statusText argument
minor fix so that `respond` can take a `statusText` argument
even when having status 200 by default

Closes #8270
2014-11-26 20:03:23 +01:00
Or Neeman 41dc7d5ebd docs(ngRoute): clarify JSDoc for caseInsensitiveMatch
Closes #10220
2014-11-26 19:05:53 +01:00
Georgios Kalpakas 0caa5ad83f docs(CHANGELOG): remove * component
Closes #10222
2014-11-26 19:04:24 +01:00
Mathew Foscarini 5d36353bc9 docs($compile): fix grammar
Closes #10204
2014-11-25 19:51:33 +01:00
Guillaume Pannatier 719d5c5fa5 fix($httpBackend): allow canceling request with falsy timeoutId
httpBackend with ngMock browser.defer could never cancel the first deferredFn
because the timeoutId returned by defer for the first fn is a zero value.
Compare timeoutId with undefined fix this issue.

Closes #10177
2014-11-25 19:17:57 +01:00
Guillaume Pannatier 266da34098 test($httpBackend): use browser.defer mock instead of fakeTimeout 2014-11-25 19:17:01 +01:00
Lucas Galfaso 9474ec120a docs(CHANGELOG): add v1.3.4 changes 2014-11-25 00:05:18 +01:00
Pawel Kozlowski 09a9832358 fix(Angular): properly get node name for svg element wrapper
Fixes #10078
Closes #10172
2014-11-24 22:11:00 +00:00
Jason Bedard bf6a79c348 perf(*): use Object.create instead of creating temporary constructors
Closes #10058
2014-11-23 22:37:08 +00:00
Lucas Galfaso 8ee8ffeba0 fix(linky): encode double quotes when serializing email addresses
Email addresses can (under certain restrictions) include double quote
characters. See http://tools.ietf.org/html/rfc3696#section-3.

For example, `"Jo Bloggs"@abc.com` is a valid email address.

When serializing emails to the `href` attribute of an anchor element,
we must HTML encode these double quote characters. See
http://www.w3.org/TR/html-markup/syntax.html#syntax-attr-double-quoted

This commit does not attempt to improve the functionality (i.e. regex)
that attempts to identify email addresses in a general string.

Closes #8945
Closes #8964
Closes #5946
Closes #10090
Closes #9256
2014-11-23 21:58:18 +00:00
Peter Bacon Darwin 42d09f1772 docs(NgModelController): clarify the value parameter for $isEmpty 2014-11-23 15:24:36 +00:00
Martin Staffa 8692f87a46 fix(input): set ngTrueValue on required checkbox
Fixes #5164
2014-11-23 15:08:39 +00:00
Peter Bacon Darwin 40406e2f22 fix(input[date]): do not use $isEmpty to check the model validity 2014-11-23 15:08:39 +00:00
Peter Bacon Darwin 4644c5840f revert: fix(input): always pass in the model value to ctrl.$isEmpty
This commit tried to create consistency by ensuring that `$isEmpty` is not
called on both model and view values but it chose to only use `$modelValue`,
which is not actually correct.

`$isEmpty` is designed to compute whether the `$viewValue` is empty. In
practice this is the only part of the parse/format system that the
directive has control over. We can't rely on the `$modelValue` being in
any particular format since other directives can add in their own formatters
and parsers to completely change this.

(reverted from commit 3e51b84bc1)
2014-11-23 15:08:39 +00:00
thorn0 addb4bdd57 chore(docs): regroup version selector options into major branches and latest
Before this change we grouped by the  discontinued stable/unstable distinction.

Closes #10053
2014-11-23 13:26:33 +00:00
Gonzalo Ruiz de Villa 7496e8e5b7 refactor(*): combine sequence of .push() into one statement
Closes #10192
2014-11-23 09:38:36 +01:00
Dustin e9b9421cdb fix ($http): throw error when string URL is provided 2014-11-22 15:34:55 -08:00
Rado Kirov 7a374691b9 docs(injector): adds a missing backtick and reformat list.
Closes #10189
2014-11-22 14:48:02 -08:00
Shang Heng (Shawn) Wei 3be6835e0f docs($location): add examples for some methods
Closes #9754
2014-11-22 14:16:57 -08:00
shwei a3d79775e1 refactor(ngForm): Remove checking event.preventDefault and calling event.returnValue. Related to issue #4557. Worked with @bullwrinkle on this. 2014-11-22 14:13:12 -08:00
Rado Kirov 920b595080 doc(injector): adds strictDi documentation to appropriate methods.
Closes #9624
2014-11-22 14:01:37 -08:00
Jack Franklin 3109342679 docs(guide/unit-testing): improve unit testing guide
This commit adds to the unit testing guide:

- an explicit section on additional libraries: Karma, Jasmine and
  angular-mocks and link to the docs for those projects too. Explain the
  benefit and use case for each of these libaries
- fully featured test examples and add more documentation
  around them, in particular the controller test
- a clear separation between the section on principles of testing
  and the actual tutorial on writing a test

Closes #8220
2014-11-22 13:47:41 -08:00
Pawel Kozlowski aa01be8b2c test($http): parsing headers with multiple values
Closes #9473

Closes #10176
2014-11-22 22:11:59 +01:00
Brian Ford bb4d3b73a1 fix(ngModelOptions): preserve context of getter/setters
Many thanks to @NevilleS and @jbedard for collaborating with me on a solution to this!

Closes #9394
Closes #9865

BREAKING CHANGE: previously, ngModel invoked getter/setters in the global context.

For example:

```js
<input ng-model="model.value" ng-model-options="{ getterSetter: true }">
```

would previously invoke `model.value()` in the global context.

Now, ngModel invokes `value` with `model` as the context.

It's unlikely that real apps relied on this behavior. If they did they can use `.bind` to explicilty
bind a getter/getter to the global context, or just reference globals normally without `this`.
2014-11-22 12:36:12 -08:00
Wesley Cho 6dbd606ad7 fix($locale): Allow currency filter to fall back to maxFrac from locale
- Modify default fallback to `NUMBER_FORMATS.PATTERNS[1].maxFrac`

- Remove unnecessary resetting

Closes #10179
2014-11-22 12:29:06 -08:00
thorn0 764fa869dd fix($browser): allow chaining url() calls in setter mode
Closes #10157
2014-11-22 16:48:54 +01:00
Neville Samuell 7812dfcee8 fix($location): allow empty string URLs to reset path, search, and hash
Currently, providing '' to $location#url will only reset the hash, but otherwise has no effect. This
change brings the behaviour of $location#url more inline with window.location.href, which when
assigned to an empty string loads the page's base href.

Before:
$location.url() // http://www.example.com/path
$location.url('') // http://www.example.com/path

After:
$location.url() // http://www.example.com/path
$location.url('') // http://www.example.com

Fixes #10063

Closes #10064
2014-11-22 16:30:41 +01:00
Georgios Kalpakas 00b623e86b docs(ngMaxlength): document what happens on negative/non-numeric values
Closes #9998
2014-11-22 16:00:44 +01:00
Georgios Kalpakas 92f87b1142 fix(ngMaxlength): ignore maxlength when not set to a non-negative integer
This makes the behaviour of maxlength/ngMaxlength more inline with the
spec.

Closes #9874
2014-11-22 16:00:44 +01:00
Georgios Kalpakas 5c1fdff691 feat(ngMaxlength): add support for disabling max length limit
Previously, setting the maxlength to a negative number, would make all
input values invalid (since their length should be less than maxlength,
which is impossible).
This commit changes the behaviour of maxlength/ngMaxlength, effectively
disabling the maxlength validation (always returning true) when maxlength
is set to a negative number. This is more inline to how the HTML5
`maxlength` attribute works (both in browsers and according to the spec:
http://dev.w3.org/html5/spec-preview/attributes-common-to-form-controls.html#attr-fe-maxlength).

Related to #9874
Closes #9995
2014-11-22 16:00:43 +01:00
Georgios Kalpakas 891acf4c20 fix($route): fix redirection with optional/eager params
Previously, when (automatically) redirecting from path that fetured a
trailing slash and optional or "eager" parameters, the resulting path
would (incorrectly) contain the special characters (`?`,`*`) along with
the parameter values.

Closes #9819

Closes #9827
2014-11-22 15:34:16 +01:00
Georgios Kalpakas 93552fed1c test($route): fix test names 2014-11-22 15:34:16 +01:00
Peter Bacon Darwin b5fbd6a2f6 chore(favicon): provide retina friendly favicon
See https://github.com/angular/angularjs.org/pull/143
2014-11-22 10:54:28 +00:00
Peter Bacon Darwin 5c43b94fc4 chore(i18n): update locale to CLDR v26 2014-11-21 14:42:44 +00:00
Georgios Kalpakas 7dd94b9595 docs(ngAnimate.$animate): fix classes during the various animation phases
Closes #10124
2014-11-21 13:57:35 +00:00
Peter Bacon Darwin 95f8a8bab0 style(ngBind): remove trailing whitespace 2014-11-21 13:51:04 +00:00
Tony Rizko dc5bba8615 docs(ngBindHtml): fix awkward wording
Fixes #10097
Closes #10129
2014-11-21 13:29:16 +00:00
Peter Bacon Darwin 16c8f29ef6 docs(ngShow/ngHide): add spaces to improve readability of CSS
Closes #10101
2014-11-21 11:08:22 +00:00
Pawel Kozlowski d3fb8dd776 docs($filter): clarify what is a valid filter name
Also updates the CHANGELOG to add info about this breaking some
previous invalid uses of $filter

Closes #10054
Closes #10131
2014-11-21 11:04:24 +00:00
Caitlin Potter 95e03bce7e style($http): make jscs happy 2014-11-21 00:26:39 -05:00
Dustin Chilson 5388ca5710 docs($http): describe how to remove a header on a per request basis
Closes #10144
2014-11-21 00:26:17 -05:00
Brian Ford 1b275fb00e chore(scripts): fix 1.2.x tag name 2014-11-20 15:02:34 -08:00
Lucas Galfaso 1c68d00fbf docs(ngAnimate): Fix typo
The ngAnimate makes reference to a function `$animateProvider.classNamePrefix`
that does not exist, the correct function is `$animateProvider.classNameFilter`

Closes #10142
2014-11-20 23:34:37 +01:00
Brian Ford 158241e212 chore(scripts): publish 1.2.x releases to npm with correct tag 2014-11-20 14:31:58 -08:00
AlexChan eab271876c fix(input): call $setTouched in blur asynchronously if necessary
If the model is blurred during an apply it should trigger
$setTouched asynchronously.

Fixes #8762
Fixes #9808
Closes #10014
2014-11-20 23:01:43 +01:00
Peter Bacon Darwin 637d3b47d1 docs($httpProvider): add info about defaults.cache
Closes #10134
2014-11-20 21:25:38 +00:00
Martin Staffa 8ac369e829 docs(ngModelController): update wordings, add more general info
The wordings in setDirty etc. were specific to inputs, but ngModelCtrl
is agnostic to this and the preferred term is 'control'. I also
added some more info about this to the description, and linked to
the example that now lives at the bottom of the page.
2014-11-20 22:19:02 +01:00
Jeff Cross 5c611e898a docs(CHANGELOG): update changelog with 1.2.27 2014-11-20 10:28:02 -08:00
Peter Bacon Darwin dc9775da96 doc(ngModelController): move example below members 2014-11-19 21:31:56 +00:00
IShotTheSheriff e8941c0fe5 feat(ngModelController): add $setDirty method
- extract existing functionality to public method: $setDirty
- add tests to corresponding changes
- refactor code to use extracted method

Closes #10038
Closes #10049
2014-11-19 20:07:07 +01:00
Toilal bb16759f0b docs(jqLite): clarify that Debug Data must be enabled for scope/isolateScope methods
Closes #9515
Closes #10123
2014-11-19 19:54:15 +01:00
Georgios Kalpakas 2b41a5868a feat(ngPluralize): add support for count to be a one-time expression
Closes #10004
2014-11-18 23:49:24 +01:00
Jamshid Afshar 637c020f82 fix($http): return empty headers, ignore properties in Object prototype
Fix response headers with an empty value Empty response header values are legal
(http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html).

The headers getter fn will now only return null if the header property is not an own property.

Closes #7779
Closes #10113
Closes #10091
2014-11-18 16:37:38 -05:00
Georgios Kalpakas f7fde935d5 docs($location): fix method-name and typos in ihshprfx error
Closes #10106
2014-11-18 19:05:45 +01:00
Peter Bacon Darwin 5f552896ab chore(docs): update to dgeni-packages 0.10.7
This update to dgeni-packages fixes some trimIndentation issues

Closes #10101
2014-11-18 14:24:22 +00:00
Peter Bacon Darwin d5968c7853 docs(CHANGELOG): add 1.3.3 changes 2014-11-18 08:23:38 +00:00
PatrickJS 4f4ff5f31b fix(NgModelController): typo $rawModelValue -> $$rawModelValue 2014-11-18 08:08:47 +01:00
Martin Staffa e3764e30a3 fix(ngModel): don't run parsers when executing $validate
Previously, $validate would execute the parsers to obtain a
modelValue for validation. This was necessary, because a validator
that is called outside of model / view update (e.g. from an observer)
otherwise might only an undefined modelValue, because a previous
view update has found a validation $error and set the model
to undefined (as is tradition in angular)

This is problematic as validators that are run immediately after
the ngModelController initializes would parse the modelValue
and replace the model, even though there had been no user input.

The solution is to go back to an older design: the ngModelController
will now internally record the $$rawModelValue. This means a model
or view update will store the set / parsed modelValue regardless
of validity, that is, it will never set it to undefined because of
validation errors.

When $validate is called, the $$rawModelValue will passed to the
validators. If the validity has changed, the usual behavior is kept:
if it became invalid, set the model to undefined, if valid,
restore the last available modelValue - the $$rawModelValue.

Additionally, $validate will only update the model when the validity
changed. This is to prevent setting initially invalid models other
than undefined to undefined (see #9063)

Fixes: #9063
Fixes: #9959
Fixes: #9996
Fixes: #10025

Closes: #9890
Closes: #9913
Closes: #9997
Closes: #10048
2014-11-17 20:26:27 +01:00
Martin Staffa c9899c53ac test(ngModel): group validation tests 2014-11-17 20:26:17 +01:00
Jeff Cross 4d4e6036a9 chore(docs): add favicon to docs app 2014-11-17 09:32:21 -08:00
samuel durand 4d885cbd62 docs($anchorScrollProvider): remove repeated word
Closes #10093
2014-11-17 14:44:23 +00:00
Brian Westrich eec2020518 docs(tutorial/step-5): include sort and filter in json view experiment
Closes #10082
2014-11-17 14:33:50 +00:00
Brian Westrich 2901c53f42 docs(tutorial/step-4): "unknown" option is actually blank
The name 'unknown' doesn't appear as a choice, the new choice is just blank.
Side note: once I choose one of the non-blank options, I no longer see the blank option.

Closes #10079
2014-11-17 13:47:47 +00:00
Peter Bacon Darwin e80053d91f fix($rootScope): handle cyclic references in scopes when creating error messages
Use the new private function `stringify` to convert scope values to strings,
since this can cope with cyclic references and other oddities.

Closes #10085
2014-11-17 13:38:04 +00:00
Peter Bacon Darwin fa12c3c86a fix(ngRepeat): support cyclic object references in error messages
Now that `minErr` can cope with objects that cannot be normally stringified
to JSON, just pass the error arguments straight through without trying to
stringify them first.

Closes #9838
Closes #10065
Closes #10085
2014-11-17 13:37:58 +00:00
Peter Bacon Darwin cf43ccdf9b fix(minErr): stringify non-JSON compatible objects in error messages
Fix the JSON stringification to output a more meaningful string when an
object cannot be normally converted to a JSON string, such as when the
object contains cyclic references that would cause `JSON.stringify()`
to throw an error.

Closes #10085
2014-11-17 13:37:52 +00:00
Shahar Talmi a9352c19ce feat($location): allow to location to be changed during $locationChangeStart
Closes #9607
Closes #9678
2014-11-15 23:25:21 +00:00
Jakub Hampl 6f19a6fd33 fix($http): don't parse single space responses as JSON
Closes #9907
2014-11-15 12:43:24 +01:00
Kent C. Dodds f30163e63a docs(nav): highlight current nav-index-listing
Color the current nav-index-listing item dark red
to make it easier to know where you are.

Closes #9970
Closes #9974
2014-11-15 11:30:23 +01:00
Marcy Sutton 5b23bc9b07 docs(ngAria): Add Usage Details and Examples
Closes #10031
2014-11-14 18:08:42 -05:00
Marcy Sutton 9d1e87a3f1 docs(guide/accessibility): Content updates
Also includes new section on ngMessages
2014-11-14 18:06:59 -05:00
Peter Bacon Darwin 6604c23614 fix(select): ensure the label attribute is updated in Internet Explorer
Only changing the `<option>` text value is not enough to trigger a render
change in IE. We need to explicit update the `label` property too.

Closes #9621
Closes #10042
2014-11-14 21:17:28 +00:00
Peter Bacon Darwin 195deca6e2 test(select): refactor option elements expectations to use toEqualOption matcher
By using a new matcher our tests become less brittle with respect to unimportant
extra attributes.
2014-11-14 21:16:42 +00:00
Caitlin Potter 85eb9660ef fix(ngPattern): match behaviour of native HTML pattern attribute
From https://html.spec.whatwg.org/multipage/forms.html#attr-input-pattern

> The compiled pattern regular expression, when matched against a string, must have its start
anchored to the start of the string and its end anchored to the end of the string.

Closes #9881
Closes #9888
2014-11-14 20:18:57 +00:00
David Stensland d81ff8885b fix(ngMock): call $interval callbacks even when invokeApply is false
Make ngMock.$interval behave like ng.$interval

Closes #10032
2014-11-14 11:42:24 -05:00
Caitlin Potter eca14d98a4 chore($q): make jscs happy
jscs loves to be happy and does not love trailing whitespace.
2014-11-14 11:11:39 -05:00
Bernie Telles 22ecbc50f4 docs($q): explain what the $q service does in description
Explain what the $q service does in description, instead of origin document.

The original explanation was less accessible to people new to promises and JS in general.

Closes #10056
2014-11-14 11:09:37 -05:00
Chatchavan Wacharamanotham 7f857e44a2 docs(guide/compiler): replaced 'locals' with 'scope'
In "Understanding How Scopes Work with Transcluded Directives" section, a text referred to an
obsolete 'locals' instead of 'scope'.

Closes #10018
2014-11-14 11:03:24 -05:00
Caitlin Potter be6920b356 test(orderBy): add test cases for ordering array-like objects
Closes #10060
2014-11-14 10:02:23 -05:00
Karol Wypchło 8eabc5463c perf(orderBy): copy array with slice instead of for loop
Use array slice method to copy entire array instead of a for loop
http://jsperf.com/new-array-vs-splice-vs-slice/54

Closes #9942
2014-11-14 09:34:16 -05:00
Anton Savchenko 14ff529fbb refact(angular.bind): use concat() rather than duplicating code
Closes #4200
2014-11-13 13:33:24 +00:00
Jason Bedard fbad280570 refactor($parse): separate tokenizing vs parsing more
Fixes `a.b` and `a .b` generating different getterFns
Fixes `{'': ...}` turning into `{"''": ...}`
Fixes `{.: ...}` parsing as `{'.': ...}` instead of throwing
Fixes #9131
2014-11-12 23:36:23 +01:00
Pawel Kozlowski 8b775a0d58 docs(guide/expressions): clarify regexp literals usage in expressions
Closes #10026

Closes #10030
2014-11-12 22:50:21 +01:00
Pawel Kozlowski 0bbc6ee481 docs($route): fix description of the caseInsensitiveMatch property
Closes #10028
2014-11-12 21:02:24 +01:00
Blaise Kal 381b185117 docs(guide/expressions): replace curly quotes with straight quotes in code example
REAL QUOTES HAVE CURVES

Closes #10017
2014-11-12 13:50:09 -05:00
Henrique Ramos Limas fa0d8c47c3 docs($controller): mention "controller as" syntax
Closes #10011
2014-11-12 08:13:43 +00:00
PatrickJS 7e233eb58a docs($q): missing finally notifyCallback API
finally allows for notifyCallback and is missing in the Docs
https://github.com/angular/angular.js/blob/v1.3.2/src/ng/q.js#L288

Closes #10010
2014-11-12 08:04:56 +00:00
Caitlin Potter b7afd11d26 refactor($parse): don't use bind-once interceptor for non-bind-once expressions
Side-effects:
  - Logic for allOrNothing watches now lives in $interpolate rather than $parse

Credit to @jbedard for idea to remove $watch interceptors craziness from $interpolate. Even though
it technically didn't actually work, it was worth a shot, and helped clean things up a bit. Go team!

Closes #9958
Closes #9961
2014-11-11 20:29:36 -05:00
Georgios Kalpakas 8582088b36 docs($q): remove IE8-specific notice
Closes #10008
2014-11-11 21:03:51 +01:00
Pawel Kozlowski 0db573b749 feat($routeProvider): allow setting caseInsensitiveMatch on the provider
Fixes #6477

Closes #9873
2014-11-11 20:20:16 +01:00
codef0rmer 5e78af769e docs(guide/Index): add book AngularJS UI Development
Matthias and I wrote a book on AngularJS which might be helpful for Angular developers.

Merci~!

Closes #9971
2014-11-11 14:13:28 -05:00
AlexChan 804e75045c docs(ngModel.NgModelController) use $evalAsync instead of $apply for event handling
Have the apply called safely during events by using `$evalAsync` rather than `$apply`
This will help ensure that an apply for a user directive is not called during a digest cycle.

Closes #9891
2014-11-11 13:59:17 -05:00
Dim ebc3b7b1c3 docs(minerr/unpr): fix code example
Closes #10000
2014-11-11 12:35:19 +01:00
Andreas Fischer 830846f664 docs(guide/Modules): missing "a" in "a collection"
Closes #10001
2014-11-11 12:24:30 +01:00
yarsh 0462ee6659 docs(ngModelOptions): minor grammer error
Closes #9928
2014-11-11 10:20:32 +01:00
rsperberg 9cc6835819 docs(guide/Conceptual Overview): change "a" to "an" before "ng-controller"
Closes #9895
2014-11-10 20:41:04 +01:00
inphovore ee1fc1dc13 docs(guide/Bootstrap): batarang link correction
Closes #9869
2014-11-10 19:42:20 +01:00
Nicholas Albion 41b36e689c docs($compile): bindToController clarification
It was not clear that `bindToController` is a boolean.

Closes #9835
2014-11-10 19:19:05 +01:00
Georgios Kalpakas 52545e5a74 docs($browser): minor docs fixes
Remove obsolete `XHR` param from the docs and correct
`$log` param description.

Closes #9810
2014-11-10 19:07:15 +01:00
Justin 2abea7514a docs(select): minor markdown syntax fix
Half the sentence was being highlighted as code.

Closes #9983
2014-11-10 12:05:46 -05:00
Martin Staffa f157d02793 docs(ngModelController): clarify parse errors
Closes #9952
2014-11-09 23:31:27 +01:00
Rouven Weßling 77d8ae1d45 refactor($location) Remove unused variables
These were left around in 736c8fbbae

Closes #9482
2014-11-09 16:18:00 +01:00
Henry Zhu e21b6ff3ff style(*): add rule requireSpacesInConditionalExpression
Closes #9973
2014-11-09 15:51:01 +01:00
Henry Zhu 06016bb12c style(*): add rules requireSpace(After|Before)BinaryOperators 2014-11-09 15:51:01 +01:00
Arjunkumar 50e72fcae1 docs(guide/migration): typo fix
spell check propery to property

Closes #9937
2014-11-08 14:56:39 +01:00
micellius b84e62bd28 docs(CHANGELOG): ohmygosh they're different ohmygoshohmygosh
Align versioning format

Closes #9968
2014-11-08 08:11:51 -05:00
Igor Minar b6fd184a93 docs(CHANGELOG): add a security note to the 1.3.2 log 2014-11-07 17:09:44 -08:00
Caitlin Potter 1db9e617ce docs(CHANGELOG): slight fixup 2014-11-07 14:11:10 -05:00
Caitlin Potter 0918f146e4 docs(CHANGELOG): add v1.3.2 changes 2014-11-07 14:09:32 -05:00
Brian Ford 6dfd938bbc docs(guide/index): link to security 2014-11-07 10:32:10 -08:00
Brian Ford 4f5a60bcca docs($parse): formatting, link to security docs 2014-11-07 10:32:10 -08:00
Brian Ford e593939411 docs(security): add security doc 2014-11-07 10:32:10 -08:00
Martin Staffa 9e305948e4 fix(select): use strict comparison for isSelected with selectAs
Closes #9639
Closes #9949
2014-11-07 13:22:01 -05:00
Lucas Galfaso ed99821e4d fix($parse): stateful interceptors override an undefined expression
When using `$parse` with a stateful interceptor and the expression
is `undefined`, then return the result from the interceptor

NOTE from Igor: this is not the best solution. We need to refactor
this and one-time + $interpolate code to properly fix this. @caitp
is on it. See discussion in the PR.

Closes #9821
Closes #9825
2014-11-07 10:17:32 -08:00
Chirayu Krishnappa e057a9aa39 fix($parse, events): prevent accidental misuse of properties on $event 2014-11-06 19:30:48 -08:00
Chirayu Krishnappa e676d642f5 fix($parse): add quick check for Function constructor in fast path 2014-11-06 19:30:48 -08:00
Lucas Galfaso 288b531626 docs(CHANGELOG): Document breaking change from 23bc92b1
Document the breaking change from 23bc92b1

Closes #9947
2014-11-06 15:27:44 -05:00
rsperberg 7a4df50480 docs(guide/concepts): spell "Angular" with cap "A", fix typos
In these two instances, Angular was spelled with a lower-case "a." All occurrences should be spelled
consistently.

Compound adjectives preceding the noun they modify should generally be hyphenated (cf Chicago Manual
of Style, 6.40), e.g., "so-called directives."

Closes #9896
2014-11-06 14:16:16 -05:00
Adir 6550198003 docs(guide,tutorial): fix outdated Protractor API link
Link to the gh-pages deployment of protractor docs, it's much easier on the eyes.

Closes #9946
2014-11-06 13:57:50 -05:00
Marcy Sutton c6909ed144 docs(guide/accessibility): Add in-depth guide
Closes #9930
2014-11-06 10:17:37 -05:00
Marcy Sutton 187e43185d feat(ngAria): announce ngMessages with aria-live
By including the `ngAria` module, `ngMessages` will automatically include the aria-live
attribute with an assertive voice, allowing validation messages to be spoken throuhg a
screenreader.

Closes #9834
2014-11-05 17:50:18 -05:00
Peter Bacon Darwin 91834bcf37 test($compile): use ngMock.Scope.$countChildScopes() 2014-11-05 20:41:51 +00:00
Dave Longley 841c090755 fix($compile): do not rebind parent bound transclude functions
The `$compile` public API documentation indicates that
a transclude function may be passed as a second parameter, but
it was not clear that this is **not** the same function that is given
to directive link functions as the `transcludeFn` parameter.

We would like to be able to pass in a transclude function the public
linking function that is returned from `$compile` if we wish to, for
example, use lazy compilation inside a directive.

Doing so, however, highlighted two bugs:

* First, the transclude function would get rebound, incorrectly, changing
its scope from its original binding.
* Second, the `containingScope` would not be updated and the wrong
`$parent` would be assigned to the `transcludedScope` resulting in a
memory leak.

This patch fixes both of these issues.

It also converts various private optional positional parameters on `publicLinkFn`
into an `options` parameter, which is an object hash. The new `options`
parameter is documented as part of the public API.

Thanks to @lgalfaso, @tbosch, and @petebacondarwin.

Closes #9413
2014-11-05 20:41:51 +00:00
Kent C. Dodds da960544f1 docs(guide/Running in Production): ng-strict-di
Adding note about Strict DI mode.

Closes #9908
2014-11-05 14:43:13 -05:00
Igor Minar 74981c9f20 feat(ngMock): decorator that adds Scope#$countChildScopes and Scope#$countWatchers
When writing tests it's often useful to check the number of child scopes
or watchers within the current current scope subtree. Common use-case for advanced
directives is to test that the directive is properly cleaning up after itself. These
new methods simplify writing assertions that verify that child scopes were properly
destroyed or that watchers were deregistered.

Closes #9926
Closes #9871
2014-11-05 13:23:19 -05:00
danielmbarlow dc4b06559f docs(tutorial/step_12): added 'see phone-detail change'
This one caught me out for a while because, despite the note underneath, I didn't notice the addition
of <div class="phone-images"> and it's repeater until later.

Closes #9924
2014-11-05 12:13:57 -05:00
danielmbarlow 56138bdd63 docs(tutorial/step_12): small change to overview
The bullet points at the beginning of the article were a little hard to understand because they
didn't follow the grammatical form of the preceding articles. I hope these small modifications make
it a little easier for someone else to read.

Closes #9922
2014-11-05 09:08:56 -05:00
danielmbarlow 0ccc4fcd89 docs(tutorial/step_05): explain need for $httpBackend.flush in tests
There is an excellent explanation for the need for this in the documentation that may be helpful to
tutorial users, so I added a link to it.

Closes #9919
2014-11-05 08:36:37 -05:00
Julie Ralph b7e2b01bb5 chore(ci): update protractor to version 1.4.0 2014-11-04 17:16:19 -08:00
Tobias Gesellchen 0c19482d03 chore(.gitignore): ignore IntelliJ IDEA module files
Ignore IntelliJ IDEA modules files in the git repository

Closes #5273
2014-11-04 12:46:31 -05:00
Tero Parviainen 0f7bcfdf93 docs(guide/scope): describe watch depths
Describe and visualize the three watch strategies: By reference, by collection items, and by value.

Closes #9388
2014-11-03 12:44:16 -08:00
Loring Dodge 9a26ab5870 docs($route): replace comma with "and"
Remove a comma and replace with "and" on line 444

Closes #9889
2014-11-03 20:58:46 +01:00
jbnizet d906ed3100 docs(input): replace dateTimeLocal by datetime-local
Fixes #9856
Closes #9870
2014-11-02 19:58:32 +01:00
Martin Staffa 0b16d10d2d docs(ngValue): clarify the limitations of ngValue and option elements 2014-11-02 19:47:09 +01:00
Martin Staffa e0198c1cda docs(ngModelController): add $name property 2014-11-02 18:43:52 +01:00
Martin Staffa ba731ab850 docs(ngModelController): remove bogus @param fields 2014-11-02 18:43:52 +01:00
Caitlin Potter e69c1806a8 style(routeSpec.js): make jshint happy 2014-11-01 18:11:51 -04:00
cmichal b4770582f8 fix(ngRoute): allow proto inherited properties in route params object
copy route params with angular.copy before using angular.extend which looks only for enumerable own
properties

Closes #8181
Closes #9731
2014-11-01 18:08:24 -04:00
Henry Zhu 2a2fd14c08 docs(guide/Forms): clarify ngModel behavior for validation
Bueno!

Closes #9866
2014-10-31 18:08:22 -04:00
Jeff Cross e4eb382f2d docs(changelog): add release notes for 1.3.1 spectral-lobster 2014-10-31 10:39:14 -07:00
Ryan Smith ed6e91b318 fix($animate): properly handle class resolution when element data is missing
Closes #9636
2014-10-31 12:28:58 -04:00
Julie Ralph 7b7b082125 chore(ci): fix broken sauce connect download url 2014-10-31 09:24:07 -07:00
eltacodeldiablo 3831e45a7d chore(.editorconfig): remove settings for ngLocale after change to scripts 2014-10-31 11:27:35 -04:00
Henry Zhu 018991f8c8 chore(build): exclude generated files in src/ngLocale from jscs check
The robots don't generate super-clean code ._.
2014-10-31 11:27:35 -04:00
Henry Zhu c77f5d1a29 chore(travis): reorder linting tasks to after unit tests 2014-10-31 11:27:34 -04:00
Henry Zhu 030101a43a style(*): add numerous JSCS rules to unify code-styles in the tree
Changes:

  - add rule requireSpaceBeforeBlockStatements (require space before brace when opening block statement)
  - add operators to rule disallowSpaceAfterPrefixUnaryOperators (no space after prefix inc/dec ops)
  - add rule disallowSpaceBeforePostfixUnaryOperators (no space before postfix inc/dec ops)
  - add rule disallowSpacesInsideArrayBrackets (array literals no longer padded with spaces)
  - add rule requireCommaBeforeLineBreak (line can't start with comma token)
  - add rule validateLineBreaks (require LF linebreaks)

Closes #9792
2014-10-31 11:27:16 -04:00
Uri Goldshtein 2a0254e181 docs(guide/index): add link to angular-meteor
Bueno!

Closes #9844
2014-10-30 11:12:54 -04:00
Tim Raymond ce20dd06fe docs(ngValue): replace input[select] with option for clarity
It is impossible to create an `input[select]`, so it appears
the intention here was actually `option`.

Fixes #7994
Closes #8203
2014-10-29 20:40:48 +01:00
Jeff Cross d7a78e420a docs(select): add more notes about ngRepeat and clean up style
Closes #9592
2014-10-29 12:15:39 -07:00
Juan Gabriel Jimenez Campos 4b4098bfca fix(select): assign result of track exp to element value
Fixes a regression where the option/select values would always be set to
the key or index of a value within the corresponding collection. Prior to
some 1.3.0 refactoring, the result of the track expression would be bound
to the value, but this behavior was not documented or explicitly tested. A
cache was added in order to improve performance getting the associated
value for a given track expression.

This commit adds one explicit test for this behavior, and changes several
other trackBy tests to reflect the desired behavior as well.

Closes #9718
Fixes #9592
2014-10-29 11:37:48 -07:00
Ralph Samuel c3b3b90bc9 docs(guide/Scopes): add "the" in front of "DOM" on line 42
Closes #9818
2014-10-29 13:50:57 -04:00
kboutsen 43b1a3739a docs(tutorial/step_4: update test to match new $bindings behaviour
var phoneNameColumn = element.all(by.repeater('phone in phones').column('{{phone.name}}'));
should be
var phoneNameColumn = element.all(by.repeater('phone in phones').column('phone.name'));

Closes #9823
2014-10-29 11:02:04 -04:00
Jeff Cross b4db713cde fix(jenkins): reset baseUrl in protractor conf
Commit 22b817ec11 changed the url
used by protractor in all docs tests to prepend "build/docs", which
was already set to the `baseUrl` in `protractor-jenkins.conf`. This
commit just changes the protractor config's `baseUrl` to adapt
to the changes in the spec files.

Closes #9783
2014-10-28 13:19:25 -07:00
Georgios Kalpakas df3d739654 docs(guide/*): fix typos and links
Fix some typos and link-errors introduced in
https://github.com/angular/angular.js/commit/d1ccf176351cda2b49599374c7d4ba594796012f.

Related to #9786
Closes #9800
2014-10-27 12:32:30 -04:00
ChristianKohler 99ec8d66c5 chore(docs): clarify comment which was copy&paste from dgeni example
It makes people happy, so why not

Closes #9798
2014-10-27 12:23:04 -04:00
Brian Ford d1ccf17635 docs(guide/*): improve explanation of strictDi
Closes #9786
2014-10-27 04:26:43 -07:00
Brian Ford c3fcbbd750 docs(guide/services): use array annotation in example 2014-10-27 02:51:02 -07:00
Brian Ford 29d727210d docs(guide/bootstrap): link to batarang 2014-10-27 02:24:07 -07:00
Christian Liebel 875f8f6557 test(ngSanitize): fix test descriptions
SVG attribute test splitted, descriptions changed accordingly

Related to #9770
Closes #9787
2014-10-25 14:03:26 +02:00
Judy Tuan f34c1ff53f docs(misc/Develop): update required Java version 2014-10-25 13:53:26 +02:00
Peter Bacon Darwin 54ddca537e chore(docs/search): ensure that default search goes to API first
Closes #9736
2014-10-25 09:39:24 +02:00
Kent C. Dodds 2cd5b4ec44 fix($compile): returning null when an optional controller is not found
Currently, `undefined` is returned. However, the desired behavior is to
return `null` when the controller is optional and not found.

(If this breaks your app, it really shouldn't .v.)

Closes #9404
Closes #9392
2014-10-24 15:14:31 -04:00
Kent C. Dodds 4bf254c155 test($compile): add test for optional require in directives with ^ operator
The directive property `require` allows optional requirement via
the `?` before or after the `^` operator. Add tests to ensure this
functionality is not lost inadvertently.

Closes #9391
Closes #9392
2014-10-24 15:14:20 -04:00
Shahar Talmi d0226ebbbf chore(npm): updated some packages so shrinkwrap works with npm@2.x
some packages were using versions that do not match semver@4 semantics and therefore generated
errors when trying to create shrinkwrap with npm@2.x. this shrinkwrap will make it much easier to
update the shrinkmap from now on

Closes #9706
2014-10-24 15:09:03 -04:00
Shahar Talmi 3df9de2e31 chore(npm): add cheerio to npm shrinkwrap
Closes #9706
2014-10-24 15:09:00 -04:00
Shahar Talmi 4d12812bb4 refactor(tests): remove some duplicate conditions
Closes #9706
2014-10-24 15:08:56 -04:00
Shahar Talmi 42f7c80bb6 chore(tests): remove redundant file
Closes #9706
2014-10-24 15:08:43 -04:00
Georgios Kalpakas 7574dd25d9 style(filterSpec): fix white-space and newline inconsistencies
Closes #9765
2014-10-24 14:51:34 -04:00
flezen 3b3d9218e8 docs(tutorial/step_11): it says there are 4 tests, BUT THERE ARE 5!
Bueno!

Closes #9775
2014-10-24 11:17:47 -04:00
Georgios Kalpakas e780eeee27 test(ngSanitize): enhance test regarding the xlink:href attribute
Closes #9770
2014-10-23 21:13:07 -04:00
Georgios Kalpakas 4cccf0f2a8 fix(ngSanitize): attribute name: xmlns:href -> xlink:href
Closes #9769
2014-10-23 21:03:18 -04:00
Christian Liebel a54b25d779 feat(ngSanitize): accept SVG elements and attributes
SVG elements and attributes are now accepted and sanitized by ngSanitize.

Closes #9578
Closes #9751
2014-10-23 16:40:34 -04:00
Caitlin Potter 36666f6fad chore(compileSpec): make jscs happy
Broke because 40bbc98178 landed before d3b1f502e3
2014-10-23 16:29:52 -04:00
Henry Zhu d3b1f502e3 style(*): add rule disallowSpacesInAnonymousFunctionExpression beforeOpeningRoundBrace, including i18n generator 2014-10-23 15:59:26 -04:00
Henry Zhu 94f5a285bf fix(i18n): rename datetimeSymbols to be camelCase 2014-10-23 15:59:25 -04:00
Henry Zhu 7f65f97919 style(*): add rule requireSpacesInFunction beforeOpeningCurlyBrace
This rule enforces a space after the curly brace
for function declarations, anonymous function expressions,
and named function expressions.
2014-10-23 15:59:25 -04:00
Henry Zhu 922162853b style(*): add rule disallowSpacesInFunctionDeclaration beforeOpeningRoundBrace 2014-10-23 15:59:25 -04:00
Henry Zhu 655fccce3a style(*): add disallowSpacesInNamedFunctionExpression beforeOpeningRoundBrace 2014-10-23 15:59:24 -04:00
Gabriel Monteagudo 40bbc98178 feat($compile): allow $watchCollection to be used in bi-directional bindings
an asterisk can be specified in the binding definition to use $watchCollection instead of $watch.
e.g. scope: { prop: '=*' }

Closes #9725
2014-10-23 14:08:55 -04:00
Olivier Louvignes 9ad6c77568 docs($animate): describe how to avoid conflicts with 3rd party CSS frameworks
Closes #8569
Closes #9722
2014-10-23 18:31:14 +02:00
Peter Bacon Darwin cfe7b0e9ef docs(ngShowHide): use local bootstrap CSS 2014-10-23 12:05:05 +02:00
Rouven Weßling 031d4cd2a9 chore($sniffer) remove Opera < 15 vendor prefixes and document it
Closes #9483
2014-10-22 15:38:36 -04:00
alindberg acbd302efb docs(tutorial/tutorial): instructions to install npm on debian
Additional package required for a Debian install

Closes #9749
2014-10-22 14:16:21 -04:00
Rouven Weßling 37790e920d refactor(Angular) use Object.keys instead of manually constructing array
Shrink dat coed ;u

Closes #9704
2014-10-22 14:00:54 -04:00
Pablo Villoslada Puigcerber 531a8de72c fix($observe): check if the attribute is undefined
Check if the attribute is undefined before manually applying the function because if not an
undefined property is added to the scope of the form controller when the input control does not
have a name.

Closes #9707
Closes #9720
2014-10-22 13:45:37 -04:00
Martin Hochel d488a89466 docs($http): document $httpProvider.interceptors in $httpProvider documentation
☆.。.:・゜☆ HASHBANG #NGEUROPE ☆.。.:・゜☆

Fixes #9366
Closes #9728
2014-10-22 11:25:22 -04:00
Nehil Jain 3635721ce4 docs(guide/expressions): add commas to run-on sentences to make them clearer
Closes #9738
2014-10-22 10:49:18 -04:00
Cyril Lakech e9c5be58ab docs(form.FormController): add date parse error tokens to FormController.$error
☆.。.:・゜☆  Closes #9743 ☆.。.:・゜☆
2014-10-22 10:26:24 -04:00
marcin-wosinek 5d7763ebf9 docs($templateCache): clarify inline template
Current doc doesn't state required tag location clear enough. It was
[stack overflow|http://stackoverflow.com/a/16125138] where I've found that requirement

Closes #9741
2014-10-22 10:01:58 -04:00
Jackson Ray Hamilton 0a380b4264 docs(guide/bootstrap): close script tag
Closes #9739
2014-10-22 00:44:53 -04:00
Michal Cieplucha 52ceec2229 fix(templateRequest): allow empty html template
allow empty html template and not throw error

Closes #9581
2014-10-21 06:31:25 -07:00
Jason Bedard 38d12de661 refactor(*): removing unused vars
Close #9710
2014-10-21 14:22:24 +02:00
Dwayne Crooks 89c57a8761 docs(ngModel.NgModelController): remove extra 'to'
Closes #9702
2014-10-20 21:34:04 +01:00
Caitlin Potter 2240c113f5 chore(tests): implement e2e test harness outside of docs app
Included:

- A sample test fixture
- A sample test
- Server middleware to serve the E2E harness
- Convenient test helpers to simplify loading the right fixture

Closes #9557
Closes #9527
2014-10-20 11:26:09 -04:00
Caitlin Potter fc56c9b3cc chore(package.json): add cheerio dependency
It's tinier than jsdom, and seems to work okay for generating the fixtures.
2014-10-20 11:24:35 -04:00
Peter Bacon Darwin 22b817ec11 chore(docs): fix path to docs-app e2e tests
These tests are not generated by dgeni and so needed to have the paths
to the pages updated manually.

Closes #9680
2014-10-20 10:42:34 -04:00
Peter Bacon Darwin 762713e660 chore(docs): configure the base path for protractor tests in examples
Updates to dgeni-packages 0.10.5 which supports this configurability.
Change the dgeni config and protractor config so that we can have protractor
tests that are hosted outside the build/docs folder.

Provides support for https://github.com/angular/angular.js/pull/9557#discussion_r18977324
2014-10-20 10:42:25 -04:00
Peter Bacon Darwin d97b427656 docs(error/$injector/modulerr): add info about not monkey-patching ng
Closes #7709
Closes #9692
2014-10-20 14:20:46 +01:00
Po Chen 303610c743 docs(guide/location): fix a typo
Closes #9693
2014-10-20 13:20:05 +01:00
Bastien Caudan 1025f6ebf4 fix(ngMock): $httpBackend should match data containing Date objects correctly
If a response or expectation contained a date object then `$httpBackend.expect`
was not matching correctly.

This commit encodes then decodes the object being matched to ensure consistency.

Closes #5127
2014-10-20 13:06:44 +01:00
lguyot a7f886e6c8 docs(tutorial/step-11): remove excess words
Closes #9690
2014-10-20 12:11:03 +01:00
Augustas b8f3ad4b21 docs(tutorial/step-7) - correct a url
Closes #9688
2014-10-20 11:43:58 +01:00
Henry Zhu 483ce91da2 style(*): add disallowSpacesInsideParentheses rule to jscs
Closes #9685
2014-10-20 10:39:46 +01:00
Henry Zhu 31ec9f14ef style(*): add validateParameterSeparator rule to jscs
Closes #9685
2014-10-20 10:39:37 +01:00
Henry Zhu 8b921617e9 style(*): add disallowTrailingComma rule for objects and arrays
Closes #9685
2014-10-20 10:39:32 +01:00
Henry Zhu e4ce0ddda5 chore(jscs): alphabetize jscs rules 2014-10-20 10:39:15 +01:00
Peter Bacon Darwin e1c0a8e642 docs(guide/introduction): remove ambiguous "code-behind" jargon
This commit tries to remove the jargon and explain in plain English what
it means to add "code-behind" via a directive.

Closes #9684
2014-10-20 10:32:06 +01:00
Rouven Weßling ba9d0738cd refact(Angular.js) remove unused functions
This removes the functions size() and isLeafNode().

Closes #9682
2014-10-20 10:21:57 +01:00
Peter Bacon Darwin 998c61cbe0 chore(docs): copy the correct docs assets
The docs images had been duplicated in

```
docs/img/
```

and

```
docs/app/assets/img
```

This commit fixes the gulp build to use the doc images from `docs/img` and
removes the duplocates from `docs/app/assets/img`

Closes #9655
2014-10-19 11:56:58 +01:00
Brian Ford 35e2a068ad docs(guide/forms): add animated gifs 2014-10-19 11:25:35 +01:00
Brian Ford 146440c5b2 chore(grunt): do not rewrite gif urls 2014-10-19 11:25:35 +01:00
Dmytro Yarmak bf9e7bfb5a fix($rootScope.$on) check listener existense while deregistering
Check that listener is still present in $$listeners before decrease
$$listenerCount. It fixes problem with incorrect $$listenerCount after
call deregistering function multiple times.

Closes #9666
Closes #9667
2014-10-19 11:21:56 +01:00
Henry Zhu ed3f799b5c style(*): disallow space after object keys, other rules
add `disallowSpaceAfterObjectKeys` and associated changes.
add `disallowMixedSpacesAndTabs` (no files changed)
add `disallowMultipleLineStrings` (no files changed)

Closes #9679
2014-10-19 11:09:16 +01:00
Peter Bacon Darwin b64b9ea02c docs(guide/directive): clarify directive matching example
Closes #9311
2014-10-19 11:02:02 +01:00
Wédney Yuri 7fa66348cb docs(angular.extend): explanation of deep copy.
It is very common to see many developers confused about it.

Closes #9672
2014-10-19 10:54:32 +01:00
Starojitski e5c53b393b docs(tutorial/step-2): add missing span elements
In Lession 1 template has phone names within `span` element, while in
lession 2 the name is directly within the wrapper `div`

Closes #9670
2014-10-19 09:30:19 +01:00
Juan M. Cuello 24d00cce4f docs(error/dupes): Little fix in explanation text.
Little fix in docs/content/error/ngRepeat/dupes.ngdoc.

Closes #9673
2014-10-18 15:38:55 -04:00
Henry Zhu accb22d644 style(*): enforce spaces after keywords, add spaces
Closes #9677
2014-10-18 10:15:40 -04:00
Michał Gołębiowski 1785251eab refactor($sce): don't depend on $document
The $sce dependency on $document was added in 64241a5 because it was thought
it's not possible to easiy use the msie variable in this module. This was
changed in 45252c3, though so it's no longer needed to depend on $document.

Closes #9671
2014-10-18 01:48:37 +02:00
Caitlin Potter fe58238e35 chore(.jshintrc): make jshint happy due to 1bd473e 2014-10-17 18:27:26 -04:00
Caitlin Potter 1bd473eb45 fix($templateRequest): ignore JSON Content-Type header and content
Normally, if there is a Content-Type header with the string "application/json", or else the content
looks sort of JSON-y, $http will attempt to deserialize the JSON into an object. $templateRequest
is intended to request markup, and as such should never attempt to parse JSON, regardless of the
headers or shape of the content.

Closes #5756
Closes #9619
2014-10-17 18:07:35 -04:00
Martin Staffa 9078a6ae37 docs(guide/form): shorten line lengths for better readability 2014-10-17 23:23:45 +02:00
Martin Staffa e9dcec0c5d docs(guide/forms, input): add information how to modify built-in validators
Closes #5757
Closes #7798
2014-10-17 23:23:44 +02:00
Martin Staffa d5457bb83b docs(guide/forms): update custom validation section with $validators 2014-10-17 23:23:41 +02:00
Martin Staffa 036871df5e docs(input): clarify input and ngModel behavior 2014-10-17 23:23:39 +02:00
Martin Staffa c06e12276b docs(guide/forms, ngModel): update list of css classes 2014-10-17 23:23:37 +02:00
Martin Staffa 4aaf47534e docs(ngModel): clarify usage of formatters / parsers and $setValidity 2014-10-17 23:23:36 +02:00
Kim Pettersen 502bb648ff chore($locale): add quotation marks to reserved keyword "short"
Although the "short" keyword was pulled as a reserved word from ES5, compilers like
YUICompressor still treat it as reserved and may break.

See 7.6.1.1 of ES5 spec for updated reserved words: http://www.ecma-international.org/publications/files/ECMA-ST-ARCH/ECMA-262%205th%20edition%20December%202009.pdf

Closes #5320
2014-10-17 14:05:16 -07:00
Shahar Talmi 6cba9c5e7c refactor(ngScenario): remove redundant msie variable 2014-10-17 23:06:55 +03:00
Shahar Talmi 6e5e76e4b1 refactor(Angular): removed redundant test 2014-10-17 22:50:53 +03:00
Shahar Talmi 45252c3a54 fix($sce): use msie instead of $document[0].documentMode
this is important so that people can mock $window without having to add stuff that angular uses internally into it

Closes #9661
2014-10-17 22:35:31 +03:00
Siddhartha c2edef86c5 docs(readme): fixing the &lt; in the benchmarks readme.md page
Closes #9615
2014-10-17 01:01:04 -07:00
Henry Zhu 5b982998c3 chore(jscs) change deprecated rules for jscs todo
Closes #9616
2014-10-17 00:54:19 -07:00
Henry Zhu d7f84e2d7f chore(jscs): update jscs and update deprecated rules
Updated grunt-jscs and deprecated rules:
requireLeftStickedOperators and requireRightStickedOperators.

Fixes #9429
Closes #9616
2014-10-17 00:54:00 -07:00
Joao henriques fddf4bd5fe docs($location) fix $$parse parameter name
Replaced newAbsoluteUrl by url parameter.

Closes #9650
2014-10-17 00:39:06 -07:00
Georgios Kalpakas c2fb4b6986 test($resource): enhance test-case to verify correct behaviour
Previously, the test-case verified that calling `toJson()`, would remove
the `$promise` and `$resolved`, but not that other `$`-prefixed properties
would not be removed.

Closes #9628
2014-10-17 00:30:37 -07:00
Karol Wypchło 8b2f1a47b5 fix(loader): fix double spaces
Fix double spaces in return statement. Double spaces between return and
returned value brake minification process of some minifiers (bug found on JSMin
https://github.com/mrclay/jsmin-php).

Closes #9630
2014-10-17 00:28:48 -07:00
Brian Ford fb1b202f38 docs(guide/forms): improve readability and formatting 2014-10-16 15:17:32 -07:00
Daniel Luz 47e15aa2b4 docs(ngEventDirs): update remarks on behavior
The event directives haven't stopped propagation by default in a long time.
If that behavior is desired, the handler may use the provided `$event` to call:

    $event.stopPropagation();

Closes #9640
2014-10-16 16:44:22 -04:00
Georgios Kalpakas 22da294cbb docs(jqLite): typo: getComputedStyles() -> getComputedStyle() 2014-10-16 20:06:04 +02:00
Michał Gołębiowski 22407a9296 refactor(jqLite): remove a duplicate DOMContentLoaded handler attachment 2014-10-16 12:36:45 +02:00
Andrey Taritsyn fc70a98be4 refactor($compile): simplify regular expressions
Closes #9637
2014-10-15 21:27:11 -07:00
Alex Norton 49d03a5b2e docs(guide/directive): fix typo 2014-10-15 15:05:02 -07:00
Tobias Bosch ed85ec4d70 docs(input): ngModel uses priority 1 2014-10-15 09:18:49 -07:00
Jeremiah Hoyet 6502ab0977 doc(angular.forEach): note difference from ES262's Array.prototype.forEach
Since Angular's forEach is not a strict polyfill, and takes different paths depending on the type
of collection it is dealing with, it does not throw a TypeError when converting the obj with
ToObject(), as this operation does not need to be performed.

This difference is documented nicely here.

Closes #9142
2014-10-14 10:55:31 -04:00
Julie Ralph 02aa4f4b85 fix(testability): escape regex chars in findBindings if using exactMatch
Move the function to escape regexps to Angular.js, fix the link, and use it in
the $$testability service.

Closes #9595
Closes #9600
2014-10-14 10:42:13 +01:00
Ciro Nunes 69bf2f02d0 docs(ngModel): fix anchor text
Closes #9604
2014-10-14 10:12:25 +01:00
Georgios Kalpakas fd375c5d46 chore(CHANGELOG): fix name of jqLiteDocumentLoaded function
The newly added private jqLiteDocumentLoaded function is referred to as
jqDocumentComplete (due to a wrong commit message).

Closes #9610
2014-10-14 09:48:14 +01:00
Afshin Mokhtari b8b63df664 docs(CONTRIBUTING): prototypical -> prototypal
Closes #9608
2014-10-14 09:45:37 +01:00
HeberLZ 28661d1a8c fix($parse): support dirty-checking objects with null prototype
Objects created with `Object.create(null);` do not have a `valueOf` method unless
they supply one themselves. To accomodate these, Object.prototype.valueOf is
used when the type of the value is "object", and the `valueOf` property is not
a function (E.G. it's not in the object at all).

Closes #9568
2014-10-13 23:09:19 -04:00
Michał Gołębiowski 7f4d24c6fa chore(npm): update npm dependencies
Some of previous dependencies versions (e.g. Karma) didn't work with
Node 0.11.14, see:
https://github.com/karma-runner/karma/pull/1182

The only dependencies not updated in this commit are:

1. grunt-jscs-checker: its
rules have changed a lot so it will require more work to use the newer
version
2. gulp-jshint: the update breaks docs linting, it requires investigation

Closes #9571
2014-10-13 15:55:20 -07:00
1081 changed files with 48394 additions and 18594 deletions
-3
View File
@@ -10,9 +10,6 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[src/ngLocale/**]
insert_final_newline = false
[dropdown-toggle.js]
trim_trailing_whitespace = false
insert_final_newline = false
+1
View File
@@ -13,6 +13,7 @@ angular.js.tmproj
bower_components/
angular.xcodeproj
.idea
*.iml
.agignore
.lvimrc
libpeerconnection.log
-6
View File
@@ -1,6 +0,0 @@
{
"disallowKeywords": ["with"],
"disallowTrailingWhitespace": true,
"requireRightStickedOperators": ["!"],
"requireLeftStickedOperators": [","]
}
-19
View File
@@ -1,19 +0,0 @@
// This is an incomplete TODO list of checks we want to start enforcing
//
// The goal is to enable these checks one by one by moving them to .jscs.json along with commits
// that correct the existing code base issues and make the new check pass.
{
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"],
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
"disallowLeftStickedOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"disallowRightStickedOperators": ["?", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"disallowImplicitTypeConversion": ["string"],
"disallowMultipleLineBreaks": true,
"disallowKeywordsOnNewLine": ["else"],
"requireLineFeedAtFileEnd": true,
"validateJSDoc": {
"checkParamNames": true,
"requireParamTypes": true
}
}
+48
View File
@@ -0,0 +1,48 @@
{
"excludeFiles": ["src/ngLocale/**"],
"disallowKeywords": ["with"],
"disallowKeywordsOnNewLine": ["else"],
"disallowMixedSpacesAndTabs": true,
"disallowMultipleLineStrings": true,
"disallowNewlineBeforeBlockStatements": true,
"disallowSpaceAfterObjectKeys": true,
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
"disallowSpaceBeforeBinaryOperators": [","],
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
"disallowSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInCallExpression": true,
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInsideArrayBrackets": true,
"requireSpaceBeforeKeywords": [
"else",
"while",
"catch"
],
"disallowSpacesInsideParentheses": true,
"disallowTrailingComma": true,
"disallowTrailingWhitespace": true,
"requireCommaBeforeLineBreak": true,
"requireLineFeedAtFileEnd": true,
"requireSpaceAfterBinaryOperators": ["?", ":", "+", "-", "/", "*", "%", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "&&", "||"],
"requireSpaceBeforeBinaryOperators": ["?", ":", "+", "-", "/", "*", "%", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "&&", "||"],
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
"requireSpaceBeforeBlockStatements": true,
"requireSpacesInConditionalExpression": {
"afterTest": true,
"beforeConsequent": true,
"afterConsequent": true,
"beforeAlternate": true
},
"requireSpacesInForStatement": true,
"requireSpacesInFunction": {
"beforeOpeningCurlyBrace": true
},
"validateLineBreaks": "LF"
}
+30 -7
View File
@@ -2,33 +2,56 @@ language: node_js
node_js:
- '0.10'
cache:
directories:
- node_modules
- bower_components
- docs/bower_components
branches:
except:
- /^g3_.*$/
env:
matrix:
- JOB=unit
- JOB=e2e TEST_TARGET=jqlite
- JOB=e2e TEST_TARGET=jquery
- JOB=unit BROWSER_PROVIDER=saucelabs
- JOB=docs-e2e BROWSER_PROVIDER=saucelabs
- JOB=e2e TEST_TARGET=jqlite BROWSER_PROVIDER=saucelabs
- JOB=e2e TEST_TARGET=jquery BROWSER_PROVIDER=saucelabs
- JOB=unit BROWSER_PROVIDER=browserstack
- JOB=docs-e2e BROWSER_PROVIDER=browserstack
- JOB=e2e TEST_TARGET=jqlite BROWSER_PROVIDER=browserstack
- JOB=e2e TEST_TARGET=jquery BROWSER_PROVIDER=browserstack
global:
- SAUCE_USERNAME=angular-ci
- SAUCE_ACCESS_KEY=9b988f434ff8-fbca-8aa4-4ae3-35442987
- BROWSER_STACK_USERNAME=VojtaJina
- BROWSER_STACK_ACCESS_KEY=QCQJ1ZpWXpBkSwEdD8ev
- LOGS_DIR=/tmp/angular-build/logs
- BROWSER_PROVIDER_READY_FILE=/tmp/sauce-connect-ready
- BROWSER_PROVIDER_READY_FILE=/tmp/browsersprovider-tunnel-ready
matrix:
allow_failures:
- env: "JOB=unit BROWSER_PROVIDER=browserstack"
- env: "JOB=docs-e2e BROWSER_PROVIDER=browserstack"
- env: "JOB=e2e TEST_TARGET=jqlite BROWSER_PROVIDER=browserstack"
- env: "JOB=e2e TEST_TARGET=jquery BROWSER_PROVIDER=browserstack"
install:
# Check the size of caches
- du -sh ./node_modules ./bower_components/ ./docs/bower_components/ || true
# - npm config set registry http://23.251.144.68
# Disable the spinner, it looks bad on Travis
- npm config set spin false
# Log HTTP requests
- npm config set loglevel http
- time ./scripts/travis/npm-bundle-deps.sh
- time npm install
- npm install -g npm@2.5
# Instal npm dependecies and ensure that npm cache is not stale
- scripts/npm/install-dependencies.sh
before_script:
- mkdir -p $LOGS_DIR
- ./lib/sauce/sauce_connect_setup.sh
- ./scripts/travis/start_browser_provider.sh
- npm install -g grunt-cli
- grunt package
- ./scripts/travis/wait_for_browser_provider.sh
+1702 -3
View File
File diff suppressed because it is too large Load Diff
+15 -9
View File
@@ -1,4 +1,4 @@
#Contributing to AngularJS
# Contributing to AngularJS
We'd love for you to contribute to our source code and to make AngularJS even better than it is
today! Here are the guidelines we'd like you to follow:
@@ -54,7 +54,7 @@ For large fixes, please build and test the documentation before submitting the P
accidentally introduced any layout or formatting issues. You should also make sure that your commit message
is labeled "docs:" and follows the **Git Commit Guidelines** outlined below.
If you're just making a small change, don't worry about filing an issue first. Use the friendly blue "Improve this doc" button at the top right of the doc page to fork the repository in-place and make a quick change on the fly. When naming the commit, it is advised to still label it according to the commit guidelines below, by starting the commit message with **docs** and referencing the filename. Since this is not obvious and some changes are made on the fly, this is not strictly necessary and we will understand if this isn't done the first few times.
If you're just making a small change, don't worry about filing an issue first. Use the friendly blue "Improve this doc" button at the top right of the doc page to fork the repository in-place and make a quick change on the fly. When naming the commit, it is advised to still label it according to the commit guidelines below, by starting the commit message with **docs** and referencing the filename. Since this is not obvious and some changes are made on the fly, this is not strictly necessary and we will understand if this isn't done the first few times.
## <a name="submit"></a> Submission Guidelines
@@ -87,7 +87,7 @@ Before you submit your pull request consider the following guidelines:
that relates to your submission. You don't want to duplicate effort.
* Please sign our [Contributor License Agreement (CLA)](#cla) before sending pull
requests. We cannot accept code without this.
* Make your changes in a new git branch
* Make your changes in a new git branch:
```shell
git checkout -b my-fix-branch master
@@ -107,7 +107,7 @@ Before you submit your pull request consider the following guidelines:
```
Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files.
* Build your changes locally to ensure all the tests pass
* Build your changes locally to ensure all the tests pass:
```shell
grunt test
@@ -120,14 +120,14 @@ Before you submit your pull request consider the following guidelines:
```
* In GitHub, send a pull request to `angular:master`.
* If we suggest changes then
* If we suggest changes then:
* Make the required updates.
* Re-run the Angular test suite to ensure tests are still passing.
* Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
```shell
git rebase master -i
git push -f
git push origin my-fix-branch -f
```
That's it! Thank you for your contribution!
@@ -173,7 +173,7 @@ To ensure consistency throughout the source code, keep these rules in mind as yo
* **Do not use namespaces**: Instead, wrap the entire angular code base in an anonymous closure and
export our API explicitly rather than implicitly.
* Wrap all code at **100 characters**.
* Instead of complex inheritance hierarchies, we **prefer simple objects**. We use prototypical
* Instead of complex inheritance hierarchies, we **prefer simple objects**. We use prototypal
inheritance only when absolutely necessary.
* We **love functions and closures** and, whenever possible, prefer them over objects.
* To write concise code that can be better minified, we **use aliases internally** that map to the
@@ -199,9 +199,14 @@ format that includes a **type**, a **scope** and a **subject**:
<footer>
```
The **header** is mandatory and the **scope** of the header is optional.
Any line of the commit message cannot be longer 100 characters! This allows the message to be easier
to read on github as well as in various git tools.
### Revert
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit. In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.
### Type
Must be one of the following:
@@ -227,14 +232,15 @@ The subject contains succinct description of the change:
* don't capitalize first letter
* no dot (.) at the end
###Body
### Body
Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes"
The body should include the motivation for the change and contrast this with previous behavior.
###Footer
### Footer
The footer should contain any information about **Breaking Changes** and is also the place to
reference GitHub issues that this commit **Closes**.
**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this.
A detailed explanation can be found in this [document][commit-message-format].
+39 -27
View File
@@ -4,6 +4,7 @@ var files = require('./angularFiles').files;
var util = require('./lib/grunt/utils.js');
var versionInfo = require('./lib/versions/version-info');
var path = require('path');
var e2e = require('./test/e2e/tools');
module.exports = function(grunt) {
//grunt plugins
@@ -16,10 +17,6 @@ module.exports = function(grunt) {
NG_VERSION.cdn = versionInfo.cdnVersion;
var dist = 'angular-'+ NG_VERSION.full;
//global beforeEach
util.init();
//config
grunt.initConfig({
NG_VERSION: NG_VERSION,
@@ -29,14 +26,6 @@ module.exports = function(grunt) {
benchmarksPath: 'benchmarks'
}
},
parallel: {
travis: {
tasks: [
util.parallelTask(['test:unit', 'test:promises-aplus', 'tests:docs'], {stream: true}),
util.parallelTask(['test:e2e'])
]
}
},
connect: {
devserver: {
@@ -46,12 +35,14 @@ module.exports = function(grunt) {
base: '.',
keepalive: true,
middleware: function(connect, options){
var base = Array.isArray(options.base) ? options.base[options.base.length - 1] : options.base;
return [
util.conditionalCsp(),
util.rewrite(),
e2e.middleware(),
connect.favicon('images/favicon.ico'),
connect.static(options.base),
connect.directory(options.base)
connect.static(base),
connect.directory(base)
];
}
}
@@ -64,6 +55,7 @@ module.exports = function(grunt) {
port: 8000,
hostname: '0.0.0.0',
middleware: function(connect, options){
var base = Array.isArray(options.base) ? options.base[options.base.length - 1] : options.base;
return [
function(req, resp, next) {
// cache get requests to speed up tests on travis
@@ -74,8 +66,9 @@ module.exports = function(grunt) {
next();
},
util.conditionalCsp(),
e2e.middleware(),
connect.favicon('images/favicon.ico'),
connect.static(options.base)
connect.static(base)
];
}
}
@@ -162,7 +155,7 @@ module.exports = function(grunt) {
jscs: {
src: ['src/**/*.js', 'test/**/*.js'],
options: {
config: ".jscs.json"
config: ".jscsrc"
}
},
@@ -254,8 +247,19 @@ module.exports = function(grunt) {
'test/**/*.js',
'!test/ngScenario/DescribeSpec.js',
'!src/ng/directive/attrs.js', // legitimate xit here
'!src/ngScenario/**/*.js'
]
'!src/ngScenario/**/*.js',
'!test/helpers/privateMocks*.js'
],
options: {
disallowed: [
'iit',
'xit',
'tthey',
'xthey',
'ddescribe',
'xdescribe'
]
}
},
"merge-conflict": {
@@ -287,14 +291,18 @@ module.exports = function(grunt) {
}
},
shell:{
"promises-aplus-tests":{
options:{
//stdout:true,
stderr:true,
failOnError:true
shell: {
"npm-install": {
command: path.normalize('scripts/npm/install-dependencies.sh')
},
"promises-aplus-tests": {
options: {
stdout: false,
stderr: true,
failOnError: true
},
command:path.normalize('./node_modules/.bin/promises-aplus-tests tmp/promises-aplus-adapter++.js')
command: path.normalize('./node_modules/.bin/promises-aplus-tests tmp/promises-aplus-adapter++.js')
}
},
@@ -314,14 +322,18 @@ module.exports = function(grunt) {
}
});
// global beforeEach task
if (!process.env.TRAVIS) {
grunt.task.run('shell:npm-install');
}
//alias tasks
grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', ['jshint', 'jscs', 'package','test:unit','test:promises-aplus', 'tests:docs', 'test:protractor']);
grunt.registerTask('test:jqlite', 'Run the unit tests with Karma' , ['tests:jqlite']);
grunt.registerTask('test:jquery', 'Run the jQuery unit tests with Karma', ['tests:jquery']);
grunt.registerTask('test:modules', 'Run the Karma module tests with Karma', ['tests:modules']);
grunt.registerTask('test:modules', 'Run the Karma module tests with Karma', ['build', 'tests:modules']);
grunt.registerTask('test:docs', 'Run the doc-page tests with Karma', ['package', 'tests:docs']);
grunt.registerTask('test:unit', 'Run unit, jQuery and Karma module tests with Karma', ['tests:jqlite', 'tests:jquery', 'tests:modules']);
grunt.registerTask('test:unit', 'Run unit, jQuery and Karma module tests with Karma', ['test:jqlite', 'test:jquery', 'test:modules']);
grunt.registerTask('test:protractor', 'Run the end to end tests with Protractor and keep a test server running in the background', ['webdriver', 'connect:testserver', 'protractor:normal']);
grunt.registerTask('test:travis-protractor', 'Run the end to end tests with Protractor for Travis CI builds', ['connect:testserver', 'protractor:travis']);
grunt.registerTask('test:ci-protractor', 'Run the end to end tests with Protractor for Jenkins CI builds', ['webdriver', 'connect:testserver', 'protractor:jenkins']);
+2 -2
View File
@@ -1,8 +1,8 @@
Using AngularJS with the Closure Compiler
=========================================
The Closure Compiler project contains externs definitions for AngularJS
JavaScript in its `contrib/externs` directory.
The Closure Compiler project contains definitions for the AngularJS JavaScript
in its `contrib/externs` directory.
The definitions contain externs for use with the Closure compiler (aka
JSCompiler). Passing these files to the --externs parameter of a compiler
+1 -1
View File
@@ -10,7 +10,7 @@ the browser how to do dependency injection and inversion of control.
Oh yeah and it helps with server-side communication, taming async callbacks with promises and
deferreds. It also makes client-side navigation and deeplinking with hashbang urls or HTML5 pushState a
piece of cake. The best of all: it makes development fun!
piece of cake. Best of all?? It makes development fun!
* Web site: http://angularjs.org
* Tutorial: http://docs.angularjs.org/tutorial
+5 -1
View File
@@ -55,7 +55,11 @@ This process based on the idea of minimizing user pain
* inconvenience - causes ugly/boilerplate code in apps
1. Label `component: *`
* In rare cases, it's ok to have multiple components.
1. Label `PRs plz!` - These issues are good targets for PRs from the open source community. Apply to issues where the problem and solution are well defined in the comments, and it's not too complex.
1. Label `PRs plz!` - These issues are good targets for PRs from the open source community. In addition to applying this label, you must:
* Leave a comment explaining the problem and solution so someone can easily finish it.
* Assign the issue to yourself.
* Give feedback on PRs addressing this issue.
* You are responsible for mentoring contributors helping with this issue.
1. Label `origin: google` for issues from Google
1. Assign a milestone:
* Backlog - triaged fixes and features, should be the default choice
+7 -1
View File
@@ -5,6 +5,7 @@ var angularFiles = {
'src/minErr.js',
'src/Angular.js',
'src/loader.js',
'src/stringify.js',
'src/AngularPublic.js',
'src/jqLite.js',
'src/apis.js',
@@ -52,6 +53,7 @@ var angularFiles = {
'src/ng/directive/form.js',
'src/ng/directive/input.js',
'src/ng/directive/ngBind.js',
'src/ng/directive/ngChange.js',
'src/ng/directive/ngClass.js',
'src/ng/directive/ngCloak.js',
'src/ng/directive/ngController.js',
@@ -60,6 +62,8 @@ var angularFiles = {
'src/ng/directive/ngIf.js',
'src/ng/directive/ngInclude.js',
'src/ng/directive/ngInit.js',
'src/ng/directive/ngList.js',
'src/ng/directive/ngModel.js',
'src/ng/directive/ngNonBindable.js',
'src/ng/directive/ngPluralize.js',
'src/ng/directive/ngRepeat.js',
@@ -69,10 +73,12 @@ var angularFiles = {
'src/ng/directive/ngTransclude.js',
'src/ng/directive/script.js',
'src/ng/directive/select.js',
'src/ng/directive/style.js'
'src/ng/directive/style.js',
'src/ng/directive/validators.js'
],
'angularLoader': [
'stringify.js',
'src/minErr.js',
'src/loader.js'
],
+1 -1
View File
@@ -3,4 +3,4 @@ found at: https://github.com/angular/benchpress/blob/master/README.md.
In this project, there is a configured grunt task for building the benchmarks,
`grunt bp_build`, which places the runnable benchmarks in "/build/benchmarks/".
The existing `grunt webserver` task can be used to serve the built benchmarks at `localhost:8000/build/benchmarks/&lt;benchmark-name&gt;`
The existing `grunt webserver` task can be used to serve the built benchmarks at `localhost:8000/build/benchmarks/<benchmark-name>`
+7
View File
@@ -14,6 +14,7 @@
<div>ngBind: <input type="radio" ng-model="benchmarkType" value="ngBind"></div>
<div>ngBindOnce: <input type="radio" ng-model="benchmarkType" value="ngBindOnce"></div>
<div>interpolation: <input type="radio" ng-model="benchmarkType" value="interpolation"></div>
<div>attribute interpolation: <input type="radio" ng-model="benchmarkType" value="interpolationAttr"></div>
<div>ngBind + fnInvocation: <input type="radio" ng-model="benchmarkType" value="ngBindFn"></div>
<div>interpolation + fnInvocation: <input type="radio" ng-model="benchmarkType" value="interpolationFn"></div>
<div>ngBind + filter: <input type="radio" ng-model="benchmarkType" value="ngBindFilter"></div>
@@ -46,6 +47,12 @@
<span ng-repeat="column in row">{{column.i}}:{{column.j}}|</span>
</div>
</div>
<div ng-switch-when="interpolationAttr">
<h2>attribute interpolation</h2>
<div ng-repeat="row in data">
<span ng-repeat="column in row" i="{{column.i}}" j="{{column.j}}">i,j attrs</span>
</div>
</div>
<div ng-switch-when="ngBindFn">
<h2>bindings with functions</h2>
<div ng-repeat="row in data">
+2 -1
View File
@@ -71,7 +71,8 @@ app.controller('DataController', function($scope, $rootScope) {
date2: new Date(Math.random()*Date.now()),
func: function(){ return star; },
obj: data[i-1],
keys: data[i-1] && (data[i-1].keys || Object.keys(data[i-1]))
keys: data[i-1] && (data[i-1].keys || Object.keys(data[i-1])),
constructor: data[i-1]
});
}
@@ -16,6 +16,12 @@
<label for="complexPath">Complex Paths</label>
</li>
<li>
<input type="radio" ng-model="expressionType" value="constructorPath" id="constructorPath">
<label for="constructorPath">Constructor Paths</label>
($parse special cases "constructor" for security)
</li>
<li>
<input type="radio" ng-model="expressionType" value="fieldAccess" id="fieldAccess">
<label for="fieldAccess">Field Accessors</label>
@@ -77,6 +83,17 @@
<span bm-pe-watch="row.keys"></span>
</li>
<li ng-switch-when="constructorPath" ng-repeat="(rowIdx, row) in ::data">
<span bm-pe-watch="row.index"></span>
<span bm-pe-watch="row.constructor.index"></span>
<span bm-pe-watch="row.constructor.index"></span>
<span bm-pe-watch="row.constructor.index"></span>
<span bm-pe-watch="row.constructor.constructor.index"></span>
<span bm-pe-watch="row.constructor.constructor.index"></span>
<span bm-pe-watch="row.constructor.constructor.constructor.index"></span>
<span bm-pe-watch="row.constructor.constructor.constructor.index"></span>
</li>
<li ng-switch-when="complexPath" ng-repeat="(rowIdx, row) in ::data">
<span bm-pe-watch="row.index"></span>
<span bm-pe-watch="row.num0"></span>
+1
View File
@@ -202,6 +202,7 @@ var generate = function(version, file) {
// publish for testing
exports.parseRawCommit = parseRawCommit;
exports.printSection = printSection;
// hacky start if not run by jasmine :-D
if (process.argv.join('').indexOf('jasmine-node') === -1) {
+62 -1
View File
@@ -1,4 +1,4 @@
/* global describe: false, it: false, expect: false */
/* global describe: false, beforeEach: false, afterEach: false, it: false, expect: false */
'use strict';
@@ -44,4 +44,65 @@ describe('changelog.js', function() {
expect(msg.breaking).toEqual(' first breaking change\nsomething else\nanother line with more info\n');
});
});
describe('printSection', function() {
var output;
var streamMock = {
write: function(str) {
output += str;
}
};
beforeEach(function() {
output = '';
});
it('should add a new line at the end of each breaking change list item ' +
'when there is 1 item per component', function() {
var title = 'test';
var printCommitLinks = false;
var section = {
module1: [{subject: 'breaking change 1'}],
module2: [{subject: 'breaking change 2'}]
};
var expectedOutput =
'\n' + '## test\n\n' +
'- **module1:** breaking change 1\n' +
'- **module2:** breaking change 2\n' +
'\n';
ch.printSection(streamMock, title, section, printCommitLinks);
expect(output).toBe(expectedOutput);
});
it('should add a new line at the end of each breaking change list item ' +
'when there are multiple items per component', function() {
var title = 'test';
var printCommitLinks = false;
var section = {
module1: [
{subject: 'breaking change 1.1'},
{subject: 'breaking change 1.2'}
],
module2: [
{subject: 'breaking change 2.1'},
{subject: 'breaking change 2.2'}
]
};
var expectedOutput =
'\n' + '## test\n\n' +
'- **module1:**\n' +
' - breaking change 1.1\n' +
' - breaking change 1.2\n' +
'- **module2:**\n' +
' - breaking change 2.1\n' +
' - breaking change 2.2\n' +
'\n';
ch.printSection(streamMock, title, section, printCommitLinks);
expect(output).toBe(expectedOutput);
});
});
});
+16 -5
View File
@@ -128,6 +128,10 @@ h1,h2,h3,h4,h5,h6 {
margin-bottom:5px;
}
.nav-index-group .nav-index-listing.current a {
color: #B52E31;
}
.nav-breadcrumb {
margin:4px 0;
padding:0;
@@ -542,10 +546,10 @@ h4 {
margin-left:10px;
}
.btn:hover {
color:black!important;
.btn:hover, .btn:focus {
color: black!important;
border: 1px solid #ddd!important;
background:white!important;
background: white!important;
}
.view-source, .improve-docs {
@@ -579,6 +583,12 @@ ul.events > li {
margin-bottom:40px;
}
.definition-table td {
padding: 8px;
border: 1px solid #eee;
vertical-align: top;
}
@media only screen and (min-width: 769px) and (max-width: 991px) {
.main-body-grid {
margin-top: 160px;
@@ -627,6 +637,7 @@ ul.events > li {
}
.main-body-grid .side-navigation {
display:block!important;
padding-bottom:50px;
}
.main-body-grid .side-navigation.ng-hide {
display:none!important;
@@ -652,14 +663,14 @@ ul.events > li {
}
.toc-close {
position: absolute;
bottom: -50px;
bottom: 5px;
left: 50%;
margin-left: -50%;
text-align: center;
padding: 5px;
background: #eee;
border-radius: 5px;
width: 90%;
width: 100%;
border:1px solid #ddd;
box-shadow:0 0 10px #bbb;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

+5 -5
View File
@@ -5,15 +5,15 @@ describe("doc.angularjs.org", function() {
describe("API pages", function() {
it("should display links to code on GitHub", function() {
browser.get('index-debug.html#!/api/ng/service/$http');
browser.get('build/docs/index.html#!/api/ng/service/$http');
expect(element(by.css('.improve-docs')).getAttribute('href')).toMatch(/https?:\/\/github\.com\/angular\/angular\.js\/edit\/.+\/src\/ng\/http\.js/);
browser.get('index-debug.html#!/api/ng/service/$http');
browser.get('build/docs/index.html#!/api/ng/service/$http');
expect(element(by.css('.view-source')).getAttribute('href')).toMatch(/https?:\/\/github\.com\/angular\/angular\.js\/tree\/.+\/src\/ng\/http\.js#L\d+/);
});
it('should change the page content when clicking a link to a service', function () {
browser.get('');
browser.get('build/docs/index.html');
var ngBindLink = element(by.css('.definition-table td a[href="api/ng/directive/ngClick"]'));
ngBindLink.click();
@@ -24,7 +24,7 @@ describe("doc.angularjs.org", function() {
it('should show the functioning input directive example', function () {
browser.get('index-debug.html#!/api/ng/directive/input');
browser.get('build/docs/index.html#!/api/ng/directive/input');
// Ensure that the page is loaded before trying to switch frames.
browser.waitForAngular();
@@ -39,7 +39,7 @@ describe("doc.angularjs.org", function() {
});
it("should trim indentation from code blocks", function() {
browser.get('index-debug.html#!/api/ng/type/$rootScope.Scope');
browser.get('build/docs/index.html#!/api/ng/type/$rootScope.Scope');
var codeBlocks = element.all(by.css('pre > code.lang-js'));
codeBlocks.each(function(codeBlock) {
@@ -3,7 +3,7 @@
describe("provider pages", function() {
it("should show the related service", function() {
browser.get('index-debug.html#!/api/ng/provider/$compileProvider');
browser.get('build/docs/index.html#!/api/ng/provider/$compileProvider');
var serviceLink = element.all(by.css('ol.api-profile-header-structure li a')).first();
expect(serviceLink.getText()).toEqual('- $compile');
expect(serviceLink.getAttribute('href')).toMatch(/api\/ng\/service\/\$compile/);
@@ -3,19 +3,19 @@
describe("service pages", function() {
it("should show the related provider if there is one", function() {
browser.get('index-debug.html#!/api/ng/service/$compile');
browser.get('build/docs/index.html#!/api/ng/service/$compile');
var providerLink = element.all(by.css('ol.api-profile-header-structure li a')).first();
expect(providerLink.getText()).toEqual('- $compileProvider');
expect(providerLink.getAttribute('href')).toMatch(/api\/ng\/provider\/\$compileProvider/);
browser.get('index-debug.html#!/api/ng/service/$q');
browser.get('build/docs/index.html#!/api/ng/service/$q');
providerLink = element.all(by.css('ol.api-profile-header-structure li a')).first();
expect(providerLink.getText()).not.toEqual('- $qProvider');
expect(providerLink.getAttribute('href')).not.toMatch(/api\/ng\/provider\/\$compileProvider/);
});
it("should show parameter defaults", function() {
browser.get('index-debug.html#!/api/ng/service/$timeout');
browser.get('build/docs/index.html#!/api/ng/service/$timeout');
expect(element.all(by.css('.input-arguments p em')).first().getText()).toContain('(default: 0)');
});
+6 -6
View File
@@ -39,7 +39,7 @@ describe('docs.angularjs.org', function () {
it('should change the page content when clicking a link to a service', function () {
browser.get('');
browser.get('build/docs/index.html');
var ngBindLink = element(by.css('.definition-table td a[href="api/ng/directive/ngClick"]'));
ngBindLink.click();
@@ -51,33 +51,33 @@ describe('docs.angularjs.org', function () {
it('should be resilient to trailing slashes', function() {
browser.get('index-debug.html#!/api/ng/function/angular.noop/');
browser.get('build/docs/index.html#!/api/ng/function/angular.noop/');
var pageBody = element(by.css('h1'));
expect(pageBody.getText()).toEqual('angular.noop');
});
it('should be resilient to trailing "index"', function() {
browser.get('index-debug.html#!/api/ng/function/angular.noop/index');
browser.get('build/docs/index.html#!/api/ng/function/angular.noop/index');
var pageBody = element(by.css('h1'));
expect(pageBody.getText()).toEqual('angular.noop');
});
it('should be resilient to trailing "index/"', function() {
browser.get('index-debug.html#!/api/ng/function/angular.noop/index/');
browser.get('build/docs/index.html#!/api/ng/function/angular.noop/index/');
var pageBody = element(by.css('h1'));
expect(pageBody.getText()).toEqual('angular.noop');
});
it('should display formatted error messages on error doc pages', function() {
browser.get('index-debug.html#!error/ng/areq?p0=Missing&p1=not%20a%20function,%20got%20undefined');
browser.get('build/docs/index.html#!error/ng/areq?p0=Missing&p1=not%20a%20function,%20got%20undefined');
expect(element(by.css('.minerr-errmsg')).getText()).toEqual("Argument 'Missing' is not a function, got undefined");
});
it("should display an error if the page does not exist", function() {
browser.get('index-debug.html#!/api/does/not/exist');
browser.get('build/docs/index.html#!/api/does/not/exist');
expect(element(by.css('h1')).getText()).toBe('Oops!');
});
+1
View File
@@ -13,6 +13,7 @@ angular.module('DocsController', [])
$scope.navClass = function(navItem) {
return {
active: navItem.href && this.currentPage && this.currentPage.path,
current: this.currentPage && this.currentPage.path === navItem.href,
'nav-index-section': navItem.type === 'section'
};
};
+11 -7
View File
@@ -1,13 +1,16 @@
angular.module('examples', [])
.factory('formPostData', ['$document', function($document) {
return function(url, fields) {
return function(url, newWindow, fields) {
/**
* Form previously posted to target="_blank", but pop-up blockers were causing this to not work.
* If a user chose to bypass pop-up blocker one time and click the link, they would arrive at
* a new default plnkr, not a plnkr with the desired template.
* If the form posts to target="_blank", pop-up blockers can cause it not to work.
* If a user choses to bypass pop-up blocker one time and click the link, they will arrive at
* a new default plnkr, not a plnkr with the desired template. Given this undesired behavior,
* some may still want to open the plnk in a new window by opting-in via ctrl+click. The
* newWindow param allows for this possibility.
*/
var form = angular.element('<form style="display: none;" method="post" action="' + url + '"></form>');
var target = newWindow ? '_blank' : '_self';
var form = angular.element('<form style="display: none;" method="post" action="' + url + '" target="' + target + '"></form>');
angular.forEach(fields, function(value, name) {
var input = angular.element('<input type="hidden" name="' + name + '">');
input.attr('value', value);
@@ -21,9 +24,10 @@ angular.module('examples', [])
.factory('openPlunkr', ['formPostData', '$http', '$q', function(formPostData, $http, $q) {
return function(exampleFolder) {
return function(exampleFolder, clickEvent) {
var exampleName = 'AngularJS Example';
var newWindow = clickEvent.ctrlKey || clickEvent.metaKey;
// Load the manifest for the example
$http.get(exampleFolder + '/manifest.json')
@@ -71,7 +75,7 @@ angular.module('examples', [])
postData.private = true;
postData.description = exampleName;
formPostData('http://plnkr.co/edit/?p=preview', postData);
formPostData('http://plnkr.co/edit/?p=preview', newWindow, postData);
});
};
}]);
+8 -4
View File
@@ -41,10 +41,14 @@ angular.module('search', [])
$scope.submit = function() {
var result;
for(var i in $scope.results) {
result = $scope.results[i][0];
if(result) {
break;
if ($scope.results.api) {
result = $scope.results.api[0];
} else {
for(var i in $scope.results) {
result = $scope.results[i][0];
if(result) {
break;
}
}
}
if(result) {
+4 -2
View File
@@ -1,7 +1,10 @@
"use strict";
angular.module('versions', [])
.controller('DocsVersionsCtrl', ['$scope', '$location', '$window', 'NG_VERSIONS', function($scope, $location, $window, NG_VERSIONS) {
$scope.docs_version = NG_VERSIONS[0];
$scope.docs_versions = NG_VERSIONS;
for(var i=0, minor = NaN; i < NG_VERSIONS.length; i++) {
var version = NG_VERSIONS[i];
@@ -13,9 +16,8 @@ angular.module('versions', [])
minor = version.minor;
}
$scope.docs_versions = NG_VERSIONS;
$scope.getGroupName = function(v) {
return v.isLatest ? 'Latest' : (v.isStable ? 'Stable' : 'Unstable');
return v.isLatest ? 'Latest' : ('v' + v.major + '.' + v.minor + '.x');
};
$scope.jumpToDocsVersion = function(version) {
+14 -7
View File
@@ -5,19 +5,19 @@ var packagePath = __dirname;
var Package = require('dgeni').Package;
// Create and export a new Dgeni package called dgeni-example. This package depends upon
// the jsdoc and nunjucks packages defined in the dgeni-packages npm module.
// Create and export a new Dgeni package called angularjs. This package depends upon
// the ngdoc, nunjucks, and examples packages defined in the dgeni-packages npm module.
module.exports = new Package('angularjs', [
require('dgeni-packages/ngdoc'),
require('dgeni-packages/nunjucks'),
require('dgeni-packages/examples')
require('dgeni-packages/examples'),
require('dgeni-packages/git')
])
.factory(require('./services/errorNamespaceMap'))
.factory(require('./services/getMinerrInfo'))
.factory(require('./services/getVersion'))
.factory(require('./services/gitData'))
.factory(require('./services/deployments/debug'))
.factory(require('./services/deployments/default'))
@@ -26,7 +26,6 @@ module.exports = new Package('angularjs', [
.factory(require('./inline-tag-defs/type'))
.processor(require('./processors/error-docs'))
.processor(require('./processors/index-page'))
.processor(require('./processors/keywords'))
@@ -125,10 +124,16 @@ module.exports = new Package('angularjs', [
});
computeIdsProcessor.idTemplates.push({
docTypes: ['error', 'errorNamespace'],
docTypes: ['error'],
getId: function(doc) { return 'error:' + doc.namespace + ':' + doc.name; },
getAliases: function(doc) { return [doc.name, doc.namespace + ':' + doc.name, doc.id]; }
},
{
docTypes: ['errorNamespace'],
getId: function(doc) { return 'error:' + doc.name; },
getAliases: function(doc) { return [doc.id]; }
});
}
);
})
.config(function(checkAnchorLinksProcessor) {
@@ -157,6 +162,8 @@ module.exports = new Package('angularjs', [
jqueryDeployment
];
generateProtractorTestsProcessor.basePath = 'build/docs/';
generateExamplesProcessor.deployments = [
debugDeployment,
defaultDeployment,
-16
View File
@@ -1,16 +0,0 @@
"use strict";
var versionInfo = require('../../../lib/versions/version-info');
/**
* @dgService gitData
* @description
* Information from the local git repository
*/
module.exports = function gitData() {
return {
version: versionInfo.currentVersion,
versions: versionInfo.previousVersions,
info: versionInfo.gitRepoInfo
};
};
+1 -1
View File
@@ -1,7 +1,7 @@
{% extends "base.template.html" %}
{% block content %}
<h1>Error: {$ doc.id $}
<h1>Error: {$ doc.namespace $}:{$ doc.name $}
<div><span class='hint'>{$ doc.fullName $}</span></div>
</h1>
@@ -2,7 +2,7 @@
is HTML and wrap each line in a <p> - thus breaking the HTML #}
<div>
<a ng-click="openPlunkr('{$ doc.path $}')" class="btn pull-right">
<a ng-click="openPlunkr('{$ doc.path $}', $event)" class="btn pull-right">
<i class="glyphicon glyphicon-edit">&nbsp;</i>
Edit in Plunker</a>
+25 -4
View File
@@ -128,7 +128,7 @@ Use ngRoute to enable URL routing to your application. The ngRoute module suppor
## {@link ngAnimate ngAnimate}
Use ngAnimate to enable animation features into your application. Various core ng directives will provide
Use ngAnimate to enable animation features within your application. Various core ng directives will provide
animation hooks into your application when ngAnimate is included. Animations are defined by using CSS transitions/animations
or JavaScript callbacks.
@@ -148,7 +148,7 @@ or JavaScript callbacks.
{@link ngAnimate CSS-based animations}
</td>
<td>
Follow ngAnimates CSS naming structure to reference CSS transitions / keyframe animations in AngularJS. Once defined the animation can be triggered by referencing the CSS class within the HTML template code.
Follow ngAnimates CSS naming structure to reference CSS transitions / keyframe animations in AngularJS. Once defined, the animation can be triggered by referencing the CSS class within the HTML template code.
</td>
</tr>
<tr>
@@ -156,11 +156,32 @@ or JavaScript callbacks.
{@link ngAnimate JS-based animations}
</td>
<td>
Use {@link angular.Module#animation module.animation()} to register a JavaScript animation. Once registered the animation can be triggered by referencing the CSS class within the HTML template code.
Use {@link angular.Module#animation module.animation()} to register a JavaScript animation. Once registered, the animation can be triggered by referencing the CSS class within the HTML template code.
</td>
</tr>
</table>
## {@link ngAria ngAria}
Use ngAria to inject common accessibility attributes into directives and improve the experience for users with disabilities.
<div class="alert alert-info">Include the **angular-aria.js** file and set ngAria as a dependency for this to work in your application.</div>
<table class="definition-table spaced">
<tr>
<td>
{@link ngAria#service Services}
</td>
<td>
<p>
The {@link ngAria.$aria $aria} service contains helper methods for applying ARIA attributes to HTML.
<p>
<p>
{@link ngAria.$ariaProvider $ariaProvider} is used for configuring ARIA attributes.
</p>
</td>
</tr>
</table>
## {@link ngResource ngResource}
@@ -252,7 +273,7 @@ Use ngSanitize to securely parse and manipulate HTML data in your application.
## {@link ngMock ngMock}
Use ngMock to inject and mock modules, factories, services and providers within your unit tests
Use ngMock to inject and mock modules, factories, services and providers within your unit tests.
<div class="alert alert-info">Include the **angular-mocks.js** file into your test runner for this to work.</div>
+12
View File
@@ -0,0 +1,12 @@
@ngdoc error
@name $animate:nocb
@fullName Do not pass a callback to animate methods
@description
Since Angular 1.3, the methods of {@link ng.$animate} do not accept a callback as the last parameter.
Instead, they return a promise to which you can attach `then` handlers to be run when the animation completes.
If you are getting this error then you need to update your code to use the promise-based API.
See https://github.com/angular/angular.js/commit/bf0f5502b1bbfddc5cdd2f138efd9188b8c652a9 for information about
the change to the animation API and the changes you need to make.
+8
View File
@@ -0,0 +1,8 @@
@ngdoc error
@name $compile:baddir
@fullName Invalid Directive Name
@description
This error occurs when the name of a directive is not valid.
Directives must start with a lowercase character.
@@ -0,0 +1,46 @@
@ngdoc error
@name $controller:ctrlfmt
@fullName Badly formed controller string
@description
This error occurs when {@link ng.$controller $controller} service is called
with a string that does not match the supported controller string formats.
Supported formats:
1. `__name__`
2. `__name__ as __identifier__`
Neither `__name__` or `__identifier__` may contain spaces.
Example of incorrect usage that leads to this error:
```html
<!-- unclosed ng-controller attribute messes up the format -->
<div ng-controller="myController>
```
or
```js
// does not match `__name__` or `__name__ as __identifier__`
var myCtrl = $controller("mY contRoller", { $scope: newScope });
```
or
```js
directive("myDirective", function() {
return {
// does not match `__name__` or `__name__ as __identifier__`
controller: "mY contRoller",
link: function() {}
};
});
```
To fix the examples above, ensure that the controller string matches the supported
formats, and that any html attributes which are used as controller expressions are
closed.
Please consult the {@link ng.$controller $controller} service api docs to learn more.
+10
View File
@@ -0,0 +1,10 @@
@ngdoc error
@name $http:badreq
@fullName Bad Request Configuration
@description
This error occurs when the request configuration parameter passed to the {@link ng.$http `$http`} service is not an object.  `$http` expects a single parameter, the request configuration object, but received a parameter that was not an object.  The error message should provide additional context such as the actual value of the parameter that was received.  If you passed a string parameter, perhaps you meant to call one of the shorthand methods on `$http` such as `$http.get(…)`, etc.
To resolve this error, make sure you pass a valid request configuration object to `$http`.
For more information, see the {@link ng.$http `$http`} service API documentation.
@@ -6,6 +6,22 @@
This error occurs when a module fails to load due to some exception. The error
message above should provide additional context.
### Using `ngRoute`
In AngularJS `1.2.0` and later, `ngRoute` has been moved to its own module.
If you are getting this error after upgrading to `1.2.x` or later, be sure that you've
installed {@link ngRoute `ngRoute`}.
### Monkey-patching Angular's `ng` module
This error can also occur if you have tried to add your own components to the `ng` module.
This has never been supported and from `1.3.0` it will actually trigger this error.
For instance the following code could trigger this error.
```js
angular.module('ng').filter('tel', function (){});
```
Instead create your own module and add it as a dependency to your application's top-level module.
See [#9692](https://github.com/angular/angular.js/issues/9692) and
[#7709](https://github.com/angular/angular.js/issues/7709) for more information
+1 -1
View File
@@ -61,7 +61,7 @@ Attempting to inject one controller into another will also throw an `Unknown pro
```
angular.module('myModule', [])
.controller('MyFirstController', function() { /* ... */ });
.controller('MyFirstController', function() { /* ... */ })
.controller('MySecondController', ['MyFirstController', function(MyFirstController) {
// This controller throws an unknown provider error because
// MyFirstController cannot be injected.
@@ -1,17 +0,0 @@
@ngdoc error
@name $location:ihshprfx
@fullName Missing Hash Prefix
@description
This error occurs when {@link ng.$location $location} service is configured to use a hash prefix but this prefix was not present in a url that the `$location` service was asked to parse.
For example if you configure `$location` service with prefix `'!'`:
```
myApp.config(function($locationProvider) {
$locationProvider.prefix('!');
});
```
If you enter the app at url `http:/myapp.com/#/myView` this error will be throw.
The correct url for this configuration is `http:/myapp.com/#!/myView` (note the `'!'` after `'#'` symbol).
+1 -1
View File
@@ -3,7 +3,7 @@
@fullName Response does not match configured parameter
@description
This error occurs when the {@link ngResource.$resource `$resource`} service expects a response that can be deserialized as an array, receives an object, or vice versa.
This error occurs when the {@link ngResource.$resource `$resource`} service expects a response that can be deserialized as an array but receives an object, or vice versa.
By default, all resource actions expect objects, except `query` which expects arrays.
To resolve this error, make sure your `$resource` configuration matches the actual format of the data returned from the server.
+1 -1
View File
@@ -35,7 +35,7 @@ var users = [ { name: 'Hank' }, { name: 'Francisco' } ];
$scope.getUsers = function() {
return users;
});
};
```
The maximum number of allowed iterations of the `$digest` cycle is controlled via TTL setting which can be configured via {@link ng.$rootScopeProvider $rootScopeProvider}.
+1 -1
View File
@@ -3,6 +3,6 @@
@fullName Bad `hasOwnProperty` Name
@description
Occurs when you try to use the name `hasOwnProperty` in a context where it is not allow.
Occurs when you try to use the name `hasOwnProperty` in a context where it is not allowed.
Generally, a name cannot be `hasOwnProperty` because it is used, internally, on a object
and allowing such a name would break lookups on this object.
+9
View File
@@ -0,0 +1,9 @@
@ngdoc error
@name ng:test
@fullName Testability Not Found
@description
Angular's testability helper, getTestability, requires a root element to be
passed in. This helps differentiate between different Angular apps on the same
page. This error is thrown when no injector is found for root element. It is
often because the root element is outside of the ng-app.
+56
View File
@@ -0,0 +1,56 @@
@ngdoc error
@name ngModel:numfmt
@fullName Model is not of type `number`
@description
The number input directive `<input type="number">` requires the model to be a `number`.
If the model is something else, this error will be thrown.
Angular does not set validation errors on the `<input>` in this case
as this error is caused by incorrect application logic and not by bad input from the user.
If your model does not contain actual numbers then it is up to the application developer
to use a directive that will do the conversion in the `ngModel` `$formatters` and `$parsers`
pipeline.
## Example
In this example, our model stores the number as a string, so we provide the `stringToNumber`
directive to convert it into the format the `input[number]` directive expects.
<example module="numfmt-error-module">
<file name="index.html">
<table>
<tr ng-repeat="x in ['0', '1']">
<td>
<input type="number" string-to-number ng-model="x" /> {{ x }} : {{ typeOf(x) }}
</td>
</tr>
</table>
</file>
<file name="app.js">
angular.module('numfmt-error-module', [])
.run(function($rootScope) {
$rootScope.typeOf = function(value) {
return typeof value;
};
})
.directive('stringToNumber', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, ngModel) {
ngModel.$parsers.push(function(value) {
return '' + value;
});
ngModel.$formatters.push(function(value) {
return parseFloat(value, 10);
});
}
};
});
</file>
</example>
@@ -1,33 +0,0 @@
@ngdoc error
@name ngOptions:trkslct
@fullName Comprehension expression cannot contain both `select as` and `track by` expressions.
@description
NOTE: This error was introduced in 1.3.0-rc.5, and was removed for 1.3.0-rc.6 in order to
not break existing apps.
This error occurs when 'ngOptions' is passed a comprehension expression that contains both a
`select as` expression and a `track by` expression. These two expressions are fundamentally
incompatible.
* Example of bad expression: `<select ng-options="item.subItem as item.label for item in values track by item.id" ng-model="selected">`
`values: [{id: 1, label: 'aLabel', subItem: {name: 'aSubItem'}}, {id: 2, label: 'bLabel', subItem: {name: 'bSubItem'}}]`,
`$scope.selected = {name: 'aSubItem'};`
* track by is always applied to `value`, with purpose to preserve the selection,
(to `item` in this case)
* To calculate whether an item is selected, `ngOptions` does the following:
1. apply `track by` to the values in the array:
In the example: [1,2]
2. apply `track by` to the already selected value in `ngModel`:
In the example: this is not possible, as `track by` refers to `item.id`, but the selected
value from `ngModel` is `{name: aSubItem}`.
Here's an example of how to make this example work by using `track by` without `select as`:
```
<select ng-model="selected" ng-options="item.label for item in values track by item.id">
```
Note: This would store the whole `item` as the model to `scope.selected` instead of `item.subItem`.
For more information on valid expression syntax, see 'ngOptions' in {@link ng.directive:select select} directive docs.
@@ -16,6 +16,8 @@ Reserved names include:
- `this`
- `undefined`
- `$parent`
- `$id`
- `$root`
- `$even`
- `$odd`
- `$first`
+1 -1
View File
@@ -15,7 +15,7 @@ For example the issue can be triggered by this *invalid* code:
To resolve this error either ensure that the items in the collection have unique identity or use the `track by` syntax to specify how to track the association between models and DOM.
To resolve the example above can be resolved by using `track by $index`, which will cause the items to be keyed by their position in the array instead of their value:
The example above can be resolved by using `track by $index`, which will cause the items to be keyed by their position in the array instead of their value:
```
<div ng-repeat="value in [4, 4] track by $index"></div>
+10 -10
View File
@@ -5,9 +5,9 @@
# What does it do?
The `$location` service parses the URL in the browser address bar (based on the [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL available to
your application. Changes to the URL in the address bar are reflected into $location service and
changes to $location are reflected into the browser address bar.
The `$location` service parses the URL in the browser address bar (based on [`window.location`](https://developer.mozilla.org/en/window.location)) and makes the URL available to
your application. Changes to the URL in the address bar are reflected into the `$location` service and
changes to `$location` are reflected into the browser address bar.
**The $location service:**
@@ -21,7 +21,7 @@ changes to $location are reflected into the browser address bar.
- Represents the URL object as a set of methods (protocol, host, port, path, search, hash).
## Comparing $location to window.location
## Comparing `$location` to `window.location`
<table class="table">
<thead>
@@ -68,7 +68,7 @@ changes to $location are reflected into the browser address bar.
</tbody>
</table>
## When should I use $location?
## When should I use `$location`?
Any time your application needs to react to a change in the current URL or if you want to change
the current URL in the browser.
@@ -85,7 +85,7 @@ others customizing the configuration can enable new features.
Once the `$location` service is instantiated, you can interact with it via jQuery-style getter and
setter methods that allow you to get or change the current URL in the browser.
## $location service configuration
## `$location` service configuration
To configure the `$location` service, retrieve the
{@link ng.$locationProvider $locationProvider} and set the parameters as follows:
@@ -332,7 +332,7 @@ reload to the original link.
Be sure to check all relative links, images, scripts etc. Angular requires you to specify the url
base in the head of your main html file (`<base href="/my-base">`) unless `html5Mode.requireBase` is
set to `false` in the html5Mode definition object passed to `$locationProvider.html5Mode()`. With
that, relative urls will always be resolved to this base url, event if the initial url of the
that, relative urls will always be resolved to this base url, even if the initial url of the
document was different.
There is one exception: Links that only contain a hash fragment (e.g. `<a href="#target">`)
@@ -344,7 +344,7 @@ to anchors on the same page without needing to know on which page the user curre
Using this mode requires URL rewriting on server side, basically you have to rewrite all your links
to entry point of your application (e.g. index.html). Requiring a `<base>` tag is also important for
this case, as it allows Angular to differentiate between the part of the url that is the application
base and the path that should be handeled by the application.
base and the path that should be handled by the application.
### Sending links among different browsers
@@ -358,7 +358,7 @@ legacy browsers and hashbang links in modern browser:
Here you can see two `$location` instances, both in **Html5 mode**, but on different browsers, so
that you can see the differences. These `$location` services are connected to a fake browsers. Each
input represents address bar of the browser.
input represents the address bar of the browser.
Note that when you type hashbang url into first browser (or vice versa) it doesn't rewrite /
redirect to regular / hashbang url, as this conversion happens only during parsing the initial URL
@@ -835,7 +835,7 @@ angular.module('locationExample', [])
# Related API
* {@link ng.$location $location API}
* {@link ng.$location `$location` API}
+341 -31
View File
@@ -6,56 +6,366 @@
# Accessibility with ngAria
You can use the `ngAria` module to have common ARIA attributes automatically applied when you
use certain directives. To enable `ngAria`, just require the module into your application and
the code will hook into your ng-show/ng-hide, input, textarea, button, select and
ng-required directives and add the appropriate ARIA states and properties.
The goal of ngAria is to improve Angular's default accessibility by enabling common
[ARIA](http://www.w3.org/TR/wai-aria/) attributes that convey state or semantic information for
assistive technologies used by persons with disabilities.
Currently, the following attributes are implemented:
* aria-hidden
* aria-checked
* aria-disabled
* aria-required
* aria-invalid
* aria-multiline
* aria-valuenow
* aria-valuemin
* aria-valuemax
* tabindex
##Including ngAria
You can disable individual attributes by using the `{@link ngAria.$ariaProvider#config config}` method.
###Example
Using {@link ngAria ngAria} is as simple as requiring the ngAria module in your application. ngAria hooks into
standard AngularJS directives and quietly injects accessibility support into your application
at runtime.
```js
angular.module('myApp', ['ngAria'])...
```
Elements using `ng-model` with `required` or `ngRequired` directives will automatically have
`aria-required` attributes with the proper corresponding values.
###Using ngAria
Most of what ngAria does is only visible "under the hood". To see the module in action, once you've
added it as a dependency, you can test a few things:
* Using your favorite element inspector, look for ngAria attributes in your own code.
* Test using your keyboard to ensure `tabindex` is used correctly.
* Fire up a screen reader such as VoiceOver to listen for ARIA support.
[Helpful screen reader tips.](http://webaim.org/articles/screenreader_testing/)
##Supported directives
Currently, ngAria interfaces with the following directives:
* {@link guide/accessibility#ngmodel ngModel}
* {@link guide/accessibility#ngdisabled ngDisabled}
* {@link guide/accessibility#ngshow ngShow}
* {@link guide/accessibility#nghide ngHide}
* {@link guide/accessibility#ngclick ngClick}
* {@link guide/accessibility#ngdblclick ngDblClick}
* {@link guide/accessibility#ngmessages ngMessages}
<h2 id="ngmodel">ngModel</h2>
Most of ngAria's heavy lifting happens in the {@link ngModel ngModel}
directive. For elements using ngModel, special attention is paid by ngAria if that element also
has a a role or type of `checkbox`, `radio`, `range` or `textbox`.
For those elements using ngModel, ngAria will dynamically bind and update the following ARIA
attributes (if they have not been explicitly specified by the developer):
* aria-checked
* aria-valuemin
* aria-valuemax
* aria-valuenow
* aria-invalid
* aria-required
###Example
<example module="ngAria_ngModelExample" deps="angular-aria.js">
<file name="index.html">
<style>
[role=checkbox] {
cursor: pointer;
display: inline-block;
}
[role=checkbox] .icon:before {
content: '\2610';
display: inline-block;
font-size: 2em;
line-height: 1;
vertical-align: middle;
speak: none;
}
[role=checkbox].active .icon:before {
content: '\2611';
}
pre {
white-space: pre-wrap;
}
</style>
<div>
<form ng-controller="formsController">
<some-checkbox role="checkbox" ng-model="checked" ng-class="{active: checked}"
ng-disabled="isDisabled" ng-click="toggleCheckbox()"
aria-label="Custom Checkbox" show-attrs>
<span class="icon" aria-hidden="true"></span>
Custom Checkbox
</some-checkbox>
</form>
</div>
<script>
var app = angular.module('ngAria_ngModelExample', ['ngAria'])
.controller('formsController', function($scope){
$scope.checked = false;
$scope.toggleCheckbox = function(){
$scope.checked = !$scope.checked;
}
})
.directive('someCheckbox', function(){
return {
restrict: 'E',
link: function($scope, $el, $attrs) {
$el.on('keypress', function(event){
event.preventDefault();
if(event.keyCode === 32 || event.keyCode === 13){
$scope.toggleCheckbox();
$scope.$apply();
}
});
}
}
})
.directive('showAttrs', function() {
return function($scope, $el, $attrs) {
var pre = document.createElement('pre');
$el.after(pre);
$scope.$watch(function() {
var $attrs = {};
Array.prototype.slice.call($el[0].attributes, 0).forEach(function(item) {
if (item.name !== 'show-$attrs') {
$attrs[item.name] = item.value;
}
});
return $attrs;
}, function(newAttrs, oldAttrs) {
pre.textContent = JSON.stringify(newAttrs, null, 2);
}, true);
}
});
</script>
</file>
</example>
ngAria will also add `tabIndex`, ensuring custom elements with these roles will be reachable from
the keyboard. It is still up to **you** as a developer to **ensure custom controls will be
operable** from the keybard. Think of `ng-click` on a `<div>` or `<md-checkbox>`: you still need
to bind `ng-keypress` to make it fully operable from the keyboard. As a rule, any time you create
a widget involving user interaction, be sure to test it with your keyboard and at least one mobile
and desktop screen reader (preferably more).
<h2 id="ngdisabled">ngDisabled</h2>
The `disabled` attribute is only valid for certain elements such as `button`, `input` and
`textarea`. To properly disable custom element directives such as `<md-checkbox>` or `<taco-tab>`,
using ngAria with [ngDisabled](https://docs.angularjs.org/api/ng/directive/ngDisabled) will also
add `aria-disabled`. This tells assistive technologies when a non-native input is disabled, helping
custom controls to be more accessible.
###Example
```html
<material-input ng-model="val" required>
<md-checkbox ng-disabled="disabled">
```
Becomes:
```html
<material-input ng-model="val" required aria-required="true">
<md-checkbox disabled aria-disabled="true">
```
ngAria is just a starting point. You'll have to manually choose how to implement some
accessibility features.
>You can check whether a control is legitimately disabled for a screen reader by visiting
[chrome://accessibility](chrome://accessibility).
For instance, you may want to add `ng-keypress` bindings alongside `ng-click` to make keyboard
navigation easier.
<h2 id="ngshow">ngShow</h2>
>The [ngShow](https://docs.angularjs.org/api/ng/directive/ngShow) directive shows or hides the
given HTML element based on the expression provided to the `ngShow` attribute. The element is
shown or hidden by removing or adding the `.ng-hide` CSS class onto the element.
## Additional Resources
In its default setup, ngAria for `ngShow` is actually redundant. It toggles `aria-hidden` on the
directive when it is hidden or shown. However, the default CSS of `display: none !important`,
already hides child elements from a screen reader. It becomes more useful when the default
CSS is overridden with properties that dont affect assistive technologies, such as `opacity`
or `transform`. By toggling `aria-hidden` dynamically with ngAria, we can ensure content visually
hidden with this technique will not be read aloud in a screen reader.
One caveat with this combination of CSS and `aria-hidden`: you must also remove links and other
interactive child elements from the tab order using `tabIndex=“-1”` on each control. This ensures
screen reader users won't accidentally focus on "mystery elements". Managing tab index on every
child control can be complex and affect performance, so its best to just stick with the default
`display: none` CSS. See the [fourth rule of ARIA use](http://www.w3.org/TR/aria-in-html/#fourth-rule-of-aria-use).
###Example
```css
.ng-hide {
display: block;
opacity: 0;
}
```
```html
<div ng-show="false" class="ng-hide" aria-hidden="true"></div>
```
Becomes:
```html
<div ng-show="true" aria-hidden="false"></div>
```
*Note: Child links, buttons or other interactive controls must also be removed from the tab order.*
<h2 id="nghide">ngHide</h2>
>The [ngHide](https://docs.angularjs.org/api/ng/directive/ngHide) directive shows or hides the
given HTML element based on the expression provided to the `ngHide` attribute. The element is
shown or hidden by removing or adding the `.ng-hide` CSS class onto the element.
The default CSS for `ngHide`, the inverse method to `ngShow`, makes ngAria redundant. It toggles
`aria-hidden` on the directive when it is hidden or shown, but the content is already hidden with
`display: none`. See explanation for {@link guide/accessibility#ngshow ngShow} when overriding the default CSS.
<h2><span id="ngclick">ngClick</span> and <span id="ngdblclick">ngDblclick</span></h2>
If `ng-click` or `ng-dblclick` is encountered, ngAria will add `tabindex="0"` if it isn't there
already.
To fix widespread accessibility problems with `ng-click` on div elements, ngAria will dynamically
bind keypress by default as long as the element isn't an anchor, button, input or textarea.
You can turn this functionality on or off with the `bindKeypress` configuration option. ngAria
will also add the `button` role to communicate to users of assistive technologies.
For `ng-dblclick`, you must still manually add `ng-keypress` and role to non-interactive elements such
as `div` or `taco-button` to enable keyboard access.
<h3>Example</h3>
```html
<div ng-click="toggleMenu()"></div>
```
Becomes:
```html
<div ng-click="toggleMenu()" tabindex="0"></div>
```
<h2 id="ngmessages">ngMessages</h2>
The new ngMessages module makes it easy to display form validation or other messages with priority
sequencing and animation. To expose these visual messages to screen readers,
ngAria injects `aria-live="assertive"`, causing them to be read aloud any time a message is shown,
regardless of the user's focus location.
###Example
```html
<div ng-messages="myForm.myName.$error">
<div ng-message="required">You did not enter a field</div>
<div ng-message="maxlength">Your field is too long</div>
</div>
```
Becomes:
```html
<div ng-messages="myForm.myName.$error" aria-live="assertive">
<div ng-message="required">You did not enter a field</div>
<div ng-message="maxlength">Your field is too long</div>
</div>
```
##Disabling attributes
The attribute magic of ngAria may not work for every scenario. To disable individual attributes,
you can use the {@link ngAria.$ariaProvider#config config} method. Just keep in mind this will
tell ngAria to ignore the attribute globally.
<example module="ngAria_ngDisabledExample" deps="angular-aria.js">
<file name="index.html">
<style>
[role=checkbox] {
cursor: pointer;
display: inline-block;
}
[role=checkbox] .icon:before {
content: '\2610';
display: inline-block;
font-size: 2em;
line-height: 1;
vertical-align: middle;
speak: none;
}
[role=checkbox].active .icon:before {
content: '\2611';
}
</style>
<form ng-controller="formsController">
<div ng-model="someModel" show-attrs>
Div with ngModel and aria-invalid disabled
</div>
<div role="checkbox" ng-model="checked" ng-class="{active: checked}"
aria-label="Custom Checkbox" ng-click="toggleCheckbox()" some-checkbox show-attrs>
<span class="icon" aria-hidden="true"></span>
Custom Checkbox for comparison
</div>
</form>
<script>
angular.module('ngAria_ngDisabledExample', ['ngAria'], function config($ariaProvider) {
$ariaProvider.config({
ariaInvalid: false,
tabindex: true
});
})
.controller('formsController', function($scope){
$scope.checked = false;
$scope.toggleCheckbox = function(){
$scope.checked = !$scope.checked;
}
})
.directive('someCheckbox', function(){
return {
restrict: 'A',
link: function($scope, $el, $attrs) {
$el.on('keypress', function(event){
event.preventDefault();
if(event.keyCode === 32 || event.keyCode === 13){
$scope.toggleCheckbox();
$scope.$apply();
}
});
}
}
})
.directive('showAttrs', function() {
return function(scope, el, attrs) {
var pre = document.createElement('pre');
el.after(pre);
scope.$watch(function() {
var attrs = {};
Array.prototype.slice.call(el[0].attributes, 0).forEach(function(item) {
if (item.name !== 'show-attrs') {
attrs[item.name] = item.value;
}
});
return attrs;
}, function(newAttrs, oldAttrs) {
pre.textContent = JSON.stringify(newAttrs, null, 2);
}, true);
}
});
</script>
</file>
</example>
##Common Accessibility Patterns
Accessibility best practices that apply to web apps in general also apply to Angular.
* [A11Y Project](http://a11yproject.com/)
* [WebAim](http://webaim.org/)
* [Using WAI-ARIA in HTML](http://www.w3.org/TR/2014/WD-aria-in-html-20140626/)
* [Apps For All: Coding Accessible Web Applications](https://shop.smashingmagazine.com/apps-for-all-coding-accessible-web-applications.html)
* **Text alternatives**: Add alternate text content to make visual information accessible using
[these W3C guidelines](http://www.w3.org/TR/html-alt-techniques/). The appropriate technique
depends on the specific markup but can be accomplished using offscreen spans, `aria-label` or
label elements, image `alt` attributes, `figure`/`figcaption` elements and more.
* **HTML Semantics**: If you're creating custom element directives, Web Components or HTML in
general, use native elements wherever possible to utilize built-in events and properties.
Alternatively, use ARIA to communicate semantic meaning. See [notes on ARIA use](http://www.w3.org/TR/aria-in-html/#notes-on-aria-use-in-html).
* **Focus management**: Guide the user around the app as views are appended/removed.
Focus should *never* be lost, as this causes unexpected behavior and much confusion (referred to
as "freak-out mode").
* **Announcing changes**: When filtering or other UI messaging happens away from the user's focus,
notify with [ARIA Live Regions](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions).
* **Color contrast and scale**: Make sure content is legible and interactive controls are usable
at all screen sizes. Consider configurable UI themes for people with color blindness, low vision
or other visual impairments.
* **Progressive enhancement**: Some users do not browse with JavaScript enabled or do not have
the latest browser. An accessible message about site requirements can inform users and improve
the experience.
## Additional Resources
* [Using ARIA in HTML](http://www.w3.org/TR/aria-in-html/)
* [AngularJS Accessibility at ngEurope](https://www.youtube.com/watch?v=dmYDggEgU-s&list=UUEGUP3TJJfMsEM_1y8iviSQ)
* [Testing with Screen Readers](http://webaim.org/articles/screenreader_testing/)
* [Chrome Accessibility Developer Tools](https://chrome.google.com/webstore/detail/accessibility-developer-t/fpkknkljclfencbdbgkenhalefipecmb?hl=en)
* [W3C Accessibility Testing](http://www.w3.org/wiki/Accessibility_testing)
* [WebAIM](http://webaim.org)
* [A11y Project](http://a11yproject.com)
+2 -2
View File
@@ -200,7 +200,7 @@ code is present, and match the CSS class name on the element, then AngularJS wil
## Class and ngClass animation hooks
AngularJS also pays attention to CSS class changes on elements by triggering the **add** and **remove** hooks.
This means that if a CSS class is added to or removed from an element then an animation can be executed in between
This means that if a CSS class is added to or removed from an element then an animation can be executed in between,
before the CSS class addition or removal is finalized. (Keep in mind that AngularJS will only be
able to capture class changes if an **expression** or the **ng-class** directive is used on the element.)
@@ -236,7 +236,7 @@ The example below shows how to perform animations during class changes:
</file>
</example>
Although the CSS is a little different then what we saw before, the idea is the same.
Although the CSS is a little different than what we saw before, the idea is the same.
## Which directives support animations?
+21 -4
View File
@@ -20,7 +20,7 @@ initialization.
<html xmlns:ng="http://angularjs.org" ng-app>
<body>
...
<script src="angular.js">
<script src="angular.js"></script>
</body>
</html>
```
@@ -73,6 +73,23 @@ If the {@link ng.directive:ngApp `ng-app`} directive is found then Angular will:
</html>
```
As a best practice, consider adding an `ng-strict-di` directive on the same element as
`ng-app`:
```html
<!doctype html>
<html ng-app="optionalModuleName" ng-strict-di>
<body>
I can add: {{ 1+2 }}.
<script src="angular.js"></script>
</body>
</html>
```
This will ensure that all services in your application are properly annotated.
See the {@link guide/di#using-strict-dependency-injection dependency injection strict mode} docs
for more.
## Manual Initialization
@@ -128,8 +145,8 @@ This is the sequence that your code should follow:
## Deferred Bootstrap
This feature enables tools like Batarang and test runners to
hook into angular's bootstrap process and sneak in more modules
This feature enables tools like [Batarang](https://github.com/angular/angularjs-batarang) and test runners
to hook into angular's bootstrap process and sneak in more modules
into the DI registry which can replace or augment DI services for
the purpose of instrumentation or mocking out heavy dependencies.
@@ -139,4 +156,4 @@ until `angular.resumeBootstrap()` is called.
`angular.resumeBootstrap()` takes an optional array of modules that
should be added to the original list of modules that the app was
about to be bootstrapped with.
about to be bootstrapped with.
+1 -1
View File
@@ -332,7 +332,7 @@ The first issue we have to solve is that the dialog box template expects `title`
But we would like the template's scope property `title` to be the result of interpolating the
`<dialog>` element's `title` attribute (i.e. `"Hello {{username}}"`). Furthermore, the buttons expect
the `onOk` and `onCancel` functions to be present in the scope. This limits the usefulness of the
widget. To solve the mapping issue we use the `locals` to create local variables which the template
widget. To solve the mapping issue we use the `scope` to create local variables which the template
expects as follows:
```js
+10 -10
View File
@@ -56,10 +56,10 @@ Try out the Live Preview above, and then let's walk through the example and desc
This looks like normal HTML, with some new markup. In Angular, a file like this is called a
<a name="template">"{@link templates template}"</a>. When Angular starts your application, it parses and
processes this new markup from the template using the so called <a name="compiler">"{@link compiler compiler}"</a>.
processes this new markup from the template using the so-called <a name="compiler">"{@link compiler compiler}"</a>.
The loaded, transformed and rendered DOM is then called the <a name="view">"view"</a>.
The first kind of new markup are the so called <a name="directive">"{@link directive directives}"</a>.
The first kind of new markup are the so-called <a name="directive">"{@link directive directives}"</a>.
They apply special behavior to attributes or elements in the HTML. In the example above we use the
{@link ng.directive:ngApp `ng-app`} attribute, which is linked to a directive that automatically
initializes our application. Angular also defines a directive for the {@link ng.directive:input `input`}
@@ -89,7 +89,7 @@ A filter formats the value of an expression for display to the user.
In the example above, the filter {@link ng.filter:currency `currency`} formats a number
into an output that looks like money.
The important thing in the example is that angular provides _live_ bindings:
The important thing in the example is that Angular provides _live_ bindings:
Whenever the input values change, the value of the expressions are automatically
recalculated and the DOM is updated with their values.
The concept behind this is <a name="databinding">"{@link databinding two-way data binding}"</a>.
@@ -150,13 +150,13 @@ different currencies and also pay the invoice.
What changed?
First, there is a new JavaScript file that contains a so called <a name="controller">"{@link controller controller}"</a>.
First, there is a new JavaScript file that contains a so-called <a name="controller">"{@link controller controller}"</a>.
More exactly, the file contains a constructor function that creates the actual controller instance.
The purpose of controllers is to expose variables and functionality to expressions and directives.
Besides the new file that contains the controller code we also added a
Besides the new file that contains the controller code we also added an
{@link ng.directive:ngController `ng-controller`} directive to the HTML.
This directive tells angular that the new `InvoiceController` is responsible for the element with the directive
This directive tells Angular that the new `InvoiceController` is responsible for the element with the directive
and all of the element's children.
The syntax `InvoiceController as invoice` tells Angular to instantiate the controller
and save it in the variable `invoice` in the current scope.
@@ -179,11 +179,11 @@ The following graphic shows how everything works together after we introduced th
<img style="padding-left: 3em; padding-bottom: 1em;" src="img/guide/concepts-databinding2.png">
## View independent business logic: Services
## View-independent business logic: Services
Right now, the `InvoiceController` contains all logic of our example. When the application grows it
is a good practice to move view independent logic from the controller into a so called
<a name="service">"{@link services service}"</a>, so it can be reused by other parts
is a good practice to move view-independent logic from the controller into a
<a name="service">{@link services service}</a>, so it can be reused by other parts
of the application as well. Later on, we could also change that service to load the exchange rates
from the web, e.g. by calling the Yahoo Finance API, without changing the controller.
@@ -263,7 +263,7 @@ services, ...) is created and wired using dependency injection. Within Angular,
the DI container is called the <a name="injector">"{@link di injector}"</a>.
To use DI, there needs to be a place where all the things that should work together are registered.
In Angular, this is the purpose of the so called <a name="module">"{@link module modules}"</a>.
In Angular, this is the purpose of the so-called <a name="module">"{@link module modules}"</a>.
When Angular starts, it will use the configuration of the module with the name defined by the `ng-app` directive,
including the configuration of all modules that this module depends on.
+10 -7
View File
@@ -5,13 +5,16 @@
# Understanding Controllers
In Angular, a Controller is a JavaScript **constructor function** that is used to augment the
In Angular, a Controller is defined by a JavaScript **constructor function** that is used to augment the
{@link scope Angular Scope}.
When a Controller is attached to the DOM via the {@link ng.directive:ngController ng-controller}
directive, Angular will instantiate a new Controller object, using the specified Controller's
**constructor function**. A new **child scope** will be available as an injectable parameter to the
Controller's constructor function as `$scope`.
**constructor function**. A new **child scope** will be created and made available as an injectable
parameter to the Controller's constructor function as `$scope`.
If the controller has been attached using the `controller as` syntax then the controller instance will
be assigned to a property on the new scope.
Use controllers to:
@@ -106,7 +109,7 @@ needed for a single view.
The most common way to keep Controllers slim is by encapsulating work that doesn't belong to
controllers into services and then using these services in Controllers via dependency injection.
This is discussed in the {@link di Dependency Injection} {@link services
This is discussed in the {@link di Dependency Injection} and {@link services
Services} sections of this guide.
@@ -162,7 +165,7 @@ scope is augmented (managed) by the `SpicyController` Controller.
starts with capital letter and ends with "Controller".
- Assigning a property to `$scope` creates or updates the model.
- Controller methods can be created through direct assignment to scope (see the `chiliSpicy` method)
- The Controller methods and properties are available in the template (for the `<div>` element and
- The Controller methods and properties are available in the template (for both the `<div>` element and
its children).
## Spicy Arguments Example
@@ -302,7 +305,7 @@ describe('myController function', function() {
```
If you need to test a nested Controller you need to create the same scope hierarchy
If you need to test a nested Controller you must create the same scope hierarchy
in your test that exists in the DOM:
```js
@@ -326,7 +329,7 @@ describe('state', function() {
expect(childScope.timeOfDay).toBe('morning');
expect(childScope.name).toBe('Mattie');
expect(grandChildScope.timeOfDay).toBe('evening');
expect(grandChildScope.name).toBe('Gingerbreak Baby');
expect(grandChildScope.name).toBe('Gingerbread Baby');
});
});
```
+11 -6
View File
@@ -13,21 +13,26 @@ Angular sets these CSS classes. It is up to your application to provide useful s
is defined. (see {@link guide/scope scope} guide for more information about scopes)
* `ng-isolate-scope`
- **Usage:** angular applies this class to any element for which a new
{@link guide/directive#isolating-the-scope-of-a-directive isolate scope} is defined.
- **Usage:** angular applies this class to any element for which a new
{@link guide/directive#isolating-the-scope-of-a-directive isolate scope} is defined.
* `ng-binding`
- **Usage:** angular applies this class to any element that is attached to a data binding, via `ng-bind` or
`{{}}` curly braces, for example. (see {@link guide/databinding databinding} guide)
* `ng-invalid`, `ng-valid`
- **Usage:** angular applies this class to an input widget element if that element's input does
- **Usage:** angular applies this class to a form control widget element if that element's input does
not pass validation. (see {@link ng.directive:input input} directive)
* `ng-pristine`, `ng-dirty`
- **Usage:** angular {@link ng.directive:input input} directive applies `ng-pristine` class
to a new input widget element which did not have user interaction. Once the user interacts with
the input widget the class is changed to `ng-dirty`.
- **Usage:** angular {@link ng.directive:ngModel ngModel} directive applies `ng-pristine` class
to a new form control widget which did not have user interaction. Once the user interacts with
the form control, the class is changed to `ng-dirty`.
* `ng-touched`, `ng-untouched`
- **Usage:** angular {@link ng.directive:ngModel ngModel} directive applies `ng-untouched` class
to a new form control widget which has not been blurred. Once the user blurs the form control,
the class is changed to `ng-touched`.
## Related Topics
+221 -186
View File
@@ -11,13 +11,227 @@ their dependencies.
The Angular injector subsystem is in charge of creating components, resolving their dependencies,
and providing them to other components as requested.
## Using Dependency Injection
DI is pervasive throughout Angular. You can use it when defining components or when providing `run`
and `config` blocks for a module.
- Components such as services, directives, filters, and animations are defined by an injectable
factory method or constructor function. These components can be injected with "service" and "value"
components as dependencies.
- Controllers are defined by a constructor function, which can be injected with any of the "service"
and "value" components as dependencies, but they can also be provided with special dependencies. See
{@link di#controllers Controllers} below for a list of these special dependencies.
- The `run` method accepts a function, which can be injected with "service", "value" and "constant"
components as dependencies. Note that you cannot inject "providers" into `run` blocks.
- The `config` method accepts a function, which can be injected with "provider" and "constant"
components as dependencies. Note that you cannot inject "service" or "value" components into
configuration.
See {@link module#module-loading-dependencies Modules} for more details about `run` and `config`
blocks.
### Factory Methods
The way you define a directive, service, or filter is with a factory function.
The factory methods are registered with modules. The recommended way of declaring factories is:
```js
angular.module('myModule', [])
.factory('serviceId', ['depService', function(depService) {
// ...
}])
.directive('directiveName', ['depService', function(depService) {
// ...
}])
.filter('filterName', ['depService', function(depService) {
// ...
}]);
```
### Module Methods
We can specify functions to run at configuration and run time for a module by calling the `config`
and `run` methods. These functions are injectable with dependencies just like the factory functions
above.
```js
angular.module('myModule', [])
.config(['depProvider', function(depProvider) {
// ...
}])
.run(['depService', function(depService) {
// ...
}]);
```
### Controllers
Controllers are "classes" or "constructor functions" that are responsible for providing the
application behavior that supports the declarative markup in the template. The recommended way of
declaring Controllers is using the array notation:
```js
someModule.controller('MyController', ['$scope', 'dep1', 'dep2', function($scope, dep1, dep2) {
...
$scope.aMethod = function() {
...
}
...
}]);
```
Unlike services, there can be many instances of the same type of controller in an application.
Moreover, additional dependencies are made available to Controllers:
* {@link scope `$scope`}: Controllers are associated with an element in the DOM and so are
provided with access to the {@link scope scope}. Other components (like services) only have
access to the {@link $rootScope `$rootScope`} service.
* {@link ngRoute.$routeProvider#when resolves}: If a controller is instantiated as part of a route,
then any values that are resolved as part of the route are made available for injection into the
controller.
## Dependency Annotation
Angular invokes certain functions (like service factories and controllers) via the injector.
You need to annotate these functions so that the injector knows what services to inject into
the function. There are three ways of annotating your code with service name information:
- Using the inline array annotation (preferred)
- Using the `$inject` property annotation
- Implicitly from the function parameter names (has caveats)
### Inline Array Annotation
This is the preferred way to annotate application components. This is how the examples in the
documentation are written.
For example:
```js
someModule.controller('MyController', ['$scope', 'greeter', function($scope, greeter) {
// ...
}]);
```
Here we pass an array whose elements consist of a list of strings (the names of the dependencies)
followed by the function itself.
When using this type of annotation, take care to keep the annotation array in sync with the
parameters in the function declaration.
### `$inject` Property Annotation
To allow the minifiers to rename the function parameters and still be able to inject the right services,
the function needs to be annotated with the `$inject` property. The `$inject` property is an array
of service names to inject.
```js
var MyController = function($scope, greeter) {
// ...
}
MyController.$inject = ['$scope', 'greeter'];
someModule.controller('MyController', MyController);
```
In this scenario the ordering of the values in the `$inject` array must match the ordering of the
parameters in `MyController`.
Just like with the array annotation, you'll need to take care to keep the `$inject` in sync with
the parameters in the function declaration.
### Implicit Annotation
<div class="alert alert-danger">
**Careful:** If you plan to [minify](http://en.wikipedia.org/wiki/Minification_(programming&#41;)
your code, your service names will get renamed and break your app.
</div>
The simplest way to get hold of the dependencies is to assume that the function parameter names
are the names of the dependencies.
```js
someModule.controller('MyController', function($scope, greeter) {
// ...
});
```
Given a function, the injector can infer the names of the services to inject by examining the
function declaration and extracting the parameter names. In the above example, `$scope` and
`greeter` are two services which need to be injected into the function.
One advantage of this approach is that there's no array of names to keep in sync with the
function parameters. You can also freely reorder dependencies.
However this method will not work with JavaScript minifiers/obfuscators because of how they
rename parameters.
Tools like [ng-annotate](https://github.com/olov/ng-annotate) let you use implicit dependency
annotations in your app and automatically add inline array annotations prior to minifying.
If you decide to take this approach, you probably want to use `ng-strict-di`.
Because of these caveats, we recommend avoiding this style of annotation.
## Using Strict Dependency Injection
You can add an `ng-strict-di` directive on the same element as `ng-app` to opt into strict DI mode:
```html
<!doctype html>
<html ng-app="myApp" ng-strict-di>
<body>
I can add: {{ 1 + 2 }}.
<script src="angular.js"></script>
</body>
</html>
```
Strict mode throws an error whenever a service tries to use implicit annotations.
Consider this module, which includes a `willBreak` service that uses implicit DI:
```js
angular.module('myApp', [])
.factory('willBreak', function($rootScope) {
// $rootScope is implicitly injected
})
.run(['willBreak', function(willBreak) {
// Angular will throw when this runs
}]);
```
When the `willBreak` service is instantiated, Angular will throw an error because of strict mode.
This is useful when using a tool like [ng-annotate](https://github.com/olov/ng-annotate) to
ensure that all of your application components have annotations.
If you're using manual bootstrapping, you can also use strict DI by providing `strictDi: true` in
the optional config argument:
```js
angular.bootstrap(document, ['myApp'], {
strictDi: true
});
```
## Why Dependency Injection?
This section motivates and explains Angular's use of DI. For how to use DI, see above.
For in-depth discussion about DI, see
[Dependency Injection](http://en.wikipedia.org/wiki/Dependency_injection) at Wikipedia,
[Inversion of Control](http://martinfowler.com/articles/injection.html) by Martin Fowler,
or read about DI in your favorite software design pattern book.
## DI in a Nutshell
There are only three ways a component (object or function) can get a hold of its dependencies:
1. The component can create the dependency, typically using the `new` operator.
@@ -79,7 +293,7 @@ Create a new injector that can provide components defined in our `myModule` modu
`greeter` service from the injector. (This is usually done automatically by angular bootstrap).
```js
var injector = angular.injector(['myModule', 'ng']);
var injector = angular.injector(['ng', 'myModule']);
var greeter = injector.get('greeter');
```
@@ -117,186 +331,7 @@ controller ever knowing about the injector.
This is the best outcome. The application code simply declares the dependencies it needs, without
having to deal with the injector. This setup does not break the Law of Demeter.
## Dependency Annotation
**How does the injector know what components need to be injected?**
The application developer needs to provide annotation information that the injector uses in order
to resolve the dependencies. Throughout Angular, certain API functions are invoked using the
injector, as per the API documentation. The injector needs to know what services to inject into
the function. There are three equivalent ways of annotating your code with service name
information:
- Implicitly from the function parameter names
- Using the `$inject` property annotation
- Using the inline array annotation
These can be used interchangeably as you see fit and are equivalent.
### Implicit Dependencies
The simplest way to get hold of the dependencies is to assume that the function parameter names
are the names of the dependencies.
```js
function MyController($scope, greeter) {
// ...
}
```
Given a function the injector can infer the names of the services to inject by examining the
function declaration and extracting the parameter names. In the above example `$scope`, and
`greeter` are two services which need to be injected into the function.
While straightforward, this method will not work with JavaScript minifiers/obfuscators as they
rename the method parameter names. This makes this way of annotating only useful for
[pretotyping](http://www.pretotyping.org/), and demo applications.
### `$inject` Property Annotation
To allow the minifiers to rename the function parameters and still be able to inject the right services,
the function needs to be annotated with the `$inject` property. The `$inject` property is an array
of service names to inject.
```js
var MyController = function(renamed$scope, renamedGreeter) {
...
}
MyController['$inject'] = ['$scope', 'greeter'];
```
In this scenario the ordering of the values in the `$inject` array must match the ordering of the
arguments to inject. Using the above code snippet as an example, `$scope` will be injected into
`renamed$scope` and `greeter` into `renamedGreeter`. Care must be taken that the `$inject`
annotation is kept in sync with the actual arguments in the function declaration.
This method of annotation is useful for controller declarations since it assigns the annotation
information with the function.
### Inline Array Annotation
Sometimes using the `$inject` annotation style is not convenient such as when annotating
directives or services defined inline by a factory function.
For example:
```js
someModule.factory('greeter', function($window) {
// ...
});
```
Results in code bloat due to needing a temporary variable:
```js
var greeterFactory = function(renamed$window) {
// ...
};
greeterFactory.$inject = ['$window'];
someModule.factory('greeter', greeterFactory);
```
For this reason the third annotation style is provided as well.
```js
someModule.factory('greeter', ['$window', function(renamed$window) {
// ...
}]);
```
Here, instead of simply providing the factory function, we pass an array whose elements consist of
a list of strings (the names of the dependencies) followed by the function itself.
Keep in mind that all of the annotation styles are equivalent and can be used anywhere in Angular
where injection is supported.
## Where Can I Use DI?
DI is pervasive throughout Angular. You can use it when defining components or when providing `run`
and `config` blocks for a module.
- Components such as services, directives, filters and animations are defined by an injectable factory
method or constructor function. These components can be injected with "service" and "value"
components as dependencies.
- The `run` method accepts a function, which can be injected with "service", "value" and "constant"
components as dependencies. Note that you cannot inject "providers" into `run` blocks.
- The `config` method accepts a function, which can be injected with "provider" and "constant"
components as dependencies. Note that you cannot inject "service" or "value" components into
configuration
- Controllers are defined by a constructor function, which can be injected with any of the "service"
and "value" components as dependencies, but they can also be provided with special dependencies. See
{@link di#controllers Controllers} below for a list of these special dependencies.
See {@link module#module-loading-dependencies Modules} for more details about injecting dependencies
into `run` and `config` blocks.
### Factory Methods
Factory methods are responsible for creating most objects in Angular. Examples are directives,
services, and filters. The factory methods are registered with the module, and the recommended way
of declaring factories is:
```js
angular.module('myModule', [])
.factory('serviceId', ['depService', function(depService) {
...
}])
.directive('directiveName', ['depService', function(depService) {
...
}])
.filter('filterName', ['depService', function(depService) {
...
}]);
```
### Module Methods
We can specify functions to run at configuration and run time for a module by calling the `run` and
`config` methods. These functions are injectable with dependencies just like the factory functions
above.
```js
angular.module('myModule', [])
.config(['depProvider', function(depProvider){
...
}])
.run(['depService', function(depService) {
...
}]);
```
### Controllers
Controllers are "classes" or "constructor functions" that are responsible for providing the
application behavior that supports the declarative markup in the template. The recommended way of
declaring Controllers is using the array notation:
```js
someModule.controller('MyController', ['$scope', 'dep1', 'dep2', function($scope, dep1, dep2) {
...
$scope.aMethod = function() {
...
}
...
}]);
```
This avoids the creation of global functions for controllers and also protects against minification.
Controllers are special in that, unlike services, there can be many instances of them in the
application. For example, there would be one instance for every `ng-controller` directive in the template.
Moreover, additional dependencies are made available to Controllers:
* {@link scope `$scope`}: Controllers are always associated with a point in the DOM and so are provided with
access to the {@link scope scope} at that point. Other components, such as services only have access to the
singleton {@link $rootScope} service.
* {@link $route} resolves: If a controller is instantiated as part of a route, then any values that
are resolved as part of the route are made available for injection into the controller.
<div class="alert alert-info">
**Note:** Angular uses
[**constructor injection**](http://misko.hevery.com/2009/02/19/constructor-injection-vs-setter-injection/).
</div>
+65 -40
View File
@@ -51,9 +51,11 @@ In the following example, we say that the `<input>` element **matches** the `ngM
The following also **matches** `ngModel`:
```html
<input data-ng:model="foo">
<input data-ng-model="foo">
```
### Normalization
Angular **normalizes** an element's tag and attribute name to determine which elements match which
directives. We typically refer to directives by their case-sensitive
[camelCase](http://en.wikipedia.org/wiki/CamelCase) **normalized** name (e.g. `ngModel`).
@@ -66,15 +68,9 @@ The **normalization** process is as follows:
1. Strip `x-` and `data-` from the front of the element/attributes.
2. Convert the `:`, `-`, or `_`-delimited name to `camelCase`.
Here are some equivalent examples of elements that match `ngBind`:
For example, the following forms are all equivalent and match the {@link ngBind} directive:
<example module="docsBindExample">
<file name="script.js">
angular.module('docsBindExample', [])
.controller('Controller', ['$scope', function($scope) {
$scope.name = 'Max Karl Ernst Ludwig Planck (April 23, 1858 October 4, 1947)';
}]);
</file>
<file name="index.html">
<div ng-controller="Controller">
Hello <input ng-model='name'> <hr/>
@@ -85,6 +81,12 @@ Here are some equivalent examples of elements that match `ngBind`:
<span x-ng-bind="name"></span> <br/>
</div>
</file>
<file name="script.js">
angular.module('docsBindExample', [])
.controller('Controller', ['$scope', function($scope) {
$scope.name = 'Max Karl Ernst Ludwig Planck (April 23, 1858 October 4, 1947)';
}]);
</file>
<file name="protractor.js" type="protractor">
it('should show off bindings', function() {
expect(element(by.css('div[ng-controller="Controller"] span[ng-bind]')).getText())
@@ -100,6 +102,8 @@ If you want to use an HTML validating tool, you can instead use the `data`-prefi
The other forms shown above are accepted for legacy reasons but we advise you to avoid them.
</div>
### Directive types
`$compile` can match directives based on element names, attributes, class names, as well as comments.
All of the Angular-provided directives match attribute name, tag name, comments, or class name.
@@ -174,6 +178,15 @@ For example, we could fix the example above by instead writing:
</svg>
```
If one wants to modify a camelcased attribute (SVG elements have valid camelcased attributes), such as `viewBox` on the `svg` element, one can use underscores to denote that the attribute to bind to is naturally camelcased.
For example, to bind to `viewBox`, we can write:
```html
<svg ng-attr-view_box="{{viewBox}}">
</svg>
```
## Creating Directives
@@ -282,7 +295,7 @@ using `templateUrl` instead:
</file>
</example>
`templateUrl` can also be a function which returns the URL of an HMTL template to be loaded and
`templateUrl` can also be a function which returns the URL of an HTML template to be loaded and
used for the directive. Angular will call the `templateUrl` function with two parameters: the
element that the directive was called on, and an `attr` object associated with that element.
@@ -742,9 +755,12 @@ own behavior to it.
angular.module('docsIsoFnBindExample', [])
.controller('Controller', ['$scope', '$timeout', function($scope, $timeout) {
$scope.name = 'Tobias';
$scope.hideDialog = function () {
$scope.message = '';
$scope.hideDialog = function (message) {
$scope.message = message;
$scope.dialogIsHidden = true;
$timeout(function () {
$scope.message = '';
$scope.dialogIsHidden = false;
}, 2000);
};
@@ -762,14 +778,15 @@ own behavior to it.
</file>
<file name="index.html">
<div ng-controller="Controller">
<my-dialog ng-hide="dialogIsHidden" on-close="hideDialog()">
{{message}}
<my-dialog ng-hide="dialogIsHidden" on-close="hideDialog(message)">
Check out the contents, {{name}}!
</my-dialog>
</div>
</file>
<file name="my-dialog-close.html">
<div class="alert">
<a href class="close" ng-click="close()">&times;</a>
<a href class="close" ng-click="close({message: 'closing for now'})">&times;</a>
<div ng-transclude></div>
</div>
</file>
@@ -786,9 +803,15 @@ callback functions to directive behaviors.
When the user clicks the `x` in the dialog, the directive's `close` function is called, thanks to
`ng-click.` This call to `close` on the isolated scope actually evaluates the expression
`hideDialog()` in the context of the original scope, thus running `Controller`'s `hideDialog`
`hideDialog(message)` in the context of the original scope, thus running `Controller`'s `hideDialog`
function.
Often it's desirable to pass data from the isolate scope via an expression to the
parent scope, this can be done by passing a map of local variable names and values into the expression
wrapper fn. For example, the hideDialog function takes a message to display when the dialog is hidden.
This is specified in the directive by calling `close({message: 'closing for now'})`. Then the local
variable `message` will be available within the `on-close` expression.
<div class="alert alert-success">
**Best Practice:** use `&attr` in the `scope` option when you want your directive
to expose an API for binding to behaviors.
@@ -808,37 +831,39 @@ element?
<file name="script.js">
angular.module('dragModule', [])
.directive('myDraggable', ['$document', function($document) {
return function(scope, element, attr) {
var startX = 0, startY = 0, x = 0, y = 0;
return {
link: function(scope, element, attr) {
var startX = 0, startY = 0, x = 0, y = 0;
element.css({
position: 'relative',
border: '1px solid red',
backgroundColor: 'lightgrey',
cursor: 'pointer'
});
element.on('mousedown', function(event) {
// Prevent default dragging of selected content
event.preventDefault();
startX = event.pageX - x;
startY = event.pageY - y;
$document.on('mousemove', mousemove);
$document.on('mouseup', mouseup);
});
function mousemove(event) {
y = event.pageY - startY;
x = event.pageX - startX;
element.css({
top: y + 'px',
left: x + 'px'
position: 'relative',
border: '1px solid red',
backgroundColor: 'lightgrey',
cursor: 'pointer'
});
}
function mouseup() {
$document.off('mousemove', mousemove);
$document.off('mouseup', mouseup);
element.on('mousedown', function(event) {
// Prevent default dragging of selected content
event.preventDefault();
startX = event.pageX - x;
startY = event.pageY - y;
$document.on('mousemove', mousemove);
$document.on('mouseup', mouseup);
});
function mousemove(event) {
y = event.pageY - startY;
x = event.pageX - startX;
element.css({
top: y + 'px',
left: x + 'px'
});
}
function mouseup() {
$document.off('mousemove', mousemove);
$document.off('mouseup', mouseup);
}
}
};
}]);
+6 -6
View File
@@ -6,7 +6,7 @@
# E2E Testing
<div class="alert alert-danger">
**Note:** In the past, end to end testing could be done with a deprecated tool called
**Note:** In the past, end-to-end testing could be done with a deprecated tool called
[Angular Scenario Runner](http://code.angularjs.org/1.2.16/docs/guide/e2e-testing). That tool
is now in maintenance mode.
</div>
@@ -14,7 +14,7 @@ is now in maintenance mode.
As applications grow in size and complexity, it becomes unrealistic to rely on manual testing to
verify the correctness of new features, catch bugs and notice regressions. Unit tests
are the first line of defense for catching bugs, but sometimes issues come up with integration
between components which can't be captured in a unit test. End to end tests are made to find
between components which can't be captured in a unit test. End-to-end tests are made to find
these problems.
We have built [Protractor](https://github.com/angular/protractor), an end
@@ -23,12 +23,12 @@ Angular application.
## Using Protractor
Protractor is a [Node.js](http://nodejs.org) program, and runs end to end tests that are also
Protractor is a [Node.js](http://nodejs.org) program, and runs end-to-end tests that are also
written in JavaScript and run with node. Protractor uses [WebDriver](https://code.google.com/p/selenium/wiki/GettingStarted)
to control browsers and simulate user actions.
For more information on Protractor, view [getting started](https://github.com/angular/protractor/blob/master/docs/getting-started.md)
or the [api docs](https://github.com/angular/protractor/blob/master/docs/api.md).
For more information on Protractor, view [getting started](http://angular.github.io/protractor/#/getting-started)
or the [api docs](http://angular.github.io/protractor/#/api).
Protractor uses [Jasmine](http://jasmine.github.io/1.3/introduction.html) for its test syntax.
As in unit testing, a test file is comprised of one or
@@ -77,7 +77,7 @@ filter the list of items.
## Example
See the [angular-seed](https://github.com/angular/angular-seed) project for more examples, or look
at the embedded examples in the Angular documentation (For example, {@link $http $http}
has an end to end test in the example under the `protractor.js` tag).
has an end-to-end test in the example under the `protractor.js` tag).
## Caveats
+31 -12
View File
@@ -26,9 +26,17 @@ Angular expressions are like JavaScript expressions with the following differenc
* **Forgiving:** In JavaScript, trying to evaluate undefined properties generates `ReferenceError`
or `TypeError`. In Angular, expression evaluation is forgiving to `undefined` and `null`.
* **No Control Flow Statements:** you cannot use the following in an Angular expression:
* **No Control Flow Statements:** You cannot use the following in an Angular expression:
conditionals, loops, or exceptions.
* **No Function Declarations:** You cannot declare functions in an Angular expression,
even inside `ng-init` directive.
* **No RegExp Creation With Literal Notation:** You cannot create regular expressions
in an Angular expression.
* **No Comma And Void Operators:** You cannot use `,` or `void` in an Angular expression.
* **Filters:** You can use {@link guide/filter filters} within expressions to format data before
displaying it.
@@ -62,7 +70,7 @@ You can try evaluating different expressions here:
<ul>
<li ng-repeat="expr in exprs track by $index">
[ <a href="" ng-click="removeExp($index)">X</a> ]
<tt>{{expr}}</tt> => <span ng-bind="$parent.$eval(expr)"></span>
<code>{{expr}}</code> => <span ng-bind="$parent.$eval(expr)"></span>
</li>
</ul>
</div>
@@ -164,6 +172,12 @@ expression. The reason behind this is core to the Angular philosophy that applic
be in controllers, not the views. If you need a real conditional, loop, or to throw from a view
expression, delegate to a JavaScript method instead.
## No function declarations or RegExp creation with literal notation
You can't declare functions or create regular expressions from within AngularJS expressions. This is
to avoid complex model transformation logic inside templates. Such logic is better placed in a
controller or in a dedicated filter where it can be tested properly.
## `$event`
Directives like {@link ng.directive:ngClick `ngClick`} and {@link ng.directive:ngFocus `ngFocus`}
@@ -278,9 +292,9 @@ digest cycle as long as that value is not undefined. If the value of the express
within the digest loop and later, within the same digest loop, it is set to undefined,
then the expression is not fulfilled and will remain watched.
1. Given an expression that starts with `::` when a digest loop is entered and expression
is dirty-checked store the value as V
2. If V is not undefined mark the result of the expression as stable and schedule a task
1. Given an expression that starts with `::`, when a digest loop is entered and expression
is dirty-checked, store the value as V
2. If V is not undefined, mark the result of the expression as stable and schedule a task
to deregister the watch for this expression when we exit the digest loop
3. Process the digest loop as normal
4. When digest loop is done and all the values have settled process the queue of watch
@@ -289,17 +303,23 @@ then the expression is not fulfilled and will remain watched.
keep dirty-checking the watch in the future digest loops by following the same
algorithm starting from step 1
#### Special case for object literals
Unlike simple values, object-literals are watched until every key is defined.
See http://www.bennadel.com/blog/2760-one-time-data-bindings-for-object-literal-expressions-in-angularjs-1-3.htm
### How to benefit from one-time binding
When interpolating text or attributes. If the expression, once set, will not change
then it is a candidate for one-time expression.
If the expression will not change once set, it is a candidate for one-time binding.
Here are three example cases.
When interpolating text or attributes:
```html
<div name="attr: {{::color}}">text: {{::name}}</div>
```
When using a directive with bidirectional binding and the parameters will not change
When using a directive with bidirectional binding and the parameters will not change:
```js
someModule.directive('someDirective', function() {
@@ -314,15 +334,14 @@ someModule.directive('someDirective', function() {
```
```html
<div some-directive name=::myName color=My color is {{::myColor}}></div>
<div some-directive name="::myName" color="My color is {{::myColor}}"></div>
```
When using a directive that takes an expression
When using a directive that takes an expression:
```html
<ul>
<li ng-repeat="item in ::items">{{item.name}};</li>
</ul>
```
```
+7
View File
@@ -91,6 +91,13 @@ The filter function should be a [pure function](http://en.wikipedia.org/wiki/Pur
means that it should be stateless and idempotent. Angular relies on these properties and executes
the filter only when the inputs to the function change.
<div class="alert alert-warning">
**Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.
Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace
your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores
(`myapp_subsection_filterx`).
</div>
The following sample filter reverses a text string. In addition, it conditionally makes the
text upper-case.
+202 -102
View File
@@ -6,16 +6,19 @@
Controls (`input`, `select`, `textarea`) are ways for a user to enter data.
A Form is a collection of controls for the purpose of grouping related controls together.
Form and controls provide validation services, so that the user can be notified of invalid input.
This provides a better user experience, because the user gets instant feedback on how to correct the error.
Keep in mind that while client-side validation plays an important role in providing good user experience, it can easily be circumvented and thus can not be trusted.
Server-side validation is still necessary for a secure application.
Form and controls provide validation services, so that the user can be notified of invalid input
before submitting a form. This provides a better user experience than server-side validation alone
because the user gets instant feedback on how to correct the error. Keep in mind that while
client-side validation plays an important role in providing good user experience, it can easily
be circumvented and thus can not be trusted. Server-side validation is still necessary for a
secure application.
# Simple form
The key directive in understanding two-way data-binding is {@link ng.directive:ngModel ngModel}.
The `ngModel` directive provides the two-way data-binding by synchronizing the model to the view, as well as view to the model.
In addition it provides an {@link ngModel.NgModelController API} for other directives to augment its behavior.
The `ngModel` directive provides the two-way data-binding by synchronizing the model to the view,
as well as view to the model. In addition it provides an {@link ngModel.NgModelController API}
for other directives to augment its behavior.
<example module="formExample">
<file name="index.html">
@@ -25,8 +28,8 @@ In addition it provides an {@link ngModel.NgModelController API} for other direc
E-mail: <input type="email" ng-model="user.email" /><br />
Gender: <input type="radio" ng-model="user.gender" value="male" />male
<input type="radio" ng-model="user.gender" value="female" />female<br />
<button ng-click="reset()">RESET</button>
<button ng-click="update(user)">SAVE</button>
<input type="button" ng-click="reset()" value="Reset" />
<input type="submit" ng-click="update(user)" value="Save" />
</form>
<pre>form = {{user | json}}</pre>
<pre>master = {{master | json}}</pre>
@@ -54,43 +57,52 @@ In addition it provides an {@link ngModel.NgModelController API} for other direc
Note that `novalidate` is used to disable browser's native form validation.
The value of `ngModel` won't be set unless it passes validation for the input field.
For example: inputs of type `email` must have a value in the form of `user@domain`.
# Using CSS classes
To allow styling of form as well as controls, `ngModel` adds these CSS classes:
- `ng-valid`
- `ng-invalid`
- `ng-pristine`
- `ng-dirty`
- `ng-touched`
- `ng-untouched`
- `ng-valid`: the model is valid
- `ng-invalid`: the model is invalid
- `ng-valid-[key]`: for each valid key added by `$setValidity`
- `ng-invalid-[key]`: for each invalid key added by `$setValidity`
- `ng-pristine`: the control hasn't been interacted with yet
- `ng-dirty`: the control has been interacted with
- `ng-touched`: the control has been blurred
- `ng-untouched`: the control hasn't been blurred
- `ng-pending`: any `$asyncValidators` are unfulfilled
The following example uses the CSS to display validity of each form control.
In the example both `user.name` and `user.email` are required, but are rendered with red background only when they are dirty.
This ensures that the user is not distracted with an error until after interacting with the control, and failing to satisfy its validity.
In the example both `user.name` and `user.email` are required, but are rendered
with red background only after the input is blurred (loses focus).
This ensures that the user is not distracted with an error until after interacting with the control,
and failing to satisfy its validity.
<example module="formExample">
<file name="index.html">
<div ng-controller="ExampleController">
<form novalidate class="css-form">
Name:
<input type="text" ng-model="user.name" required /><br />
Name: <input type="text" ng-model="user.name" required /><br />
E-mail: <input type="email" ng-model="user.email" required /><br />
Gender: <input type="radio" ng-model="user.gender" value="male" />male
<input type="radio" ng-model="user.gender" value="female" />female<br />
<button ng-click="reset()">RESET</button>
<button ng-click="update(user)">SAVE</button>
<input type="button" ng-click="reset()" value="Reset" />
<input type="submit" ng-click="update(user)" value="Save" />
</form>
<pre>form = {{user | json}}</pre>
<pre>master = {{master | json}}</pre>
</div>
<style type="text/css">
.css-form input.ng-invalid.ng-dirty {
.css-form input.ng-invalid.ng-touched {
background-color: #FA787E;
}
.css-form input.ng-valid.ng-dirty {
.css-form input.ng-valid.ng-touched {
background-color: #78FA89;
}
</style>
@@ -122,44 +134,57 @@ A form is an instance of {@link form.FormController FormController}.
The form instance can optionally be published into the scope using the `name` attribute.
Similarly, an input control that has the {@link ng.directive:ngModel ngModel} directive holds an
instance of {@link ngModel.NgModelController NgModelController}.
Such a control instance can be published as a property of the form instance using the `name` attribute
on the input control. The name attribute specifies the name of the property on the form instance.
instance of {@link ngModel.NgModelController NgModelController}. Such a control instance
can be published as a property of the form instance using the `name` attribute on the input control.
The name attribute specifies the name of the property on the form instance.
This implies that the internal state of both the form and the control is available for binding in
the view using the standard binding primitives.
This allows us to extend the above example with these features:
- RESET button is enabled only if form has some changes
- SAVE button is enabled only if form has some changes and is valid
- custom error messages for `user.email` and `user.agree`
- Custom error message displayed after the user interacted with a control (i.e. when `$touched` is set)
- Custom error message displayed upon submitting the form (`$submitted` is set), even if the user
didn't interact with a control
<example module="formExample">
<file name="index.html">
<div ng-controller="ExampleController">
<form name="form" class="css-form" novalidate>
Name:
<input type="text" ng-model="user.name" name="uName" required /><br />
<input type="text" ng-model="user.name" name="uName" required="" />
<br />
<div ng-show="form.$submitted || form.uName.$touched">
<div ng-show="form.uName.$error.required">Tell us your name.</div>
</div>
E-mail:
<input type="email" ng-model="user.email" name="uEmail" required/><br />
<div ng-show="form.uEmail.$dirty && form.uEmail.$invalid">Invalid:
<input type="email" ng-model="user.email" name="uEmail" required="" />
<br />
<div ng-show="form.$submitted || form.uEmail.$touched">
<span ng-show="form.uEmail.$error.required">Tell us your email.</span>
<span ng-show="form.uEmail.$error.email">This is not a valid email.</span>
</div>
Gender: <input type="radio" ng-model="user.gender" value="male" />male
<input type="radio" ng-model="user.gender" value="female" />female<br />
Gender:
<input type="radio" ng-model="user.gender" value="male" />male
<input type="radio" ng-model="user.gender" value="female" />female
<br />
<input type="checkbox" ng-model="user.agree" name="userAgree" required="" />
<input type="checkbox" ng-model="user.agree" name="userAgree" required />
I agree: <input ng-show="user.agree" type="text" ng-model="user.agreeSign"
required /><br />
<div ng-show="!user.agree || !user.agreeSign">Please agree and sign.</div>
I agree:
<input ng-show="user.agree" type="text" ng-model="user.agreeSign" required="" />
<br />
<div ng-show="form.$submitted || form.userAgree.$touched">
<div ng-show="!user.agree || !user.agreeSign">Please agree and sign.</div>
</div>
<button ng-click="reset()" ng-disabled="isUnchanged(user)">RESET</button>
<button ng-click="update(user)"
ng-disabled="form.$invalid || isUnchanged(user)">SAVE</button>
<input type="button" ng-click="reset(form)" value="Reset" />
<input type="submit" ng-click="update(user)" value="Save" />
</form>
<pre>form = {{user | json}}</pre>
<pre>master = {{master | json}}</pre>
</div>
</file>
@@ -172,14 +197,14 @@ This allows us to extend the above example with these features:
$scope.master = angular.copy(user);
};
$scope.reset = function() {
$scope.reset = function(form) {
if (form) {
form.$setPristine();
form.$setUntouched();
}
$scope.user = angular.copy($scope.master);
};
$scope.isUnchanged = function(user) {
return angular.equals(user, $scope.master);
};
$scope.reset();
}]);
</file>
@@ -187,7 +212,7 @@ This allows us to extend the above example with these features:
# Custom triggers
# Custom model update triggers
By default, any change to the content will trigger a model update and form validation. You can
override this behavior using the {@link ng.directive:ngModelOptions ngModelOptions} directive to
@@ -195,13 +220,15 @@ bind only to specified list of events. I.e. `ng-model-options="{ updateOn: 'blur
and validate only after the control loses focus. You can set several events using a space delimited
list. I.e. `ng-model-options="{ updateOn: 'mousedown blur' }"`
<img alt="animation showing debounced input" src="img/guide/forms-update-on-blur.gif">
If you want to keep the default behavior and just add new events that may trigger the model update
and validation, add "default" as one of the specified events.
I.e. `ng-model-options="{ updateOn: 'default blur' }"`
The following example shows how to override immediate updates. Changes on the inputs within the form will update the model
only when the control loses focus (blur event).
The following example shows how to override immediate updates. Changes on the inputs within the form
will update the model only when the control loses focus (blur event).
<example module="customTriggerExample">
<file name="index.html">
@@ -232,6 +259,8 @@ You can delay the model update/validation by using the `debounce` key with the
{@link ng.directive:ngModelOptions ngModelOptions} directive. This delay will also apply to
parsers, validators and model flags like `$dirty` or `$pristine`.
<img alt="animation showing debounced input" src="img/guide/forms-debounce.gif">
I.e. `ng-model-options="{ debounce: 500 }"` will wait for half a second since
the last content change before triggering the model update and form validation.
@@ -241,10 +270,11 @@ in `debounce`. This can be useful to force immediate updates on some specific ci
I.e. `ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }"`
If those attributes are added to an element, they will be applied to all the child elements and controls that inherit from it unless they are
overridden.
If those attributes are added to an element, they will be applied to all the child elements and
controls that inherit from it unless they are overridden.
This example shows how to debounce model changes. Model will be updated only 250 milliseconds after last change.
This example shows how to debounce model changes. Model will be updated only 250 milliseconds
after last change.
<example module="debounceExample">
<file name="index.html">
@@ -264,35 +294,40 @@ This example shows how to debounce model changes. Model will be updated only 250
</file>
</example>
# Custom Validation
Angular provides basic implementation for most common html5 {@link ng.directive:input input}
types: ({@link input[text] text}, {@link input[number] number}, {@link input[url] url}, {@link input[email] email}, {@link input[radio] radio}, {@link input[checkbox] checkbox}), as well as some directives for validation (`required`, `pattern`, `minlength`, `maxlength`, `min`, `max`).
Angular provides basic implementation for most common HTML5 {@link ng.directive:input input}
types: ({@link input[text] text}, {@link input[number] number}, {@link input[url] url},
{@link input[email] email}, {@link input[date] date}, {@link input[radio] radio}, {@link input[checkbox] checkbox}),
as well as some directives for validation (`required`, `pattern`, `minlength`, `maxlength`,
`min`, `max`).
Defining your own validator can be done by defining your own directive which adds a custom validation function to the `ngModel` {@link ngModel.NgModelController controller}.
To get a hold of the controller the directive specifies a dependency as shown in the example below.
The validation can occur in two places:
With a custom directive, you can add your own validation functions to the `$validators` object on
the {@link ngModel.NgModelController `ngModelController`}. To get a hold of the controller,
you require it in the directive as shown in the example below.
* **Model to View update** -
Whenever the bound model changes, all functions in {@link ngModel.NgModelController#$formatters NgModelController#$formatters} array are pipe-lined, so that each of these functions has an opportunity to format the value and change validity state of the form control through {@link ngModel.NgModelController#$setValidity NgModelController#$setValidity}.
Each function in the `$validators` object receives the `modelValue` and the `viewValue`
as parameters. Angular will then call `$setValidity` internally with the function's return value
(`true`: valid, `false`: invalid). The validation functions are executed every time an input
is changed (`$setViewValue` is called) or whenever the bound `model` changes.
Validation happens after successfully running `$parsers` and `$formatters`, respectively.
Failed validators are stored by key in
{@link ngModel.NgModelController#$error `ngModelController.$error`}.
* **View to Model update** -
In a similar way, whenever a user interacts with a control it calls {@link ngModel.NgModelController#$setViewValue NgModelController#$setViewValue}.
This in turn pipelines all functions in the {@link ngModel.NgModelController#$parsers NgModelController#$parsers} array, so that each of these functions has an opportunity to convert the value and change validity state of the form control through {@link ngModel.NgModelController#$setValidity NgModelController#$setValidity}.
Additionally, there is the `$asyncValidators` object which handles asynchronous validation,
such as making an `$http` request to the backend. Functions added to the object must return
a promise that must be `resolved` when valid or `rejected` when invalid.
In-progress async validations are stored by key in
{@link ngModel.NgModelController#$pending `ngModelController.$pending`}.
In the following example we create two directives.
* The first one is `integer` and it validates whether the input is a valid integer.
For example `1.23` is an invalid value, since it contains a fraction.
Note that we unshift the array instead of pushing.
This is because we want it to be the first parser and consume the control string value, as we need to execute the validation function before a conversion to number occurs.
* The second directive is a `smart-float`.
It parses both `1.2` and `1,2` into a valid float number `1.2`.
Note that we can't use input type `number` here as HTML5 browsers would not allow the user to type what it would consider an invalid number such as `1,2`.
In the following example we create two directives:
* An `integer` directive that validates whether the input is a valid integer. For example,
`1.23` is an invalid value, since it contains a fraction. Note that we validate the viewValue
(the string value of the control), and not the modelValue. This is because input[number] converts
the viewValue to a number when running the `$parsers`.
* A `username` directive that asynchronously checks if a user-entered value is already taken.
We mock the server request with a `$q` deferred.
<example module="form-example1">
<file name="index.html">
@@ -301,18 +336,18 @@ In the following example we create two directives.
Size (integer 0 - 10):
<input type="number" ng-model="size" name="size"
min="0" max="10" integer />{{size}}<br />
<span ng-show="form.size.$error.integer">This is not valid integer!</span>
<span ng-show="form.size.$error.integer">The value is not a valid integer!</span>
<span ng-show="form.size.$error.min || form.size.$error.max">
The value must be in range 0 to 10!</span>
</div>
<div>
Length (float):
<input type="text" ng-model="length" name="length" smart-float />
{{length}}<br />
<span ng-show="form.length.$error.float">
This is not a valid float number!</span>
Username:
<input type="text" ng-model="name" name="name" username />{{name}}<br />
<span ng-show="form.name.$pending.username">Checking if this name is available...</span>
<span ng-show="form.name.$error.username">This username is already taken!</span>
</div>
</form>
</file>
@@ -324,35 +359,96 @@ In the following example we create two directives.
return {
require: 'ngModel',
link: function(scope, elm, attrs, ctrl) {
ctrl.$parsers.unshift(function(viewValue) {
ctrl.$validators.integer = function(modelValue, viewValue) {
if (ctrl.$isEmpty(modelValue)) {
// consider empty models to be valid
return true;
}
if (INTEGER_REGEXP.test(viewValue)) {
// it is valid
ctrl.$setValidity('integer', true);
return viewValue;
} else {
// it is invalid, return undefined (no model update)
ctrl.$setValidity('integer', false);
return undefined;
return true;
}
});
// it is invalid
return false;
};
}
};
});
var FLOAT_REGEXP = /^\-?\d+((\.|\,)\d+)?$/;
app.directive('smartFloat', function() {
app.directive('username', function($q, $timeout) {
return {
require: 'ngModel',
link: function(scope, elm, attrs, ctrl) {
ctrl.$parsers.unshift(function(viewValue) {
if (FLOAT_REGEXP.test(viewValue)) {
ctrl.$setValidity('float', true);
return parseFloat(viewValue.replace(',', '.'));
} else {
ctrl.$setValidity('float', false);
return undefined;
var usernames = ['Jim', 'John', 'Jill', 'Jackie'];
ctrl.$asyncValidators.username = function(modelValue, viewValue) {
if (ctrl.$isEmpty(modelValue)) {
// consider empty model valid
return $q.when();
}
});
var def = $q.defer();
$timeout(function() {
// Mock a delayed response
if (usernames.indexOf(modelValue) === -1) {
// The username is available
def.resolve();
} else {
def.reject();
}
}, 2000);
return def.promise;
};
}
};
});
</file>
</example>
# Modifying built-in validators
Since Angular itself uses `$validators`, you can easily replace or remove built-in validators,
should you find it necessary. The following example shows you how to overwrite the email validator
in `input[email]` from a custom directive so that it requires a specific top-level domain,
`example.com` to be present.
Note that you can alternatively use `ng-pattern` to further restrict the validation.
<example module="form-example-modify-validators">
<file name="index.html">
<form name="form" class="css-form" novalidate>
<div>
Overwritten Email:
<input type="email" ng-model="myEmail" overwrite-email name="overwrittenEmail" />
<span ng-show="form.overwrittenEmail.$error.email">This email format is invalid!</span><br>
Model: {{myEmail}}
</div>
</form>
</file>
<file name="script.js">
var app = angular.module('form-example-modify-validators', []);
app.directive('overwriteEmail', function() {
var EMAIL_REGEXP = /^[a-z0-9!#$%&'*+/=?^_`{|}~.-]+@example\.com$/i;
return {
require: 'ngModel',
restrict: '',
link: function(scope, elm, attrs, ctrl) {
// only apply the validator if ngModel is present and Angular has added the email validator
if (ctrl && ctrl.$validators.email) {
// this will overwrite the default Angular email validator
ctrl.$validators.email = function(modelValue) {
return ctrl.$isEmpty(modelValue) || EMAIL_REGEXP.test(modelValue);
};
}
}
};
});
@@ -361,15 +457,19 @@ In the following example we create two directives.
# Implementing custom form controls (using `ngModel`)
Angular implements all of the basic HTML form controls ({@link ng.directive:input input}, {@link ng.directive:select select}, {@link ng.directive:textarea textarea}), which should be sufficient for most cases.
However, if you need more flexibility, you can write your own form control as a directive.
Angular implements all of the basic HTML form controls ({@link ng.directive:input input},
{@link ng.directive:select select}, {@link ng.directive:textarea textarea}),
which should be sufficient for most cases. However, if you need more flexibility,
you can write your own form control as a directive.
In order for custom control to work with `ngModel` and to achieve two-way data-binding it needs to:
- implement `$render` method, which is responsible for rendering the data after it passed the {@link ngModel.NgModelController#$formatters NgModelController#$formatters},
- call `$setViewValue` method, whenever the user interacts with the control and model needs to be updated. This is usually done inside a DOM Event listener.
- implement `$render` method, which is responsible for rendering the data after it passed the
{@link ngModel.NgModelController#$formatters `NgModelController.$formatters`},
- call `$setViewValue` method, whenever the user interacts with the control and model
needs to be updated. This is usually done inside a DOM Event listener.
See {@link guide/directive $compileProvider.directive} for more info.
See {@link guide/directive `$compileProvider.directive`} for more info.
The following example shows how to add two-way data-binding to contentEditable elements.
+5 -184
View File
@@ -6,7 +6,7 @@
# Internet Explorer Compatibility
<div class="alert alert-warning">
**Note:** AngularJS 1.3 is dropping support for IE8. Read more about it on
**Note:** AngularJS 1.3 has dropped support for IE8. Read more about it on
[our blog](http://blog.angularjs.org/2013/12/angularjs-13-new-release-approaches.html).
AngularJS 1.2 will continue to support IE8, but the core team does not plan to spend time
addressing issues specific to IE8 or earlier.
@@ -14,7 +14,7 @@ addressing issues specific to IE8 or earlier.
This document describes the Internet Explorer (IE) idiosyncrasies when dealing with custom HTML
attributes and tags. Read this document if you are planning on deploying your Angular application
on IE8 or earlier.
on IE.
The project currently supports and will attempt to fix bugs for IE9 and above. The continuous
integration server runs all the tests against IE9, IE10, and IE11. See
@@ -25,186 +25,7 @@ We do not run tests on IE8 and below. A subset of the AngularJS functionality ma
browsers, but it is up to you to test and decide whether it works for your particular app.
## Short Version
To make your Angular application work on IE please make sure that:
1. You polyfill JSON.stringify for IE7 and below. You can use
[JSON2](https://github.com/douglascrockford/JSON-js) or
[JSON3](http://bestiejs.github.com/json3/) polyfills for this.
```html
<!doctype html>
<html xmlns:ng="http://angularjs.org">
<head>
<!--[if lte IE 7]>
<script src="/path/to/json2.js"></script>
<![endif]-->
</head>
<body>
...
</body>
</html>
```
2. add `id="ng-app"` to the root element in conjunction with `ng-app` attribute
```html
<!doctype html>
<html xmlns:ng="http://angularjs.org" id="ng-app" ng-app="optionalModuleName">
...
</html>
```
3. you **do not** use custom element tags such as `<ng:view>` (use the attribute version
`<div ng-view>` instead), or
4. if you **do use** custom element tags, then you must take these steps to make IE 8 and below happy:
```html
<!doctype html>
<html xmlns:ng="http://angularjs.org" id="ng-app" ng-app="optionalModuleName">
<head>
<!--[if lte IE 8]>
<script>
document.createElement('ng-include');
document.createElement('ng-pluralize');
document.createElement('ng-view');
// Optionally these for CSS
document.createElement('ng:include');
document.createElement('ng:pluralize');
document.createElement('ng:view');
</script>
<![endif]-->
</head>
<body>
...
</body>
</html>
```
5. Use `ng-style` tags instead of `style="{{ someCss }}"`. The later works in Chrome and Firefox
but does not work in Internet Explorer <= 11 (the most recent version at time of writing).
The **important** parts are:
* `xmlns:ng` - *namespace* - you need one namespace for each custom tag you are planning on
using.
* `document.createElement(yourTagName)` - *creation of custom tag names* - Since this is an
issue only for older version of IE you need to load it conditionally. For each tag which does
not have namespace and which is not defined in HTML you need to pre-declare it to make IE
happy.
## Long Version
IE has issues with element tag names which are not standard HTML tag names. These fall into two
categories, and each category has its own fix.
* If the tag name starts with `my:` prefix then it is considered an XML namespace and must
have corresponding namespace declaration on `<html xmlns:my="ignored">`
* If the tag has no `:` but it is not a standard HTML tag, then it must be pre-created using
`document.createElement('my-tag')`
* If you are planning on styling the custom tag with CSS selectors, then it must be
pre-created using `document.createElement('my-tag')` regardless of XML namespace.
## The Good News
The good news is that these restrictions only apply to element tag names, and not to element
attribute names. So this requires no special handling in IE: `<div my-tag your:tag></div>`.
## What happens if I fail to do this?
Suppose you have HTML with unknown tag `mytag` (this could also be `my:tag` or `my-tag` with same
result):
```html
<html>
<body>
<mytag>some text</mytag>
</body>
</html>
```
It should parse into the following DOM:
```
#document
+- HTML
+- BODY
+- mytag
+- #text: some text
```
The expected behavior is that the `BODY` element has a child element `mytag`, which in turn has
the text `some text`.
But this is not what IE does (if the above fixes are not included):
```
#document
+- HTML
+- BODY
+- mytag
+- #text: some text
+- /mytag
```
In IE, the behavior is that the `BODY` element has three children:
1. A self closing `mytag`. Example of self closing tag is `<br/>`. The trailing `/` is optional,
but the `<br>` tag is not allowed to have any children, and browsers consider `<br>some
text</br>` as three siblings not a `<br>` with `some text` as child.
2. A text node with `some text`. This should have been a child of `mytag` above, not a sibling.
3. A corrupt self closing `/mytag`. This is corrupt since element names are not allowed to have
the `/` character. Furthermore this closing element should not be part of the DOM since it is
only used to delineate the structure of the DOM.
## CSS Styling of Custom Tag Names
To make CSS selectors work with custom elements, the custom element name must be pre-created with
`document.createElement('my-tag')` regardless of XML namespace.
```html
<html xmlns:ng="needed for ng: namespace">
<head>
<!--[if lte IE 8]>
<script>
// needed to make ng-include parse properly
document.createElement('ng-include');
// needed to enable CSS reference
document.createElement('ng:view');
</script>
<![endif]-->
<style>
ng\:view {
display: block;
border: 1px solid red;
}
ng-include {
display: block;
border: 1px solid blue;
}
</style>
</head>
<body>
<ng:view></ng:view>
<ng-include></ng-include>
...
</body>
</html>
```
To ensure your Angular application works on IE please consider:
1. Use `ng-style` tags instead of `style="{{ someCss }}"`. The latter works in Chrome and Firefox
but does not work in Internet Explorer <= 11 (the most recent version at time of writing).
+10 -5
View File
@@ -41,9 +41,10 @@ In Angular applications, you move the job of filling page templates with data fr
### Other AngularJS Features
* **Animation:** {@link guide/animations Core concepts}, {@link ngAnimate ngAnimate API}, and [Animation in AngularJS 1.2](http://www.yearofmoo.com/2013/08/remastered-animation-in-angularjs-1-2.html)
* **Security:** {@link ng.$sce Strict Contextual Escaping}, {@link ng.directive:ngCsp Content Security Policy}, {@link ngSanitize.$sanitize $sanitize}, [video](https://www.youtube.com/watch?v=18ifoT-Id54)
* **Security:** {@link guide/security Security Docs}, {@link ng.$sce Strict Contextual Escaping}, {@link ng.directive:ngCsp Content Security Policy}, {@link ngSanitize.$sanitize $sanitize}, [video](https://www.youtube.com/watch?v=18ifoT-Id54)
* **Internationalization and Localization:** {@link guide/i18n Angular Guide to i18n and l10n}, {@link ng.filter:date date filter}, {@link ng.filter:currency currency filter}, [Creating multilingual support](http://www.novanet.no/blog/hallstein-brotan/dates/2013/10/creating-multilingual-support-using-angularjs/)
* **Mobile:** {@link ngTouch Touch events}
* **Accessibility:** {@link guide/accessibility ngAria}
### Testing
@@ -52,7 +53,7 @@ In Angular applications, you move the job of filling page templates with data fr
## Specific Topics
* **Login: **[Google example](https://developers.google.com/+/photohunt/python), [Facebook example](http://blog.brunoscopelliti.com/facebook-authentication-in-your-angularjs-web-app), [authentication strategy](http://blog.brunoscopelliti.com/deal-with-users-authentication-in-an-angularjs-web-app), [unix-style authorization](http://frederiknakstad.com/authentication-in-single-page-applications-with-angular-js/)
* **Login: **[Google example](https://developers.google.com/+/photohunt/python), [AngularJS Facebook library](https://github.com/pc035860/angular-easyfb), [Facebook example](http://blog.brunoscopelliti.com/facebook-authentication-in-your-angularjs-web-app), [authentication strategy](http://blog.brunoscopelliti.com/deal-with-users-authentication-in-an-angularjs-web-app), [unix-style authorization](http://frederiknakstad.com/authentication-in-single-page-applications-with-angular-js/)
* **Mobile:** [Angular on Mobile Guide](http://www.ng-newsletter.com/posts/angular-on-mobile.html), [PhoneGap](http://devgirl.org/2013/06/10/quick-start-guide-phonegap-and-angularjs/)
* **Other Languages:** [CoffeeScript](http://www.coffeescriptlove.com/2013/08/angularjs-and-coffeescript-tutorials.html), [Dart](https://github.com/angular/angular.dart.tutorial/wiki)
* **Realtime: **[Socket.io](http://www.creativebloq.com/javascript/angularjs-collaboration-board-socketio-2132885), [OmniBinder](https://github.com/jeffbcross/omnibinder)
@@ -61,6 +62,7 @@ In Angular applications, you move the job of filling page templates with data fr
## Tools
* **Getting Started:** [Comparison of the options for starting a new project](http://www.dancancro.com/comparison-of-angularjs-application-starters/)
* **Debugging:** [Batarang](https://chrome.google.com/webstore/detail/angularjs-batarang/ighdmehidhipcmcojjgiloacoafjmpfk?hl=en)
* **Testing:** [Karma](http://karma-runner.github.io), [Protractor](https://github.com/angular/protractor)
* **Editor support:** [Webstorm](http://plugins.jetbrains.com/plugin/6971) (and [video](http://www.youtube.com/watch?v=LJOyrSh1kDU)), [Sublime Text](https://github.com/angular-ui/AngularJS-sublime-package), [Visual Studio](http://madskristensen.net/post/angularjs-intellisense-in-visual-studio-2012)
@@ -95,17 +97,20 @@ This is a short list of libraries with specific support and documentation for wo
* **MEAN Stack: **[Blog post](http://blog.mongodb.org/post/49262866911/the-mean-stack-mongodb-expressjs-angularjs-and), [Setup](http://thecodebarbarian.wordpress.com/2013/07/22/introduction-to-the-mean-stack-part-one-setting-up-your-tools/), [GDL Video](https://developers.google.com/live/shows/913996610)
* **Rails: **[Tutorial](http://coderberry.me/blog/2013/04/22/angularjs-on-rails-4-part-1/), [AngularJS with Rails4](https://shellycloud.com/blog/2013/10/how-to-integrate-angularjs-with-rails-4), [angularjs-rails](https://github.com/hiravgandhi/angularjs-rails)
* **PHP: **[Building a RESTful web service](http://blog.brunoscopelliti.com/building-a-restful-web-service-with-angularjs-and-php-more-power-with-resource), [End to End with Laravel 4 (video)](http://www.youtube.com/watch?v=hqAyiqUs93c)
* **Meteor: **[angular-meteor package](https://github.com/Urigo/angular-meteor)
## Learning Resources
###Books
* [AngularJS](http://www.amazon.com/AngularJS-Brad-Green/dp/1449344852) by Brad Green and Shyam Seshadri
* [AngularJS: Up and Running](http://www.amazon.com/AngularJS-Running-Enhanced-Productivity-Structured/dp/1491901942) by Brad Green and Shyam Seshadri
* [Mastering Web App Development](http://www.amazon.com/Mastering-Web-Application-Development-AngularJS/dp/1782161821) by Pawel Kozlowski and Pete Bacon Darwin
* [AngularJS Directives](http://www.amazon.com/AngularJS-Directives-Alex-Vanston/dp/1783280336) by Alex Vanston
* [Recipes With AngularJS](http://www.amazon.co.uk/Recipes-Angular-js-Frederik-Dietz-ebook/dp/B00DK95V48) by Frederik Dietz
* [Developing an AngularJS Edge](http://www.amazon.com/Developing-AngularJS-Edge-Christopher-Hiller-ebook/dp/B00CJLFF8K) by Christopher Hiller
* [ng-book: The Complete Book on AngularJS](http://ng-book.com/) by Ari Lerner
* [AngularJS : Novice to Ninja](http://www.amazon.in/AngularJS-Novice-Ninja-Sandeep-Panda/dp/0992279453) by Sandeep Panda
* [AngularJS UI Development](http://www.amazon.com/AngularJS-UI-Development-Amit-Ghart-ebook/dp/B00OXVAK7A) by Amit Gharat and Matthias Nehlsen
* [Responsive Web Design with AngularJS](http://www.amazon.com/Responsive-Design-AngularJS-Sandeep-Kumar/dp/178439842X) by Sandeep Kumar Patel
###Videos:
* [egghead.io](http://egghead.io/)
@@ -114,12 +119,12 @@ This is a short list of libraries with specific support and documentation for wo
### Courses
* **Free online:**
[thinkster.io](http://thinkster.io),
[CodeAcademy](http://www.codecademy.com/courses/javascript-advanced-en-2hJ3J/0/1)
[CodeAcademy](http://www.codecademy.com/courses/javascript-advanced-en-2hJ3J/0/1),
[CodeSchool](https://www.codeschool.com/courses/shaping-up-with-angular-js)
* **Paid online:**
[Pluralsite (3 courses)](http://www.pluralsight.com/training/Courses/Find?highlight=true&searchTerm=angularjs),
[Tuts+](https://tutsplus.com/course/easier-js-apps-with-angular/),
[lynda.com](http://www.lynda.com/AngularJS-tutorials/Up-Running-AngularJS/133318-2.html)
[lynda.com](http://www.lynda.com/AngularJS-tutorials/Up-Running-AngularJS/133318-2.html),
[WintellectNOW (4 lessons)](http://www.wintellectnow.com/Course/Detail/mastering-angularjs)
* **Paid onsite:**
[angularbootcamp.com](http://angularbootcamp.com/)
+13 -13
View File
@@ -12,7 +12,7 @@ succinctly. Angular's data binding and dependency injection eliminate much of th
would otherwise have to write. And it all happens within the browser, making it
an ideal partner with any server technology.
Angular is what HTML would have been had it been designed for applications. HTML is a great
Angular is what HTML would have been, had it been designed for applications. HTML is a great
declarative language for static documents. It does not contain much in the way of creating
applications, and as a result building web applications is an exercise in *what do I have to do
to trick the browser into doing what I want?*
@@ -28,12 +28,12 @@ The impedance mismatch between dynamic applications and static documents is ofte
Angular takes another approach. It attempts to minimize the impedance mismatch between document
centric HTML and what an application needs by creating new HTML constructs. Angular teaches the
browser new syntax through a construct we call directives. Examples include:
browser new syntax through a construct we call *directives*. Examples include:
* Data binding, as in `{{}}`.
* DOM control structures for repeating/hiding DOM fragments.
* DOM control structures for repeating, showing and hiding DOM fragments.
* Support for forms and form validation.
* Attaching code-behind to DOM elements.
* Attaching new behavior to DOM elements, such as DOM event handling.
* Grouping of HTML into reusable components.
@@ -42,20 +42,20 @@ browser new syntax through a construct we call directives. Examples include:
Angular is not a single piece in the overall puzzle of building the client-side of a web
application. It handles all of the DOM and AJAX glue code you once wrote by hand and puts it in a
well-defined structure. This makes Angular opinionated about how a CRUD application should be
built. But while it is opinionated, it also tries to make sure that its opinion is just a
starting point you can easily change. Angular comes with the following out-of-the-box:
well-defined structure. This makes Angular opinionated about how a CRUD (Create, Read, Update, Delete)
application should be built. But while it is opinionated, it also tries to make sure that its opinion
is just a starting point you can easily change. Angular comes with the following out-of-the-box:
* Everything you need to build a CRUD app in a cohesive set: data-binding, basic templating
directives, form validation, routing, deep-linking, reusable components, dependency injection.
* Testability story: unit-testing, end-to-end testing, mocks, test harnesses.
* Everything you need to build a CRUD app in a cohesive set: Data-binding, basic templating
directives, form validation, routing, deep-linking, reusable components and dependency injection.
* Testability story: Unit-testing, end-to-end testing, mocks and test harnesses.
* Seed application with directory layout and test scripts as a starting point.
## Angular Sweet Spot
## Angular's sweet spot
Angular simplifies application development by presenting a higher level of abstraction to the
developer. Like any abstraction, it comes at a cost of flexibility. In other words not every app
developer. Like any abstraction, it comes at a cost of flexibility. In other words, not every app
is a good fit for Angular. Angular was built with the CRUD application in mind. Luckily CRUD
applications represent the majority of web applications. To understand what Angular is
good at, though, it helps to understand when an app is not a good fit for Angular.
@@ -78,7 +78,7 @@ expressing business logic.
* It is an excellent idea to decouple the client side of an app from the server side. This
allows development work to progress in parallel, and allows for reuse of both sides.
* It is very helpful indeed if the framework guides developers through the entire journey of
building an app: from designing the UI, through writing the business logic, to testing.
building an app: From designing the UI, through writing the business logic, to testing.
* It is always good to make common tasks trivial and difficult tasks possible.
+298 -146
View File
@@ -15,28 +15,106 @@ which drives many of these changes.
# Migrating from 1.2 to 1.3
- **$parse:**
- due to [77ada4c8](https://github.com/angular/angular.js/commit/77ada4c82d6b8fc6d977c26f3cdb48c2f5fbe5a5),
## Controllers
Due to [3f2232b5](https://github.com/angular/angular.js/commit/3f2232b5a181512fac23775b1df4a6ebda67d018),
`$controller` will no longer look for controllers on `window`.
The old behavior of looking on `window` for controllers was originally intended
for use in examples, demos, and toy apps. We found that allowing global controller
functions encouraged poor practices, so we resolved to disable this behavior by
default.
To migrate, register your controllers with modules rather than exposing them
as globals:
Before:
```javascript
function MyController() {
// ...
}
```
After:
```javascript
angular.module('myApp', []).controller('MyController', [function() {
// ...
}]);
```
Although it's not recommended, you can re-enable the old behavior like this:
```javascript
angular.module('myModule').config(['$controllerProvider', function($controllerProvider) {
// this option might be handy for migrating old apps, but please don't use it
// in new ones!
$controllerProvider.allowGlobals();
}]);
```
## Angular Expression Parsing (`$parse` + `$interpolate`)
- due to [77ada4c8](https://github.com/angular/angular.js/commit/77ada4c82d6b8fc6d977c26f3cdb48c2f5fbe5a5),
You can no longer invoke .bind, .call or .apply on a function in angular expressions.
This is to disallow changing the behaviour of existing functions
in an unforseen fashion.
in an unforeseen fashion.
- due to [6081f207](https://github.com/angular/angular.js/commit/6081f20769e64a800ee8075c168412b21f026d99),
The (deprecated) __proto__ propery does not work inside angular expressions
The (deprecated) __proto__ property does not work inside angular expressions
anymore.
- due to [48fa3aad](https://github.com/angular/angular.js/commit/48fa3aadd546036c7e69f71046f659ab1de244c6),
- due to [48fa3aad](https://github.com/angular/angular.js/commit/48fa3aadd546036c7e69f71046f659ab1de244c6),
This prevents the use of __{define,lookup}{Getter,Setter}__ inside angular
expressions. If you really need them for some reason, please wrap/bind them to make them
less dangerous, then make them available through the scope object.
- due to [528be29d](https://github.com/angular/angular.js/commit/528be29d1662122a34e204dd607e1c0bd9c16bbc),
- due to [528be29d](https://github.com/angular/angular.js/commit/528be29d1662122a34e204dd607e1c0bd9c16bbc),
This prevents the use of `Object` inside angular expressions.
If you need Object.keys, make it accessible in the scope.
- **Angular.copy:** due to [b59b04f9](https://github.com/angular/angular.js/commit/b59b04f98a0b59eead53f6a53391ce1bbcbe9b57),
- due to [bdfc9c02](https://github.com/angular/angular.js/commit/bdfc9c02d021e08babfbc966a007c71b4946d69d),
values 'f', '0', 'false', 'no', 'n', '[]' are no longer
treated as falsy. Only JavaScript falsy values are now treated as falsy by the
expression parser; there are six of them: false, null, undefined, NaN, 0 and "".
- due to [fa6e411d](https://github.com/angular/angular.js/commit/fa6e411da26824a5bae55f37ce7dbb859653276d),
promise unwrapping has been removed. It has been deprecated since 1.2.0-rc.3.
It can no longer be turned on.
Two methods have been removed:
* `$parseProvider.unwrapPromises`
* `$parseProvider.logPromiseWarnings`
- **$interpolate:** due to [88c2193c](https://github.com/angular/angular.js/commit/88c2193c71954b9e7e7e4bdf636a2b168d36300d),
the function returned by `$interpolate`
no longer has a `.parts` array set on it.
Instead it has two arrays:
* `.expressions`, an array of the expressions in the
interpolated text. The expressions are parsed with
`$parse`, with an extra layer converting them to strings
when computed
* `.separators`, an array of strings representing the
separations between interpolations in the text.
This array is **always** 1 item longer than the
`.expressions` array for easy merging with it
## Miscellaneous Angular helpers
- **Angular.copy:** due to [b59b04f9](https://github.com/angular/angular.js/commit/b59b04f98a0b59eead53f6a53391ce1bbcbe9b57),
This changes `angular.copy` so that it applies the prototype of the original
object to the copied object. Previously, `angular.copy` would copy properties
of the original object's prototype chain directly onto the copied object.
@@ -53,17 +131,54 @@ not filter them with `hasOwnProperty`.
**Be aware that this change also uses a feature that is not compatible with
IE8.** If you need this to work on IE8 then you would need to provide a polyfill
for `Object.create` and `Object.getPrototypeOf`.
- **core:** due to [bdfc9c02](https://github.com/angular/angular.js/commit/bdfc9c02d021e08babfbc966a007c71b4946d69d),
values 'f', '0', 'false', 'no', 'n', '[]' are no longer
treated as falsy. Only JavaScript falsy values are now treated as falsy by the
expression parser; there are six of them: false, null, undefined, NaN, 0 and "".
Closes #3969
Closes #4277
Closes #7960
- **$compile:** due to [2cde927e](https://github.com/angular/angular.js/commit/2cde927e58c8d1588569d94a797e43cdfbcedaf9),
- **forEach:** due to [55991e33](https://github.com/angular/angular.js/commit/55991e33af6fece07ea347a059da061b76fc95f5),
forEach will iterate only over the initial number of items in
the array. So if items are added to the array during the iteration, these won't
be iterated over during the initial forEach call.
This change also makes our forEach behave more like Array#forEach.
- **angular.toJson:** due to [c054288c](https://github.com/angular/angular.js/commit/c054288c9722875e3595e6e6162193e0fb67a251),
If you expected `toJson` to strip these types of properties before, you will have to
manually do this yourself now.
## jqLite / JQuery
- **jqLite:** due to [a196c8bc](https://github.com/angular/angular.js/commit/a196c8bca82a28c08896d31f1863cf4ecd11401c),
previously it was possible to set jqLite data on Text/Comment
nodes, but now that is allowed only on Element and Document nodes just like in
jQuery. We don't expect that app code actually depends on this accidental feature.
- **jqLite:** due to [d71dbb1a](https://github.com/angular/angular.js/commit/d71dbb1ae50f174680533492ce4c7db3ff74df00),
the jQuery `detach()` method does not trigger the `$destroy` event.
If you want to destroy Angular data attached to the element, use `remove()`.
## Angular HTML Compiler (`$compile`)
- due to [2ee29c5d](https://github.com/angular/angular.js/commit/2ee29c5da81ffacdc1cabb438f5d125d5e116cb9),
The isolated scope of a component directive no longer leaks into the template
that contains the instance of the directive. This means that you can no longer
access the isolated scope from attributes on the element where the isolated
directive is defined.
See https://github.com/angular/angular.js/issues/10236 for an example.
- due to [2cde927e](https://github.com/angular/angular.js/commit/2cde927e58c8d1588569d94a797e43cdfbcedaf9),
Requesting isolate scope and any other scope on a single element is an error.
@@ -77,9 +192,50 @@ If you find that your code is now throwing a `$compile:multidir` error,
check that you do not have directives on the same element that are trying
to request both an isolate and a non-isolate scope and fix your code.
Closes #4402
Closes #4421
- **NgModel:** due to [1be9bb9d](https://github.com/angular/angular.js/commit/1be9bb9d3527e0758350c4f7417a4228d8571440),
- due to [eec6394a](https://github.com/angular/angular.js/commit/eec6394a342fb92fba5270eee11c83f1d895e9fb), The `replace` flag for defining directives that
replace the element that they are on will be removed in the next major angular version.
This feature has difficult semantics (e.g. how attributes are merged) and leads to more
problems compared to what it solves. Also, with Web Components it is normal to have
custom elements in the DOM.
- due to [299b220f](https://github.com/angular/angular.js/commit/299b220f5e05e1d4e26bfd58d0b2fd7329ca76b1),
calling `attr.$observe` no longer returns the observer function, but a
deregistration function instead. To migrate the code follow the example below:
Before:
directive('directiveName', function() {
return {
link: function(scope, elm, attr) {
var observer = attr.$observe('someAttr', function(value) {
console.log(value);
});
}
};
});
After:
directive('directiveName', function() {
return {
link: function(scope, elm, attr) {
var observer = function(value) {
console.log(value);
};
attr.$observe('someAttr', observer);
}
};
});
## Forms, Inputs and ngModel
- due to [1be9bb9d](https://github.com/angular/angular.js/commit/1be9bb9d3527e0758350c4f7417a4228d8571440),
If an expression is used on ng-pattern (such as `ng-pattern="exp"`) or on the
@@ -95,45 +251,70 @@ this limitation, use a regular expression object as the value for the expression
//after
$scope.exp = /abc/i;
- **Scope:** due to [8c6a8171](https://github.com/angular/angular.js/commit/8c6a8171f9bdaa5cdabc0cc3f7d3ce10af7b434d),
- **ngModelOptions:** due to [adfc322b](https://github.com/angular/angular.js/commit/adfc322b04a58158fb9697e5b99aab9ca63c80bb),
This commit changes the API on `NgModelController`, both semantically and
in terms of adding and renaming methods.
* `$setViewValue(value)` -
This method still changes the `$viewValue` but does not immediately commit this
change through to the `$modelValue` as it did previously.
Now the value is committed only when a trigger specified in an associated
`ngModelOptions` directive occurs. If `ngModelOptions` also has a `debounce` delay
specified for the trigger then the change will also be debounced before being
committed.
In most cases this should not have a significant impact on how `NgModelController`
is used: If `updateOn` includes `default` then `$setViewValue` will trigger
a (potentially debounced) commit immediately.
* `$cancelUpdate()` - is renamed to `$rollbackViewValue()` and has the same meaning,
which is to revert the current `$viewValue` back to the `$lastCommittedViewValue`,
to cancel any pending debounced updates and to re-render the input.
To migrate code that used `$cancelUpdate()` follow the example below:
Before:
```js
$scope.resetWithCancel = function (e) {
if (e.keyCode == 27) {
$scope.myForm.myInput1.$cancelUpdate();
$scope.myValue = '';
}
};
```
After:
```js
$scope.resetWithCancel = function (e) {
if (e.keyCode == 27) {
$scope.myForm.myInput1.$rollbackViewValue();
$scope.myValue = '';
}
}
```
- types date, time, datetime-local, month, week now always
require a `Date` object as model ([46bd6dc8](https://github.com/angular/angular.js/commit/46bd6dc88de252886d75426efc2ce8107a5134e9),
[#5864](https://github.com/angular/angular.js/issues/5864))
## Scopes and Digests (`$scope`)
- due to [8c6a8171](https://github.com/angular/angular.js/commit/8c6a8171f9bdaa5cdabc0cc3f7d3ce10af7b434d),
Scope#$id is now of type number rather than string. Since the
id is primarily being used for debugging purposes this change should not affect
anyone.
- **forEach:** due to [55991e33](https://github.com/angular/angular.js/commit/55991e33af6fece07ea347a059da061b76fc95f5),
forEach will iterate only over the initial number of items in
the array. So if items are added to the array during the iteration, these won't
be iterated over during the initial forEach call.
This change also makes our forEach behave more like Array#forEach.
- **jqLite:** due to [a196c8bc](https://github.com/angular/angular.js/commit/a196c8bca82a28c08896d31f1863cf4ecd11401c),
previously it was possible to set jqLite data on Text/Comment
nodes, but now that is allowed only on Element and Document nodes just like in
jQuery. We don't expect that app code actually depends on this accidental feature.
- **$resource:** due to [d3c50c84](https://github.com/angular/angular.js/commit/d3c50c845671f0f8bcc3f7842df9e2fb1d1b1c40),
If you expected `$resource` to strip these types of properties before,
you will have to manually do this yourself now.
- **angular.toJson:** due to [c054288c](https://github.com/angular/angular.js/commit/c054288c9722875e3595e6e6162193e0fb67a251),
If you expected `toJson` to strip these types of properties before,
you will have to manually do this yourself now.
- **$compile:** due to [eec6394a](https://github.com/angular/angular.js/commit/eec6394a342fb92fba5270eee11c83f1d895e9fb), The `replace` flag for defining directives that
replace the element that they are on will be removed in the next major angular version.
This feature has difficult semantics (e.g. how attributes are merged) and leads to more
problems compared to what it solves. Also, with Web Components it is normal to have
custom elements in the DOM.
- **$parse:** due to [fa6e411d](https://github.com/angular/angular.js/commit/fa6e411da26824a5bae55f37ce7dbb859653276d),
promise unwrapping has been removed. It has been deprecated since 1.2.0-rc.3.
It can no longer be turned on.
Two methods have been removed:
* `$parseProvider.unwrapPromises`
* `$parseProvider.logPromiseWarnings`
- **Scope:** due to [82f45aee](https://github.com/angular/angular.js/commit/82f45aee5bd84d1cc53fb2e8f645d2263cdaacbc),
- due to [82f45aee](https://github.com/angular/angular.js/commit/82f45aee5bd84d1cc53fb2e8f645d2263cdaacbc),
[#7445](https://github.com/angular/angular.js/issues/7445),
[#7523](https://github.com/angular/angular.js/issues/7523)
`$broadcast` and `$emit` will now reset the `currentScope` property of the event to
@@ -141,11 +322,11 @@ jQuery. We don't expect that app code actually depends on this accidental featur
`currentScope` property, it should be migrated to use `targetScope` instead. All of these cases
should be considered programming bugs.
- **jqLite:** due to [d71dbb1a](https://github.com/angular/angular.js/commit/d71dbb1ae50f174680533492ce4c7db3ff74df00),
the jQuery `detach()` method does not trigger the `$destroy` event.
If you want to destroy Angular data attached to the element, use `remove()`.
## Server Requests (`$http`, `$resource`)
- **$http:** due to [ad4336f9](https://github.com/angular/angular.js/commit/ad4336f9359a073e272930f8f9bcd36587a8648f),
@@ -197,7 +378,24 @@ More details on the new interceptors API (which has been around as of v1.1.4) ca
{@link $http#interceptors interceptors}
- **injector:** due to [c0b4e2db](https://github.com/angular/angular.js/commit/c0b4e2db9cbc8bc3164cedc4646145d3ab72536e),
- **$httpBackend:** due to [6680b7b9](https://github.com/angular/angular.js/commit/6680b7b97c0326a80bdccaf0a35031e4af641e0e), the JSONP behavior for erroneous and empty responses changed:
Previously, a JSONP response was regarded as erroneous if it was empty. Now Angular is listening to the
correct events to detect errors, i.e. even empty responses can be successful.
- **$resource:** due to [d3c50c84](https://github.com/angular/angular.js/commit/d3c50c845671f0f8bcc3f7842df9e2fb1d1b1c40),
If you expected `$resource` to strip these types of properties before,
you will have to manually do this yourself now.
## Modules and Injector (`$inject`)
- due to [c0b4e2db](https://github.com/angular/angular.js/commit/c0b4e2db9cbc8bc3164cedc4646145d3ab72536e),
Previously, config blocks would be able to control behaviour of provider registration, due to being
invoked prior to provider registration. Now, provider registration always occurs prior to configuration
@@ -234,66 +432,13 @@ and "$dependentProvider" would have actually accomplished something and changed
app. This is no longer possible within a single module.
- **ngModelOptions:** due to [adfc322b](https://github.com/angular/angular.js/commit/adfc322b04a58158fb9697e5b99aab9ca63c80bb),
This commit changes the API on `NgModelController`, both semantically and
in terms of adding and renaming methods.
* `$setViewValue(value)` -
This method still changes the `$viewValue` but does not immediately commit this
change through to the `$modelValue` as it did previously.
Now the value is committed only when a trigger specified in an associated
`ngModelOptions` directive occurs. If `ngModelOptions` also has a `debounce` delay
specified for the trigger then the change will also be debounced before being
committed.
In most cases this should not have a significant impact on how `NgModelController`
is used: If `updateOn` includes `default` then `$setViewValue` will trigger
a (potentially debounced) commit immediately.
* `$cancelUpdate()` - is renamed to `$rollbackViewValue()` and has the same meaning,
which is to revert the current `$viewValue` back to the `$lastCommittedViewValue`,
to cancel any pending debounced updates and to re-render the input.
To migrate code that used `$cancelUpdate()` follow the example below:
Before:
```js
$scope.resetWithCancel = function (e) {
if (e.keyCode == 27) {
$scope.myForm.myInput1.$cancelUpdate();
$scope.myValue = '';
}
};
```
After:
```js
$scope.resetWithCancel = function (e) {
if (e.keyCode == 27) {
$scope.myForm.myInput1.$rollbackViewValue();
$scope.myValue = '';
}
}
```
- **$interpolate:** due to [88c2193c](https://github.com/angular/angular.js/commit/88c2193c71954b9e7e7e4bdf636a2b168d36300d),
the function returned by `$interpolate`
no longer has a `.parts` array set on it.
Instead it has two arrays:
* `.expressions`, an array of the expressions in the
interpolated text. The expressions are parsed with
`$parse`, with an extra layer converting them to strings
when computed
* `.separators`, an array of strings representing the
separations between interpolations in the text.
This array is **always** 1 item longer than the
`.expressions` array for easy merging with it
## Animation (`ngAnimate`)
- **$animate:** due to [1cb8584e](https://github.com/angular/angular.js/commit/1cb8584e8490ecdb1b410a8846c4478c6c2c0e53),
- due to [1cb8584e](https://github.com/angular/angular.js/commit/1cb8584e8490ecdb1b410a8846c4478c6c2c0e53),
`$animate` will no longer default the after parameter to the last element of the parent
container. Instead, when after is not specified, the new element will be inserted as the
first child of the parent container.
@@ -308,7 +453,7 @@ to:
- **$animate:** due to [1bebe36a](https://github.com/angular/angular.js/commit/1bebe36aa938890d61188762ed618b1b5e193634),
- due to [1bebe36a](https://github.com/angular/angular.js/commit/1bebe36aa938890d61188762ed618b1b5e193634),
Any class-based animation code that makes use of transitions
and uses the setup CSS classes (such as class-add and class-remove) must now
@@ -343,45 +488,52 @@ After:
Please view the documentation for ngAnimate for more info.
- **$compile:** due to [299b220f](https://github.com/angular/angular.js/commit/299b220f5e05e1d4e26bfd58d0b2fd7329ca76b1),
calling `attr.$observe` no longer returns the observer function, but a
deregistration function instead. To migrate the code follow the example below:
## Testing
- due to [85880a64](https://github.com/angular/angular.js/commit/85880a64900fa22a61feb926bf52de0965332ca5), some deprecated features of
Protractor tests no longer work.
`by.binding(descriptor)` no longer allows using the surrounding interpolation
markers in the descriptor (the default interpolation markers are `{{}}`).
Previously, these were optional.
Before:
directive('directiveName', function() {
return {
link: function(scope, elm, attr) {
var observer = attr.$observe('someAttr', function(value) {
console.log(value);
});
}
};
});
var el = element(by.binding('{{foo}}'));
After:
directive('directiveName', function() {
return {
link: function(scope, elm, attr) {
var observer = function(value) {
console.log(value);
};
var el = element(by.binding('foo'));
attr.$observe('someAttr', observer);
}
};
});
Prefixes `ng_` and `x-ng-` are no longer allowed for models. Use `ng-model`.
- **$httpBackend:** due to [6680b7b9](https://github.com/angular/angular.js/commit/6680b7b97c0326a80bdccaf0a35031e4af641e0e), the JSONP behavior for erroneous and empty responses changed:
Previously, a JSONP response was regarded as erroneous if it was empty. Now Angular is listening to the
correct events to detect errors, i.e. even empty responses can be successful.
`by.repeater` cannot find elements by row and column which are not children of
the row. For example, if your template is
- **build:** due to [eaa1d00b](https://github.com/angular/angular.js/commit/eaa1d00b24008f590b95ad099241b4003688cdda),
<div ng-repeat="foo in foos">{{foo.name}}</div>
Before:
var el = element(by.repeater('foo in foos').row(2).column('foo.name'))
After:
You may either enclose `{{foo.name}}` in a child element
<div ng-repeat="foo in foos"><span>{{foo.name}}</span></div>
or simply use:
var el = element(by.repeater('foo in foos').row(2))
## Internet Explorer 8
- due to [eaa1d00b](https://github.com/angular/angular.js/commit/eaa1d00b24008f590b95ad099241b4003688cdda),
As communicated before, IE8 is no longer supported.
- **input:** types date, time, datetime-local, month, week now always
require a `Date` object as model ([46bd6dc8](https://github.com/angular/angular.js/commit/46bd6dc88de252886d75426efc2ce8107a5134e9),
[#5864](https://github.com/angular/angular.js/issues/5864))
@@ -763,7 +915,7 @@ of `$sce.trustAsHtml(string)`. When bound to a plain string, the string is sanit
module is not loaded) and the bound expression evaluates to a value that is not trusted an
exception is thrown.
When using this directive you can either include `ngSanitize` in your module's dependencis (See the
When using this directive you can either include `ngSanitize` in your module's dependencies (See the
example at the {@link ngBindHtml} reference) or use the {@link $sce} service to set the value as
trusted.
@@ -1020,10 +1172,10 @@ freely available to JavaScript code (as before).
Angular expressions execute in a limited context. They do not have
direct access to the global scope, `window`, `document` or the Function
constructor. However, they have direct access to names/properties on
the scope chain. It has been a long standing best practice to keep
constructor. However, they have direct access to names/properties on
the scope chain. It has been a long standing best practice to keep
sensitive APIs outside of the scope chain (in a closure or your
controller.) That's easier said that done for two reasons:
controller.) That's easier said than done for two reasons:
1. JavaScript does not have a notion of private properties so if you need
someone on the scope chain for JavaScript use, you also expose it to
+2 -2
View File
@@ -76,7 +76,7 @@ that you break your application to multiple modules like this:
initialization code.
We've also
[written a document](http://blog.angularjs.org/2014/02/an-angularjs-style-guide-and-best.html)
[written a document](http://angularjs.blogspot.com/2014/02/an-angularjs-style-guide-and-best.html)
on how we organize large apps at Google.
The above is a suggestion. Tailor it to your needs.
@@ -140,7 +140,7 @@ The above is a suggestion. Tailor it to your needs.
# Module Loading & Dependencies
A module is a collection of configuration and run blocks which get applied to the application
during the bootstrap process. In its simplest form the module consist of collection of two kinds
during the bootstrap process. In its simplest form the module consist of a collection of two kinds
of blocks:
1. **Configuration blocks** - get executed during the provider registrations and configuration
+37 -5
View File
@@ -10,13 +10,13 @@ There are a few things you might consider when running your AngularJS applicatio
## Disabling Debug Data
By default AngularJS attaches information about scopes to DOM nodes, and adds CSS classes
to data-bound elements. The information that is not included is:
By default AngularJS attaches information about binding and scopes to DOM nodes,
and adds CSS classes to data-bound elements:
As a result of `ngBind`, `ngBindHtml` or `{{...}}` interpolations, binding data and CSS class
`ng-class` is attached to the corresponding element.
- As a result of `ngBind`, `ngBindHtml` or `{{...}}` interpolations, binding data and CSS class
`ng-binding` are attached to the corresponding element.
Where the compiler has created a new scope, the scope and either `ng-scope` or `ng-isolated-scope`
- Where the compiler has created a new scope, the scope and either `ng-scope` or `ng-isolated-scope`
CSS class are attached to the corresponding element. These scope references can then be accessed via
`element.scope()` and `element.isolateScope()`.
@@ -41,3 +41,35 @@ The page should reload and the debug information should now be available.
For more see the docs pages on {@link ng.$compileProvider#debugInfoEnabled `$compileProvider`}
and {@link angular.reloadWithDebugInfo `angular.reloadWithDebugInfo`}.
## Strict DI Mode
Using strict di mode in your production application will throw errors when a injectable
function is not
{@link di#dependency-annotation annotated explicitly}. Strict di mode is intended to help
you make sure that your code will work when minified. However, it also will force you to
make sure that your injectable functions are explicitly annotated which will improve
angular's performance when injecting dependencies in your injectable functions because it
doesn't have to dynamically discover a function's dependencies. It is recommended to
automate the explicit annotation via a tool like
[ng-annotate](https://github.com/olov/ng-annotate) when you deploy to production (and enable
strict di mode)
To enable strict di mode, you have two options:
```html
<div ng-app="myApp" ng-strict-di>
<!-- your app here -->
</div>
```
or
```js
angular.bootstrap(document, ['myApp'], {
strictDi: true
});
```
For more information, see the
{@link di#using-strict-dependency-injection DI Guide}.
+17 -5
View File
@@ -5,7 +5,7 @@
# What are Scopes?
{@link ng.$rootScope.Scope scope} is an object that refers to the application
{@link ng.$rootScope.Scope Scope} is an object that refers to the application
model. It is an execution context for {@link expression expressions}. Scopes are
arranged in hierarchical structure which mimic the DOM structure of the application. Scopes can
watch {@link guide/expression expressions} and propagate events.
@@ -39,7 +39,7 @@ linking} phase the {@link ng.$compileProvider#directive directives} set up
render the updated value to the DOM.
Both controllers and directives have reference to the scope, but not to each other. This
arrangement isolates the controller from the directive as well as from DOM. This is an important
arrangement isolates the controller from the directive as well as from the DOM. This is an important
point since it makes the controllers view agnostic, which greatly improves the testing story of
the applications.
@@ -177,7 +177,7 @@ for example, only a portion of the view needs to be controlled by Angular.
To examine the scope in the debugger:
1. right click on the element of interest in your browser and select 'inspect element'. You
1. Right click on the element of interest in your browser and select 'inspect element'. You
should see the browser debugger with the element you clicked on highlighted.
2. The debugger allows you to access the currently selected element in the console as `$0`
@@ -245,7 +245,7 @@ of the `$watch` expressions and compares them with the previous value. This dirt
asynchronously. This means that assignment such as `$scope.username="angular"` will not
immediately cause a `$watch` to be notified, instead the `$watch` notification is delayed until
the `$digest` phase. This delay is desirable, since it coalesces multiple model updates into one
`$watch` notification as well as it guarantees that during the `$watch` notification no other
`$watch` notification as well as guarantees that during the `$watch` notification no other
`$watch`es are running. If a `$watch` changes the value of the model, it will force additional
`$digest` cycle.
@@ -264,7 +264,7 @@ the `$digest` phase. This delay is desirable, since it coalesces multiple model
3. **Model mutation**
For mutations to be properly observed, you should make them only within the {@link
ng.$rootScope.Scope#$apply scope.$apply()}. (Angular APIs do this
ng.$rootScope.Scope#$apply scope.$apply()}. Angular APIs do this
implicitly, so no extra `$apply` call is needed when doing synchronous work in controllers,
or asynchronous work with {@link ng.$http $http}, {@link ng.$timeout $timeout}
or {@link ng.$interval $interval} services.
@@ -339,6 +339,18 @@ the dirty checking function must be efficient. Care should be taken that the dir
function does not do any DOM access, as DOM access is orders of magnitude slower than property
access on JavaScript object.
### Scope `$watch` Depths
<img class="pull-right" style="padding-left: 3em; padding-bottom: 1em;" src="img/guide/concepts-scope-watch-strategies.png">
Dirty checking can be done with three strategies: By reference, by collection contents, and by value. The strategies differ in the kinds of changes they detect, and in their performance characteristics.
- Watching *by reference* ({@link
ng.$rootScope.Scope#$watch scope.$watch} `(watchExpression, listener)`) detects a change when the whole value returned by the watch expression switches to a new value. If the value is an array or an object, changes inside it are not detected. This is the most efficient strategy.
- Watching *collection contents* ({@link
ng.$rootScope.Scope#$watchCollection scope.$watchCollection} `(watchExpression, listener)`) detects changes that occur inside an array or an object: When items are added, removed, or reordered. The detection is shallow - it does not reach into nested collections. Watching collection contents is more expensive than watching by reference, because copies of the collection contents need to be maintained. However, the strategy attempts to minimize the amount of copying required.
- Watching *by value* ({@link
ng.$rootScope.Scope#$watch scope.$watch} `(watchExpression, listener, true)`) detects any change in an arbitrarily nested data structure. It is the most powerful change detection strategy, but also the most expensive. A full traversal of the nested data structure is needed on each digest, and a full copy of it needs to be held in memory.
## Integration with the browser event loop
<img class="pull-right" style="padding-left: 3em; padding-bottom: 1em;" src="img/guide/concepts-runtime.png">
+60
View File
@@ -0,0 +1,60 @@
@ngdoc overview
@name Security
@sortOrder 525
@description
# Security
This document explains some of AngularJS's security features and best practices that you should
keep in mind as you build your application.
## Expression Sandboxing
AngularJS's expressions are sandboxed not for security reasons, but instead to maintain a proper
separation of application responsibilities. For example, access to `window` is disallowed
because it makes it easy to introduce brittle global state into your application.
However, this sandbox is not intended to stop attackers who can edit the template before it's
processed by Angular. It may be possible to run arbitrary JavaScript inside double-curly bindings
if an attacker can modify them.
But if an attacker can change arbitrary HTML templates, there's nothing stopping them from doing:
```html
<script>somethingEvil();</script>
```
It's better to design your application in such a way that users cannot change client-side templates.
For instance:
* Do not mix client and server templates
* Do not use user input to generate templates dynamically
* Do not run user input through `$scope.$eval`
* Consider using {@link ng.directive:ngCsp CSP} (but don't rely only on CSP)
## Mixing client-side and server-side templates
In general, we recommend against this because it can create unintended XSS vectors.
However, it's ok to mix server-side templating in the bootstrap template (`index.html`) as long
as user input cannot be used on the server to output html that would then be processed by Angular
in a way that would cause allow for arbitrary code execution.
For instance, you can use server-side templating to dynamically generate CSS, URLs, etc, but not
for generating templates that are bootstrapped/compiled by Angular.
## Reporting a security issue
Email us at [security@angularjs.org](mailto:security@angularjs.org) to report any potential
security issues in AngularJS.
Please keep in mind the above points about Angular's expression language.
## See also
* {@link ng.directive:ngCsp Content Security Policy}
* {@link ng.$sce Strict Contextual Escaping}
* {@link ngSanitize.$sanitize $sanitize}

Some files were not shown because too many files have changed in this diff Show More