Compare commits

...

833 Commits

Author SHA1 Message Date
marcysutton 1f5e42e882 feat(ngAria): add option to disable role=button
Closes #11580
Closes #12234
2015-07-02 14:36:49 +03:00
Jeff Cross d193c3a25c revert: "fix($compile): do not write @-bound properties if attribute is not present"
This reverts commit 8a1eb1625c.

This commit broke the tabs component on the material project,
which caused internal breakages. Will open a separate issue to
look into the issue.
2015-07-01 22:12:03 -07:00
Raphael Jamet 4da1cc3b81 refactor($templateRequest): Remove useless dependencies in tests 2015-07-01 12:15:00 -07:00
Raphael Jamet 6de08216e7 docs($templateRequest): update the description with caching changes
The previous changes to $templateRequest were not documented, they now are.
2015-07-01 12:15:00 -07:00
Raphael Jamet 3c6e8ce044 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:14:42 -07:00
Peter Bacon Darwin e51024ed54 docs(ngAnimate): fix typos 2015-06-30 13:19:52 +01:00
Chris Bosco 04f1ebd470 docs(guide/Migrating): $animate.on/off example updated to match docs
Closes #12212
2015-06-30 03:05:05 +01:00
Bart Verkoeijen 2e63ab734a docs(guide/Migrating): add breaking change for 1.4 regarding controller constructors.
If you previously returned a object from a controller constructor function,
it would not be bound to the scope. As of 1.4 it does, and can cause
unexpected objects as the scope.

Closes #12227
2015-06-30 02:59:46 +01:00
Georgios Kalpakas 6333d65b76 fix($compile): throw error when requestng new and isolate scopes (async)
While directives are not allowed to request both a new (normal) and an
isolate scope on the same element, the relevant check was not performed
correctly when the directive requesting the isolate scope had a lower
priority and specified a `templateUrl`.
In that case, the check was deferred until the template was fetched, but
the info about other directives requesting a new (normal) scope was not
properly preserved (in `previousCompileContext`).

This commit fixes this, so now an error is thrown (as expected).

Fixes #12215
Closes #12217
2015-06-28 11:33:06 +03:00
Yichao Wang 1ce5d216c7 docs(ngAnimate): fix typos in JS and CSS selector
Closes #12203
2015-06-25 12:42:17 +03:00
Georgios Kalpakas 28c166939e test($compile): test default value for optional attribute with new scope
Related to #12151
Closes #12194
2015-06-24 10:25:55 +02:00
Peter Bacon Darwin 14638f4a60 fix(ngOptions): only watch numeric properties of an array
It turns out that the options that are displayed are more constrained than
just whether the property starts with a $ character.
If the values collection is array-like then we only display the options that
are identified by numerical properties - it's an array right?

So this commit aligns `getWatchables` with `getOptions`.

See #12010
2015-06-23 17:47:34 -07:00
Peter Bacon Darwin 0c1fbdd242 chore(doc-gen): update to dgeni-packages 0.10.17
Make proper use of the new `git` package in dgeni-packages
2015-06-23 04:41:45 -07:00
Martin Staffa 33f7f26558 docs(ngChecked): note that it shouldn't be used with ngModel
Closes #11106
2015-06-22 23:39:08 +02:00
Martin Staffa e27eed3ca4 docs(ngCookies): improve deprecation notice 2015-06-22 23:37:50 +02:00
Gabriel Monteagudo 6cbbd96647 fix(merge): treat dates as atomic values instead of objects.
Makes angular.merge copy dates correctly.

Closes #11720

Closes #11720
2015-06-22 21:21:09 +02:00
Phil Brown d0cb69348e docs($http): set correct link to XMLHttpRequest.responseType
The link to MDN XMLHttpRequest.responseType was incorrect.

Closes #12183
2015-06-22 18:51:46 +02:00
Jandalf f15f8df2b4 docs($httpProvider): typo fix
fix a typo:
default.cache -> defaults.cache
2015-06-21 14:07:13 +02:00
Peter Bacon Darwin e7662ebc31 docs(directives): add multiElement tag to appropriate directives
Closes #11104
2015-06-21 01:52:01 +01:00
Peter Bacon Darwin 8ceed4faf3 chore(dependencies): update to dgeni-packages 0.10.15
Closes #11104
Closes #11418
2015-06-21 01:51:31 +01:00
Tsuyoshi Yoshizawa 6903b5ec4c 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:40:28 +01:00
Peter Bacon Darwin 48e1f5605e fix(orderBy): ensure correct ordering with arrays of objects and no predicate
By refactoring to use a Schwartzian transform, we can ensure that objects
with no custom `toString` or `toValue` methods are just ordered using
their position in the original collection.

Closes #11866
Closes #11312
Closes #4282
2015-06-18 08:36:16 +01:00
Peter Bacon Darwin c5a3d8fc5f refact(filter): move hasCustomToString into shared namespace to be reused 2015-06-18 08:33:28 +01:00
Martin Staffa c61149213b docs(CHANGELOG): fix position for some entries in 1.4.1 2015-06-17 23:57:54 +02:00
Stéphane Campinas ad7200e2c2 docs(tutorial/Tutorial): add missing word
Closes #12147
2015-06-17 21:19:02 +02:00
Alfonso Presa bea74c0f56 docs(ngTouch): Document event parameter for $swipe handlers
Document that the event handlers provided by $swipe do receive the raw
event as their last parameter.

Closes #11983

Closes #12149
2015-06-17 21:17:33 +02:00
Martin Staffa bacc3b7e0e docs(tutorial): make docTutorialReset use a button
It's confusing to have it look like a link that goes to the homepage

Closes #1473
2015-06-17 21:14:39 +02:00
Caitlin Potter 8a1eb1625c fix($compile): do not write @-bound properties if attribute is not present
Shadows only when attributes are non-optional and not own properties,
only stores the observed '@' values when they are indeed strings.

Partial revert of 6339d30d1379689da5eec9647a953f64821f8b0

Closes #12151
Closes #12144
2015-06-17 17:40:12 +01:00
Peter Bacon Darwin ed27e0ea6a docs(CHANGELOG): fix typo 2015-06-17 14:35:25 +01:00
Peter Bacon Darwin f81ff3beb0 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:01:20 +01:00
Martin Staffa 720012eab6 docs(resource): clarify success callback arguments
Closes #7730
2015-06-16 19:50:42 +02:00
Kent C. Dodds 3adfe5bda9 docs(guide/Unit Testing): add variable declaration to $filter test
The $filter example never declares `$filter` and therefore would add
`$filter` to the global namespace. Add variable declaration.

Closes #12129
2015-06-16 19:12:10 +02:00
Martin Staffa dc0467879d docs(input[radio]): clarify difference between value and ngValue
Closes #7971
2015-06-16 19:11:11 +02:00
Peter Bacon Darwin 528d7f9568 docs(CHANGELOG): add 1.4.1 changes 2015-06-16 14:52:17 +01:00
Georgios Kalpakas 636ce70e47 style(forms): fix indentation in example 2015-06-16 15:34:02 +03:00
Nir Noy 5f5ee0f880 docs(forms): remove redundant call to $scope.$apply()
As of Angular 1.3 `$setViewValue` already calls `$apply` and triggers a
digest cycle, so now there is no need wrapping the `$setViewValue`
function call with `$apply`, which will just trigger an additional digest
cycle.
2015-06-16 13:20:57 +03:00
Thomas Landauer 46b7cf7464 docs(filter): document third argument of predicate function 2015-06-15 20:50:59 +02:00
Martin Staffa 860edee65b docs(changelog): fix typo
Closes #12085
2015-06-15 20:45:28 +02:00
Caitlin Potter ebd0fbba8f fix(forms): parse exponential notation in numberInputType parser
Support parsing numbers in exponential notation, which Number.prototype.toString() returns
for sufficiently high numbers.

Closes #12121
Closes #12122
2015-06-15 08:46:47 -04:00
Rouven Weßling 093416f60f chore(npm): add the license to package.json
This removes a warning when executing npm install.

Closes #12111
2015-06-15 14:17:56 +03:00
Martin Staffa 0400dc9c2a docs($http): expand the param serializer docs
Closes #11745
Closes #12064
2015-06-14 13:36:37 +02:00
Lucas Galfaso 71fc3f4fa0 fix($parse): set null reference properties to undefined
When there is an expression of the form
* true && a.b.c
* true && a()
* true && a()()
* false || a.b.c
* false || a()
* false || a()()

where `a == null`

Closes #12099
2015-06-13 12:38:57 +02:00
Martin Staffa 8caf1802e0 fix(compile): assign ctrl return values correctly for multiple directives
Fixes #12029
Closes #12036
2015-06-12 21:41:55 +02:00
Peter Bacon Darwin 91b602263b 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:35:46 +01:00
Lucas Galfaso 0934b76b72 fix(ngModel): form validation when there is an Object.prototype enumerable value
When adding an Object.prototype enumerable property, this should not be confused
as a form error

Closes #12066
2015-06-11 23:25:08 +02:00
Caitlin Potter 571bee7b2f test($location): ensure mock window can be wrapped by jqLite
Fixin da build

Closes #12086
2015-06-11 12:04:56 -04:00
Peter Bacon Darwin 11055132bf test($locationSpec): refactor and clean up tests 2015-06-11 14:29:13 +01:00
Peter Bacon Darwin 0898b1240b test($logSpec): don't pollute the global namespace with helpers 2015-06-11 13:29:15 +01:00
Conny Sjöblom 8dc09e6dab fix(linky): allow case insensitive scheme detection
Closes #12073
Closes #12073
2015-06-10 14:38:55 +01:00
Lucas Galfaso 799353c75d fix($sanitize): dont not remove tab index property
Closes #8371
Closes #5853
2015-06-10 11:48:00 +02:00
David Link ffac747e84 docs(tutorial/Tutorial): clarify what npm install does
If the reader does not cd into angular-phonecat subdirectory,
npm install will not work.
This comment helps newbies understand npm install is dependent
on a custom project.json file.

Closes #12040
2015-06-09 21:41:12 +02:00
Martin Staffa 998340de7f docs(select): correct workaround for numeric option bc 2015-06-09 21:35:59 +02:00
Georgios Kalpakas 559313652e test($compile): fix test
The fixed test is supposed to test a fix for an IE11 bug/peculiarity that
arises when using a specifically configured MutationObserver on the page
(see #11781 for more info).
The configuration contained a typo (`sublist` instead of `subtree`), which
effectively failed to set up the MutationObserver in a way that would make
the IE11 bug appear.

Closes #12061
2015-06-09 18:29:26 +03:00
Martin Staffa a69251ab55 docs(select): add note about breaking change with numeric values
Closes #12052
2015-06-08 21:15:14 +02:00
David Anderton 7e5248a33f docs(orderBy): correctly is not the right word
The use of correctly implies that Angular is doing something incorrect, however it is that we expect a number passed as a string to be sorted as a number. Angular does not do what we are expecting, although it responds correctly to what we have actually asked - sorting based on the string representation of a number.

Closes #12046
2015-06-08 21:15:10 +02:00
Martin Staffa c210ff5eae docs($compile): correct what gets passed to ctrl argument
Closes #11903
2015-06-08 21:15:07 +02:00
Jason Bedard 9efb0d5ee9 perf($compile): avoid jquery data calls when there is no data 2015-06-08 12:16:09 +02:00
Jason Bedard 0e622f7b5b fix(copy): do not copy the same object twice 2015-06-08 12:12:56 +02:00
Martin Staffa 071be60927 docs($animateCss): fix a dangling link 2015-06-06 14:45:01 +02:00
Martin Staffa a25aa5b577 docs(input[number]): mention incompatibility with allowInvalid
Closes #11390
2015-06-06 14:44:56 +02:00
Josh Sherick df9c720d08 docs(tutorial/step0): display list correctly
Two bullet points were indented causing the entire lines
to be formatted as code by markdown.
Decreased indentation level by one, as it seems this was not the intention.

Closes #12035
2015-06-06 14:44:52 +02:00
Will Fong 4fe141f794 docs(tutorial/index): add a "next step" sentence
All the other pages have a "continue to next page" link
at the bottom of the page. Keeps a nice reading flow.

Closes #12038
2015-06-06 14:44:28 +02:00
Lucas Galfaso f3b1d0b723 fix($compile): workaround for IE11 MutationObserver
IE11 MutationObserver breaks consecutive text nodes into several text nodes.
This patch merges consecutive text nodes into a single node before
looking for interpolations.

Closes #11781
2015-06-06 11:26:40 +02:00
qbzzt 288225b080 docs(ngClass): add class 'has-error' to demonstrate hyphen use
Modify the example, to show that, when using `ngClass`'s map syntax,
hyphenated classes (e.h. such as those used by Bootstrap) must be enclosed
in quotes.

Closes #12027
2015-06-06 01:34:31 +03:00
Matias Niemelä e967abcd30 docs(CHANGELOG): add changes for 1.3.16 2015-06-05 13:40:38 -07:00
Igor Minar 2c3cd8126c docs(http): add info about unique cookies and XSRF protection on shared domains
Closes #12028
2015-06-04 22:15:55 -07:00
Martin Staffa 41385f0afc docs(*): improve accessibility of links
Closes #7932
2015-06-04 23:00:43 +02:00
Martin Staffa 500b0f6cdb docs(guide/expressions): include filters in one-time binding examples
Closes #8776
2015-06-04 23:00:40 +02:00
Allan Bogh 40b27280ab docs(ngAria): clarify which module to include for ngAria
Closes #11802
2015-06-04 23:00:37 +02:00
Kevin Huang b73c64e2fb docs(guide/Conceptual Overview): remove text from in-page anchor tags
The in-page anchor tags that serve as bookmarks for information about views and models have
visible text content that unintentionally makes them seem like clickable links navigating to
other parts of the page or to entirely different pages.

Closes #11450
2015-06-04 23:00:34 +02:00
fahdsheikh 2f5d42ec72 docs(changelog): fixed grammatical error
Changed "a animation" to "an animation" for grammatical consistency

Closes #11672
2015-06-04 23:00:31 +02:00
Georgios Kalpakas 25d731e9b0 docs(orderBy): fix JSCS trailing whitespace error 2015-06-04 10:55:07 +03:00
Robert Jenks 15da7cc3dc docs(orderBy): improve sorting behaviour and move logic into the controller
Improve the sorting behaviour in the 2nd example: Clicking on an unsorted
column sorts in ascending order, while clicking on a sorted column sorts
in descending order. Also, add a simple sort indicator.

Closes #11981
2015-06-04 10:11:16 +03:00
Peter Bacon Darwin 34a6da24c1 fix(ngOptions): do not watch properties starting with $
Expressions that compute labels and track by values for ngOptions were
being called for properties, that start with $ even though those properties
were being ignored as options.

Closes #11930
Closes #12010
2015-06-04 06:28:00 +01:00
Georgios Kalpakas ebaa0f5985 fix(ngAria): update aria-valuemin/max when min/max change
As a result of thi fix, `ngMin/Max` also set `aria-valuemin/max` on
"range"-shaped elements.

Fixes #11770

Closes #11774
2015-06-03 21:23:38 +02:00
Dominick bb15d414c6 docs(guide/Modules): simple grammar fix
the module consist of… --> the module consists of…

Closes #11843
2015-06-03 21:07:46 +02:00
Dominick f056036a4a docs(guide/security): remove errant word
Closes #11870
2015-06-03 21:06:44 +02:00
Dominick a055762027 docs(guide/i18n): grammar fix
contraction "it's" --> possessive "its"
2015-06-03 21:06:19 +02:00
Dominick 82d38e4453 docs(guide/Using $location): format parameter name
Format parameter name as code. (It's used elsewhere in this doc page in code examples, as code itself.)
2015-06-03 21:04:13 +02:00
Steve Mao 6a743f0b5b docs(ngModelOptions): make object notation style consistent
There is a space before and after `{` and `}` for most of the objects throughout the docs.

Closes #11871
2015-06-03 21:03:16 +02:00
shoja 31f6f76291 docs($httpBackend): correct typo
docs($httpBackend): correct typo

Correct "send" to "sent".

Closes #11876
2015-06-03 21:02:50 +02:00
David Eriksson a2b5a5ed5f docs($cookiesProvider): escape HTML
Escape the "base" HTML element so it will be displayed in the online documentation.

Closes #11897
2015-06-03 21:01:47 +02:00
Boris Cherny 1d41e8a975 docs(ngRepeat): document that track by must be the last expression
this is a point of confusion that's not well documented. see #5520

Closes #11934
2015-06-03 20:57:56 +02:00
Pascal Precht 01182dfbb8 docs(ngMessages): fixes logical bug
The paragraph below this changes says:

"Then the `required` message will be displayed first."

`required` needs to be `true` to match that sentence.

Closes #12009
2015-06-03 19:59:26 +02:00
Yuriy Bash e17f85cc5b docs(ngMessages): fix spelling error
Closes #12019
2015-06-03 19:56:51 +02:00
Steven Easter d7dc14dc0c fix(ngOptions): use reference check only when not using trackBy
Change the check on changed value for ngOptions to ensure that a reference check is only done
when trackBy is not used.  Previously, if trackBy was being used but the values of the objects were
equal a reference check was then used which would cause the check to be true if the objects had
different memory references but the values were equal.  This can cause issues with forms being
marked dirty when the value of the model as not actually changed.

Closes #11936
Closes #11996
2015-06-02 12:37:33 +01:00
Henry Zhu 578fa019b3 chore(jscs): remove .jscs.json.todo, rename config to .jscsrc
Closes #11993
2015-06-02 10:29:54 +01:00
Michal Miszczyszyn 3c9096efb4 test(ngAria): test that aria-hidden/disabled are always "true" or "false"
Previously, when using ngAria with the ng-hide directive,
and the value passed to ng-hide was not boolean,
the aria-hidden attribute was set to this non-boolean value.

Closes #11865
Closes #11998
2015-06-01 23:13:22 +02:00
Fred Sauer 59273354b5 fix(ngAria): ensure boolean values for aria-hidden and aria-disabled
aria-hidden should mirror the boolean representation of their ng-*
counterpart (ng-show, ng-hide) instead of their actual value. Same
applies to aria-disabled and ng-disabled

Closes #11365
2015-06-01 23:13:21 +02:00
Xavier Haniquaut f67204794e docs(migration): fix minor typo
Closes #11994
2015-06-01 21:51:47 +01:00
Wenhua Zhao b6389eedda chore(injector): avoid invoking noop 2015-06-01 11:48:36 +02:00
Ran Ding a6339d30d1 fix($compile): exception when using "watch" as isolated scope binding variable in Firefox
Fix on all binding modes: '=', '@' and '&' as well as optional cases
Throw exception when user define 'hasOwnProperty' in binding.

Closes #11627
2015-06-01 11:36:18 +02:00
Vladimir Lugovsky 351fe4b79c feat($compile): show module name during multidir error
Show module name if possible when multidir error happens.

Closes #11775
2015-06-01 11:08:27 +02:00
Lucas Galfaso d19504a179 fix($parse): set null reference properties to undefined
When there is an expression of the form `true && a.b` and where `a == null`, then set
the value of `true && a.b` to `undefined`.

Closes #11959
2015-06-01 11:03:12 +02:00
Jeff Lee e5e871fe1a docs(ngAnimate): fix typo
Closes #11957
2015-06-01 08:03:20 +01:00
Ron Tsui 90fa884f94 docs(README): improve unusual phrasing
Closes #11958
2015-06-01 08:01:26 +01:00
Yi EungJun 80b9018f29 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:05 +01:00
Daniel f6ac226c8b 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:55:37 +01:00
Michael Watts 2d22380873 docs(guide/Scopes): capitalisation of word scope
Closes #11970
2015-06-01 07:50:12 +01:00
Peter Bacon Darwin 7c49d9986f docs(README.closure.md): clarify sentence
Closes #11979
2015-06-01 07:48:21 +01:00
pholly 209f4f3e0f 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:22 +01:00
Tero Parviainen 5d68c763e2 refactor($compile): remove unused elementTransclusion argument
Remove the unused elementTransclusion argument from createBoundTranscludeFn.
Also remove the nodeLinkFn.elementTranscludeOnThisElement attribute, which
becomes unnecessary.

Closes #9962
Closes #11985
2015-06-01 07:36:36 +01:00
Ryan Dale 3ef529806f feat($q): $q.resolve as an alias for $q.when
New "when" alias "resolve" to maintain naming consistency with ES6.

Closes #11944
Closes #11987
2015-06-01 07:31:51 +01:00
Matias Niemelä 291d7c467f docs(CHANGELOG): add changes for 1.4.0 2015-05-26 17:34:50 -07:00
Matias Niemelä db246eb701 fix(ngAnimate): close follow-up class-based animations when the same class is added/removed when removed/added
This patch ensures that if the same CSS class is added/removed within a
follow-up digest then the previous class-based animation is cancelled
beforehand.

Closes #11717
2015-05-26 14:22:20 -07:00
Matias Niemelä 72edd4dff9 fix($animate): ignore invalid option parameter values
Prior to this fix there was another patch that threw an exception if the
provided options value was not of an object type. While this is correct
in terms of logic, it caused issues with plugins and tools that are
designed to work with multiple version of Angular. This fix ensures that
these plugins work since an invalid options value is ignored by
`$animate`.

Closes #11826
2015-05-26 14:19:38 -07:00
Peter Bacon Darwin 0fc58516f4 test(matchers): fix "not" string for toHaveClass matcher 2015-05-23 19:51:21 +01:00
Matias Niemelä e0e1b52087 fix($animateCss): ensure that custom durations do not confuse the gcs cache
Closes #11723
Closes #11852
2015-05-23 19:51:21 +01:00
Matias Niemelä 462f444b06 revert: fix(ngAnimate): throw an error if a callback is passed to animate methods
This reverts commit 9bb4d6ccbe.
2015-05-22 13:48:48 -07:00
Georgios Kalpakas 19ec9936fe docs(ngPattern): add note about using the g flag
Add a note to point out that using the `g` flag on the validation RegExp,
will cause each search to start at the index of the last search's match,
thus not taking the whole input value into account.

Closes #11917
Closes #11928
2015-05-22 22:20:07 +03:00
Matias Niemelä 213c2a7032 fix(ngAnimate): ensure nested class-based animations are spaced out with a RAF
Prior to this fix any nested class-based animations (animations that are
triggered with addClass/removeClass or ngClass) would cancel each other
out when nested in DOM structure. This fix ensures that the nested
animations are spaced out with sequenced RAFs so that parent CSS classes
are applied prior to any ancestor animations that are scheduled to run.

Closes #11812
2015-05-21 14:44:53 -07:00
Julie Ralph 3545abfc31 chore(test): update protractor to 2.1 2015-05-21 12:21:21 -07:00
Matias Niemelä 3a3db690a1 fix(ngAnimate): class-based animations must not set addClass/removeClass CSS classes on the element
With the abstraction system that ngAnimate uses, $animateCss internally
sets the provided `event` as a CSS class on the element. In this
situation the `addClass` and `removeClass` events on the element as a
CSS class. This should not happen with class-based animations and this
feature is unnecessary and has now been removed.

Closes #11810
2015-05-20 20:41:39 -07:00
Matias Niemelä 2327f5a0a7 fix(ngAnimate): ensure that repeated structural calls during pre-digest function
Prior to this fix if `$animate.enter()` or `$animate.leave()` was called
before a digest was issued then the element may not be cancelled early
enough. This fix ensures that the previous structural animation is
cancelled immediately when a follow-up animation is kicked off.

Closes #11867
2015-05-20 20:34:25 -07:00
Matias Niemelä 718ff84405 fix(ngAnimate): ensure that cancelled class-based animations are properly cleaned up
Prior to this fix if the same CSS class was added and removed quickly
then the element being animated would be left with a stale cache of the
cancelled out animation. This would then result in follow-up animations
being added to the previous animation which would then never run. A
stale cache was to blame for that. This patch takes care of this issue.

Closes #11652
2015-05-19 20:54:10 -07:00
Gonzalo Ruiz de Villa 1b0d0fd8d0 feat(filterFilter): allow array like objects to be filtered
Throw error if filter is not used with an array like object.

Closes #11782
Closes #11787
2015-05-20 02:00:42 +03:00
Craig Warren 4090491c73 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:30:00 +01:00
Peter Bacon Darwin 5b18250594 docs(select): provide more info and example about non-string options
See #11890
2015-05-18 22:16:12 +01:00
Matias Niemelä f26fc26f6e fix($animate): accept unwrapped DOM elements as inputs for enter + move
Prior to this fix the $animate.enter() and $animate.move() events caused
an error when a parent or after element was provided that was not
already wrapped as a jqLite element. This patch ensures that both
wrapped and unwrapped DOM nodes are allowed.

Closes #11848
2015-05-18 11:59:12 -07:00
Martin Staffa d9bf6e3ea5 docs(migration): general style improvements
Closes #11849
2015-05-18 20:54:48 +02:00
Max Thyen f7a4b48121 fix($http): do not modify the config object passed into $http short methods
Update $http's createShortMethods and createShortMethodsWithData
to extend an empty object instead of the passed-in config.
Previously, since $http was extending the passed-in config,
the changes to the config object persisted even after the call to $http's
get/post/etc. returned. This causes unexpected behavior if that
config object is reused in subsequent calls to $http.
The existing test in httpSpec was not properly testing this situation.

Closes: #11764
2015-05-18 13:57:54 +02:00
Peter Bacon Darwin 98048678dc docs(error//nocb): add error doc for invalid parameter 2015-05-14 13:33:04 -07:00
Peter Bacon Darwin 9bb4d6ccbe fix(ngAnimate): throw an error if a callback is passed to animate methods
As of bf0f5502b1 (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 13:32:58 -07:00
Matias Niemelä 64c66d0eea fix(ngAnimate): ensure anchored animations remove the leave element at correct time
Due to a mismatch of where the `options.domOperation` value was stored,
the element involved in the `leave` animation for an anchored animation
session was not removed as soon as the leave animation ended. This
resulted in a pending element persisting within the DOM until all
animations involved in the associated anchor animation were complete.
This patch fixes this issue.

Closes #11850
2015-05-14 13:24:28 -07:00
Peter Bacon Darwin 13e38db7a3 docs(CHANGELOG): update to 1.4.0-rc.2 2015-05-12 19:52:36 +01:00
Matias Niemelä 0681a5400e feat(ngAnimate): ensure JS animations recognize $animateCss directly
JS Animations now recognize the response object returned from a call to
`$animateCss`. We can now setup our JS animation code to fully rely on
$animateCss to take charge without having to call the doneFn callback on
our own.

```js
// before
.animation('.my-css-animation', function($animateCss) {
  return {
    enter: function(element, doneFn) {
      var animator = $animateCss(element, {
        event: 'enter',
        structural: true,
        from: { background: 'red' },
        to: { background: 'blue' }
      });
      animator.start().done(doneFn);
    }
  };
});

// now
.animation('.my-css-animation', function($animateCss) {
  return {
    enter: function(element) {
      return $animateCss(element, {
        event: 'enter',
        structural: true,
        from: { background: 'red' },
        to: { background: 'blue' }
      });
    }
  };
});
```
2015-05-07 14:33:28 -07:00
Matias Niemelä d5683d2116 fix($animateCss): ensure that an object is always returned even when no animation is set to run
Before in RC0 and RC1 $animateCss would not return anything if a
CSS-based animation was not detected. This was a messy API decision
which resulted in the user having to have an if statement to handle the
failure case. This patch ensures that an animator object with the start()
and end() functions is always returned. If an animation is not detected
then the preperatory CSS styles and classes are removed immediately and
the element is cleaned up, however a "dump" animator object is still
returned which allows for callbacks and promises to be applied.

The returned object now also contains a `valid` property which can be
examined to determine whether an animation is set to run on the element.

BREAKING CHANGE: The $animateCss service will now always return an
object even if the animation is not set to run. If your code is using
$animateCss then please consider the following code change:

```
// before
var animator = $animateCss(element, { ... });
if (!animator) {
  continueApp();
  return;
}
var runner = animator.start();
runner.done(continueApp);
runner.then(continueApp);

// now
var animator = $animateCss(element, { ... });
var runner = animator.start();
runner.done(continueApp);
runner.then(continueApp);
```
2015-05-07 14:33:20 -07:00
Matias Niemelä df24410c17 fix(ngAnimate): force use of ng-anchor instead of a suffixed -anchor CSS class when triggering anchor animations
This fix changes anchored animations in ngAnimate to not append a series
of CSS classes with a `-suffix` prefix to the anchor element. Use
the `ng-anchor` instead CSS class instead.

BREAKING CHANGE: Prior to this fix there were to ways to apply CSS
animation code to an anchor animation. With this fix, the suffixed
CSS -anchor classes are now not used anymore for CSS anchor animations.

Instead just use the `ng-anchor` CSS class like so:

```html
<div class="container-animation" ng-if="on">
   <div ng-animate-ref="1" class="my-anchor-element"></div>
</div>

<div class="container-animation" ng-if="!on">
   <div ng-animate-ref="1" class="my-anchor-element"></div>
</div>
```

**before**:
```css
/* before (notice the container-animation CSS class) */
.container-animation-anchor {
  transition:0.5s linear all;
}
```

**now**:
```css
/* now (just use `ng-anchor` on a class that both the
   elements that contain `ng-animate-ref` share) */
.my-anchor-element.ng-anchor {
  transition:0.5s linear all;
}
```
2015-05-07 14:03:54 -07:00
Matias Niemelä e6d053de09 fix(ngAnimate): rename ng-animate-anchor to ng-anchor
BREAKING CHANGE: if your CSS code made use of the `ng-animate-anchor`
CSS class for referencing the anchored animation element then your
code must now use `ng-anchor` instead.
2015-05-07 14:03:47 -07:00
Matias Niemelä e001400237 fix(ngAnimate): ensure that shared CSS classes between anchor nodes are retained
This patch ensures that all of the CSS classes that exist on both
anchor nodes (the nodes that contain a `ng-animate-ref` attribute)
are not removed from the cloned element during the anchor animation.
(Previously the `in` animation would accidentally remove the CSS
classes of the first element.)

Closes #11681
2015-05-07 14:03:31 -07:00
Matias Niemelä 1002b80a6f fix(ngAnimate): prohibit usage of the ng-animate class with classNameFilter
Since ngAnimate uses the `ng-animate` CSS class internally to track
state it is better to keep this as a reserved CSS class to avoid
accidentally adding / removing the CSS class when an animation is
started and closed.

BREAKING CHANGE: partially or fully using a regex value containing
`ng-animate` as a token is not allowed anymore. Doing so will trigger a
minErr exception to be thrown.

So don't do this:

```js
// only animate elements that contain the `ng-animate` CSS class
$animateProvider.classNameFilter(/ng-animate/);

// or partially contain it
$animateProvider.classNameFilter(/some-class ng-animate another-class/);
```

but this is OK:

```js
$animateProvider.classNameFilter(/ng-animate-special/);
```

Closes #11431
Closes #11807
2015-05-07 13:02:45 +01:00
Matias Niemelä 7bb01bae72 docs(ngAnimate): add docs for the usage of the ng-animate CSS class 2015-05-07 13:01:55 +01:00
Matias Niemelä f7e9ff1aba fix(ngAnimate): ensure that the temporary CSS classes are applied before detection
Prior to 1.4 the `ng-animate` CSS class was applied before the CSS
getComputedStyle detection was issued. This was lost in the 1.4
refactor, however, this patch restores the functionality.

Closes #11769
Closes #11804
2015-05-07 12:49:47 +01:00
Caitlin Potter f7b999703f fix(ngClass): add/remove classes which are properties of Object.prototype
Previously, ngClass and ngAnimate would track the status of classes using an ordinary object.
This causes problems when class names match names of properties in Object.prototype, including
non-standard Object.prototype properties such as 'watch' and 'unwatch' in Firefox. Because of
this shadowing, ngClass and ngAnimate were unable to correctly determine the changed status
of these classes.

In orderto accomodate this patch, some changes have been necessary elsewhere in the codebase,
in order to facilitate iterating, comparingand copying objects with a null prototype, or which
shadow the `hasOwnProperty` method

Summary:

- fast paths for various internal functions when createMap() is used
- Make createMap() safe for internal functions like copy/equals/forEach
- Use createMap() in more places to avoid needing hasOwnProperty()

R=@matsko

Closes #11813
Closes #11814
2015-05-06 19:45:04 -04:00
Kent C. Dodds b2ae35cd2c docs(error/nonassign): add optional binding example
Closes #11701
2015-05-06 17:50:10 +01:00
Matias Niemelä 64d05180a6 fix(ngAnimate): ensure that all jqLite elements are deconstructed properly
Prior to this fix if a form DOM element was fed into parts of the
ngAnimate queuing code it would attempt to detect if it is a jqLite
object in an unstable way which would allow a form element to return an
inner input element by index. This patch ensures that jqLite instances
are properly detected using a helper method.

Closes #11658
2015-05-05 16:39:28 -07:00
Peter Bacon Darwin b5a9053ba3 fix(ngOptions): ensure that tracked properties are always watched
Commit 47f9fc3e70 failed to account for changes to
the tracked value of model items in a collection where the select was `multiple`.

See https://github.com/angular/angular.js/pull/11743#discussion_r29424578

Closes #11784
2015-05-05 22:45:06 +01:00
Matias Niemelä db20b830fc 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-05-05 14:20:05 -07:00
Matias Niemelä 2aacc2d622 fix(ngAnimate): ensure animations are not attempted on text nodes
With the large refactor in 1.4.0-rc.0, the detection code failed to
filter out text nodes from animating. This fix ensures that now properly
happens.

Closes #11703
2015-05-05 14:18:18 -07:00
Vladimir Lugovsky bab474aa8b fix($compile): ensure directive names have no leading or trailing whitespace
Closes #11397
Closes #11772
2015-05-05 21:07:19 +01:00
Peter Bacon Darwin f2c94c61d1 style($http): add missing semi-colon 2015-05-05 20:44:59 +01:00
Lucas Galfaso 2420a0a77e fix($httpParamSerializerJQLike): follow jQuery logic for nested params
Closes #11551
Closes #11635
2015-05-05 20:32:59 +01:00
Peter Bacon Darwin 9711e3e10e docs(guide/i18n): fix internal link to MessageFormat Extensions section 2015-05-05 20:17:27 +01:00
Peter Bacon Darwin ae826b007c docs(angular.element): clarify when jquery must be loaded for Angular to use it
Closes #3716
2015-05-05 20:01:26 +01:00
Nick Anderson 2ea23e0685 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:16 +01:00
Peter Bacon Darwin f1663088c3 docs($location): fix trailing whitespace
Closes #11741
Closes #11744
2015-05-05 19:54:15 +01:00
Damien Nozay 84daf9752a docs($location): explain difference between $location.host() and location.host.
Closes #11741
Closes #11744
2015-05-05 19:43:01 +01:00
Rich Snapp 426a5ac054 fix(jqLite): check for "length" in obj in isArrayLike to prevent iOS8 JIT bug from surfacing
Closes #11508
2015-05-05 17:54:46 +01:00
Peter Bacon Darwin 6874cca158 docs($injector): add array annotation to all injectable parameters
Closes #11507
2015-05-05 14:57:51 +01:00
Kevin Brogan 34c1a68fa8 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 14:51:15 +01:00
Peter Bacon Darwin 1268b17bc1 test(ngOptions): remove unnnecessary var 2015-05-01 21:36:05 +01:00
Peter Bacon Darwin ae98dadf6d fix(ngOptions): ensure label is watched in all cases
Closes #11765
2015-05-01 21:22:31 +01:00
Martin Staffa a2a684fe24 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:02 +01:00
Kent C. Dodds 40e00cdf34 docs(ngJq): update to indicate common pitfall
change docs for ngJq so it mentions that the placement of the directive is important with regards to the angular script.

Closes #11779
Closes #11780
2015-05-01 09:43:40 -04:00
Peter Bacon Darwin dfa722a8a6 fix(ngOptions): iterate over the options collection in the same way as ngRepeat
In `ngRepeat` if the object to be iterated over is "array-like" then it only iterates
over the numerical indexes rather than every key on the object. This prevents "helper"
methods from being included in the rendered collection.

This commit changes `ngOptions` to iterate in the same way.

BREAKING CHANGE:

Although it is unlikely that anyone is using it in this way, this change does change the
behaviour of `ngOptions` in the following case:

* you are iterating over an array-like object, using the array form of the `ngOptions` syntax
(`item.label for item in items`) and that object contains non-numeric property keys.

In this case these properties with non-numeric keys will be ignored.

** Here array-like is defined by the result of a call to this internal function:
https://github.com/angular/angular.js/blob/v1.4.0-rc.1/src/Angular.js#L198-L211 **

To get the desired behaviour you need to iterate using the object form of the `ngOptions` syntax
(`value.label` for (key, value) in items)`).

Closes #11733
2015-05-01 12:22:24 +01:00
Leonardo Braga cc961888cd docs(ngModel): improve formatting of $modelValue
Closes #11483
2015-04-30 22:54:14 +02:00
Rodrigo Parra 69f4d0ff70 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:50:54 +02:00
Jeff Wesson 7a04968673 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:49:17 +02:00
Steve Mao f2f9843ea8 docs(ngCloak): remove information for ie7
IE7 is not supported. Also change `#template2` text to `'world'`.

Closes #11661
2015-04-30 22:47:23 +02:00
Ron Tsui 7d57961b63 style(docs): improve formatting in code comment
Closes #11674
2015-04-30 22:44:51 +02:00
thatType 477e4047f7 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:43:31 +02:00
Ryan Atkinson b35e744791 docs(ngAnimate): fix typo in 'greetingBox' directive
Closes #11766
Closes #11747
2015-04-30 22:42:02 +02:00
Peter Bacon Darwin d83bddcb79 chore(docs): include attribute type in directive usage
Closes #11415
2015-04-29 17:47:48 +01:00
Peter Bacon Darwin 5db6709f8d chore(utils.js): only set maximum stack size on non-win32 machines
Closes #4831
2015-04-29 16:32:10 +01:00
Brent Dearth f3b393258e docs(select): remove obsolete ngOptions equality check comments 2015-04-29 10:40:17 -04:00
Peter Bacon Darwin 47f9fc3e70 fix(ngOptions): use watchCollection not deep watch of ngModel
Using a deep watch caused Angular to enter an infinite recursion in the
case that the model contains a circular reference.  Using `$watchCollection`
instead prevents this from happening.

This change means that we will not re-render the directive when there is
a change below the first level of properties on the model object. Making
such a change is a strange corner case that is unlikely to occur in practice
and the directive is not designed to support such a situation. The
documentation has been updated to clarify this behaviour.

This is not a breaking change since in 1.3.x this scenario did not work
at all. Compare 1.3.15: http://plnkr.co/edit/zsgnhflQ3M1ClUSrsne0?p=preview
to snapshot: http://plnkr.co/edit/hI48vBc0GscyYTYucJ0U?p=preview

Closes #11372
Closes #11653
Closes #11743
2015-04-29 14:30:36 +01:00
Mike Calvanese 74eb17d7c8 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 21:46:18 +01:00
gonengar c075126c2e 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:35:08 +02:00
Logesh Paul 6c632d9cb0 docs(*): definition list readability improvement
Closes #11398
Closes #11187
2015-04-27 22:35:06 +02:00
Viktor Zozulyak feeea8a1c8 docs(angular.injector): missing optional parameter mark
Closes #11528
2015-04-27 22:35:02 +02:00
yankee42 d20de4abe7 docs(ngModel): use arguments.length instead of angular.isDefined(newName) to distinguish getter/setter usage
Closes #11604
2015-04-27 22:34:59 +02:00
Adam 071b1bc790 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:34:57 +02:00
Bruno Coelho 4089f538c3 docs(guide/Scopes): remove unnecessary parenthesis
Closes #11645
2015-04-27 22:34:54 +02:00
cexbrayat 03d4bbc16f docs(ngJq): fix directive usage 2015-04-27 22:34:51 +02:00
Michał Gołębiowski 6d07005b18 chore(docs): don't use Chrome Frame
Chrome Frame has stopped development with Chrome 32 release; we shouldn't rely
on it in the docs.

Closes #11742
2015-04-27 21:29:30 +01:00
Jaco Pretorius 266bc6520b feat($resource): include request context in error message
include the request context (method & url) in badcfg error message

Closes #11363
2015-04-27 19:08:35 +02:00
micellius f0dd7c0374 docs(CHANGELOG): change name for 1.4.0-rc.1
Align version name for 1.4.0-rc.1 to be compliant with version naming convention:
Sartorial Chronography => sartorial-chronography

Closes #11732
2015-04-27 19:01:46 +02:00
Adrian-Catalin Neatu f0b88e047e docs(guide/Migrating from Previous Versions): spelling mistake
Closes #11739
2015-04-27 18:56:48 +02:00
Emmanuel DEMEY ef2435d176 docs(guide/Accessibility): remove an extra "a" in the A11Y doc
Closes #11740
2015-04-27 18:54:41 +02:00
Mike Calvanese 95521876eb fix(ngTouch): don't prevent click event after a touchmove
Remove the touchmove handler so that resetState is not called on touchmove.
The touchend event handler already prevents the click from being triggered
if the distance moved exceeds the MOVE_TOLERANCE, so detection of touchmove
is not needed. Previously, because of resetState on touchmove, the click would
not be triggered even if the event coordinates changed by only 1px or 2px,
which seems to be very common for taps on mobile browsers.

Closes #10985
2015-04-27 14:28:09 +01:00
Kent C. Dodds 4eb16ae4b7 docs($q): improve documentation of promises that resolve with another promise
Adds short explanation of promise chaining and a link for further explanation.

Closes #11708
Closes #11712
2015-04-27 14:20:31 +01:00
Matias Niemelä c10b249e3d docs(CHANGELOG): add changes for 1.4.0-rc.1 2015-04-24 11:26:10 -07:00
Matias Niemelä d97b658797 docs(ngAnimate): add docs for animation anchoring 2015-04-24 11:11:30 -07:00
Matias Niemelä 90e424b206 fix($animateCss): ensure that rAF waiting loop doesn't ignore pending items during a flush
Some animations may involve multiple stages of RAF requests before they
are run. This issue may cause an animation never to fire since the rAF
waiting queue may be modified during the flush stage and the code would
only pay attention to its starting length. This fix makes the rAF
flushing loop pay attention to the length with each iteration.
2015-04-24 11:11:21 -07:00
Matias Niemelä 8f819d2cb5 fix($animate): ensure that from styles are applied for class-based animations 2015-04-24 11:11:12 -07:00
Slaven Tomac abf59c285c fix(select): allow empty option to be added dynamically by ng-repeat
The select directive supports provision of an "empty" element that is used
if the value of the select is undefined.

This fix ensures that this empty option can be provided dynamically after
the initial compilation has completed.

Closes #11470
Closes #11512
2015-04-22 18:00:34 +01:00
Igor Minar 8914f8e3b1 chore(travis): set 'sudo: false' and reenable travis cache
For some reason our jobs are being routed to the 'build.linux' travis queue, which has the travis cache
disabled. In order for us to get the cache reenabled we need to get our jobs into the 'builds.docker' queue.
This can be achieved via setting 'sudo: false' in .travis.yaml
2015-04-20 14:24:05 -07:00
Andrew Austin 249f9b81cb fix(ngAria): change accessibility keypress event to use event.which if it is provided
In Firefox, keyboard events for printable characters (e.g. space) do not use event.keyCode.
Use event.which if it is provided before falling back to event.keyCode.

Closes #11340
2015-04-20 22:59:05 +02:00
Peter Bacon Darwin 992114f7a7 fix(ngMessageFormat): ensure bindings are valid for Protractor
Closes #11644
Closes #11649
2015-04-19 02:20:43 -07:00
Matias Niemelä 103a39ca8d fix($animate): make sure the JS animation lookup is an object lookup
The lookup type was an array before, but it should be an empty object.

Closes #11619
2015-04-17 15:41:52 -07:00
Matias Niemelä 042558a380 docs(MIGRATION): add notes for the migration from 1.3 to 1.4 2015-04-17 14:50:44 -07:00
Matias Niemelä 4d437ba9f7 docs($animate): include docs for on, off, enabled and cancel 2015-04-17 14:42:05 -07:00
John Hoffman e04a887c9b fix($http): stop coercing falsy HTTP request bodies to null / empty body
Closes #11552
Closes #11593
2015-04-17 16:10:55 -04:00
Melvin 08411cf914 docs(ngMessages): fix remote include naming mismatch
ng-messages-include was loading the wrong template.
2015-04-16 15:33:04 -07:00
ElRaph 68323034d6 docs(ngMessages): missing quotation mark...
... let the example fail. It seem to be a copy paste fail.
2015-04-16 15:30:40 -07:00
Matias Niemelä 1459be170d fix(ngAnimate): close parent animations only when there are classes to resolve
Previously if a parent animation was cancelled then it would not resolve
the runner when that happens. This is now fixed in this patch. Another
fix in this patch ensures that a parent animation is only cancelled if
the animation contains any classes to resolve. This prevents inline
animations from being cancelled.
2015-04-16 13:40:09 -07:00
Matias Niemelä e41faaa2a1 feat($animate): provide support for animations on elements outside of $rootElement
Beforehand it was impossible to issue an animation via $animate on an
element that is outside the realm of an Angular app. Take for example a
dropdown menu where the menu is positioned with absolute positioning...
The element will most likely need to be placed by the `<body>` tag, but
if the angular application is bootstrapped elsewhere then it cannot be
animated.

This fix provides support for `$animate.pin()` which allows for an
external element to be virtually placed in the DOM structure of a host
parent element within the DOM of an angular app.
2015-04-15 18:35:53 -07:00
Matias Niemelä 89f081e452 fix(ngAnimate): ensure ngClass-based classes are always resolved for CSS-enabled animations 2015-04-15 17:55:29 -07:00
Matias Niemelä 3333a5c380 fix(ngAnimate): do not abort animation if only ng-anchor-in is used 2015-04-15 16:34:41 -07:00
Chirayu Krishnappa f8f07e8220 chore(bower): (un)publish angular-message-format
Closes #11606
Closes #11607
2015-04-15 15:52:19 -07:00
Chirayu Krishnappa 7683166f26 chore(bower): minor refactor to DRY
The REPOS list was duplicated in publish.sh and unpublish.sh but had
different orderings of the repos.  This commit consolidates the list
into a common include file so that they are always in sync.  We could
improve the scripts a lot more but that's not in the current scope (this
is all I need to scratch my current itch.)

Closes #11605
2015-04-15 15:52:19 -07:00
Matias Niemelä 6dd64ab5f3 fix(ngAnimate): ensure that a filtered-out leave animation always runs its DOM operation
This patch fixes the issue where filtered-out leave animations were not
properly run the DOM operation when closed.

Closes #11555
2015-04-15 13:51:19 -07:00
Matias Niemelä 3af93a5ca8 test(ngAnimate): add basic integration tests for JS/CSS $animate-based animations 2015-04-15 13:50:16 -07:00
Matias Niemelä bee14ed1e7 fix(ngAnimate): ensure that animations work when the app is bootstrapped on the document node
Closes #11574
2015-04-15 13:47:24 -07:00
Chirayu Krishnappa 1a0bcb1f85 docs(i18n): expand the MessageFormat syntax documentation
Closes #11576
2015-04-15 13:12:31 -07:00
Chirayu Krishnappa 0d64f08005 chore(ngMessageFormat): rename angular-messageFormat to angular-message-format
Closes #11595
Closes #11597
2015-04-15 13:06:33 -07:00
Georgios Kalpakas dd8b157299 docs($http): minor fixes regarding params serializers
Closes #11601
2015-04-15 18:47:36 +02:00
Chirayu Krishnappa 8a45064f2b fix(ngMessageFormat): minified symbol and nested required expression
Add an E2E test that works against the minified module to test that the
minified build works correctly.

Fix a bug where mustHaveExpression was passed through to submessages
unchanged. Use of the messageFormat syntax automatically means that you
are using an expression.  Therefore, submessages should not be required
to also have messages.

Closes #11414
Closes #11592
2015-04-14 22:23:03 +01:00
Peter Bacon Darwin 40319a4ce2 docs(input[week]): add id to input element to fix e2e test 2015-04-14 22:08:57 +01:00
Peter Bacon Darwin bee6cbf45a docs(ngController): fix e2e test
The changes made in 2a156c2d7e caused this test
to fail. The test was trying to find an anchor with specified text but the
anchor had changed to a button.
2015-04-14 22:06:58 +01:00
Marcy Sutton 2a156c2d7e docs(): better accessibility in docs examples
Closes #11079
2015-04-11 14:39:10 -07:00
cexbrayat fe9cd9db96 docs(ngMessages): missing quote in sample
Closes #11527
2015-04-11 17:06:42 +02:00
Matias Niemelä 8bf5654ee0 docs(ngAnimate): update broken callback ngView example 2015-04-10 14:17:00 -07:00
Matias Niemelä a689ce63be docs($animateCss): remove out-dated return type details 2015-04-10 14:10:24 -07:00
Matias Niemelä fa0bbded1e fix(ngAnimate): ensure SVG classes are properly removed 2015-04-10 13:32:27 -07:00
Matias Niemelä b6afe1b208 docs(CHANGELOG): add changes for 1.4.0-rc.0 2015-04-10 10:44:35 -07:00
Matias Niemelä c8700f04fb feat($animate): complete refactor of internal animation code
All of ngAnimate has been rewritten to make the internals of the
animation code more flexible, reuseable and performant.

BREAKING CHANGE: JavaSript and CSS animations can no longer be run in
parallel. With earlier versions of ngAnimate, both CSS and JS animations
would be run together when multiple animations were detected. This
feature has now been removed, however, the same effect, with even more
possibilities, can be achieved by injecting `$animateCss` into a
JavaScript-defined animation and creating custom CSS-based animations
from there. Read the ngAnimate docs for more info.

BREAKING CHANGE: The function params for `$animate.enabled()` when an
element is used are now flipped. This fix allows the function to act as
a getter when a single element param is provided.

```js
// < 1.4
$animate.enabled(false, element);

// 1.4+
$animate.enabled(element, false);
```

BREAKING CHANGE: In addition to disabling the children of the element,
`$animate.enabled(element, false)` will now also disable animations on
the element itself.

BREAKING CHANGE: Animation-related callbacks are now fired on
`$animate.on` instead of directly being on the element.

```js
// < 1.4
element.on('$animate:before', function(e, data) {
  if (data.event === 'enter') { ... }
});
element.off('$animate:before', fn);

// 1.4+
$animate.on(element, 'enter', function(data) {
  //...
});
$animate.off(element, 'enter', fn);
```

BREAKING CHANGE: There is no need to call `$scope.$apply` or
`$scope.$digest` inside of a animation promise callback anymore
since the promise is resolved within a digest automatically (but a
digest is not run unless the promise is chained).

```js
// < 1.4
$animate.enter(element).then(function() {
  $scope.$apply(function() {
    $scope.explode = true;
  });
});

// 1.4+
$animate.enter(element).then(function() {
  $scope.explode = true;
});
```

BREAKING CHANGE: When an enter, leave or move animation is triggered then it
will always end any pending or active parent class based animations
(animations triggered via ngClass) in order to ensure that any CSS
styles are resolved in time.
2015-04-09 14:44:54 -07:00
Pawel Kozlowski 73ab107a1e docs($http): clarify side effects of transformRequest functions
Closes #11438

Closes #11503
2015-04-06 12:25:35 +02:00
tomoyuki kashiro 9dfa949dad chore(version-info): modify versioning for < v1.0.2
Angular v1.0.1 and earlier did not have valid versions and had a different
docs url format, so you can not access their api docs from the version
drop-down.

Closes #11132
2015-04-03 07:28:33 +01:00
Shahar Talmi a057e0896a fix(cookieReader): safely access $document so it can be mocked
Closes #11373
Closes #11388
2015-04-03 07:14:38 +01:00
Martin Staffa 948120ecdb fix(ngModel): allow setting model to NaN when asyncValidator is present
Closes #11315
Closes #11411
2015-04-03 07:11:27 +01:00
Peter Bacon Darwin 7757f0a9e3 chore(dependencies): general update (including new dgeni-packages)
Closes #11095
2015-04-03 06:00:39 +01:00
Peter Bacon Darwin 560566f396 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:00:17 +01:00
Peter Bacon Darwin d8d30ce676 style($browserSpec): fix typo 2015-04-02 21:47:10 +01:00
David Li d996305b44 perf($rootScope): remove history event handler when app is torn down
Remember the popstate and hashchange handler registered with window
when the application bootstraps, and remove it when the application
is torn down

Closes #9897
Closes #9905
2015-04-02 21:47:10 +01:00
Georgios Kalpakas 79fa7ddf8d 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:09:57 +01:00
mustela 3621dbc100 fix($resource) add @ support for properties names
Add support for properties that starts with @. This is useful when working with BadgerFish convention.

Closes #10533
Closes #11473
2015-04-02 20:49:08 +03:00
Pawel Kozlowski 65bed615df docs($http): fix $httpParamSerializerJQLike description 2015-04-02 19:46:10 +02:00
Pawel Kozlowski 6c8464ad14 feat($http): support custom params serializers
Closes #3740
Closes #7429
Closes #9224
Closes #11461
2015-04-02 19:02:56 +02:00
Georgios Kalpakas 731c8b5e2d feat($anchorScroll): allow scrolling to a specified element
Add an optional argument to `$anchorScroll()` to enable scrolling to an
anchor element different than that related to the current value of
`$location.hash()`. If the argument is omitted or is not a string,
the value of `$location.hash()` will be used instead.

Closes #4568
Closes #9596
2015-04-02 19:52:54 +03:00
Michał Gołębiowski 06a9f0a95f 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:05:26 +01:00
Michał Gołębiowski 2cdb2016b9 feat(travis): run unit tests on iOS 8
Refs #11471
Closes #11479
2015-04-02 13:26:45 +01:00
Lucas Galfaso 10ae33b2d8 fix($parse): fix parse errors on older Android WebViews which choke with reserved keywords
Closes #11455
2015-04-01 14:02:57 +02:00
Matias Niemelä c55a494433 fix(ngAnimate): ensure that minified repaint code isn't removed
Closes #9936
2015-03-31 14:04:45 -07:00
Georgios Kalpakas ffbeb32172 refactor(filterFilter): introduce helper function for "DRYness" 2015-03-31 19:54:36 +03:00
Georgios Kalpakas b5002ab62a 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}`.

Closes #11432
Closes #11445
2015-03-31 19:54:07 +03:00
Georgios Kalpakas 393f50324c style(filterFilter): fix indentation and remove newline for consistency 2015-03-31 19:47:09 +03:00
Peter Bacon Darwin 0a9c4681c2 style(ngStyle): remove unused $log param 2015-03-31 16:33:47 +01:00
Peter Bacon Darwin 50bd7059e1 test(ngStyle): should cope with both '' and '0px' for initial height 2015-03-31 16:30:41 +01:00
Martin Staffa 36fd167e1d Revert "perf(ngStyleDirective): use $watchCollection"
This reverts commit 4c8d8ad508, because
it broke lazy one-time binding for object literals
(introduced in c024f28217)

Fixes #11403
2015-03-31 09:44:39 +02:00
Martin Staffa da75d138b1 test(ngStyle): ensure lazy one-time binding is supported
Closes #11405
2015-03-31 09:44:26 +02:00
Brent Dearth 171b9f7f23 perf(ngOptions): only perform deep equality check on ngModel if using track by
Closes #11448
Closes #11447
2015-03-30 22:58:29 +01:00
Georgios Kalpakas 73f3515ba7 refactor($compile): remove unused return statement
As discussed in
https://github.com/angular/angular.js/commit/89447b3f2b4c6db62c24473a81fedc3b04242b85#commitcomment-10280666.
2015-03-28 14:41:59 +00:00
Martin Staffa 7e5c447fa9 fix(select): don't call $render twice if $viewValue ref changes
Credits to @tepez for the fix

Closes #11329
Closes #11412
2015-03-25 18:39:55 +00:00
Peter Bacon Darwin 4ba43d2e6f style($$messageFormat) does not need to have a provider 2015-03-25 17:26:45 +00:00
Peter Bacon Darwin f353db9d86 docs(ngMessageFormat): module name is actually ngMessageFormat 2015-03-25 17:22:04 +00:00
Fred Sauer b2b33608a3 docs($route): add param info for $routeUpdate event
Closes #11419
2015-03-25 14:41:40 +00:00
Peter Bacon Darwin 448e789142 docs(misc/FAQ): fix typo 2015-03-25 14:02:49 +00:00
Jason Bedard b8dbdb0c5e perf(benchmark): add ngmodel benchmarks to largetable-bp
Closes #11082
2015-03-23 21:26:10 +00:00
Peter Bacon Darwin 67af519764 docs(FAQ): add info about Anglar 1's versioning strategy
See https://github.com/angular/angular.js/issues/10122#issuecomment-84139724
2015-03-23 12:09:39 +00:00
Peter Bacon Darwin 4f12ed0e4e docs(filters): clarify filter name restrictions
See #10122
2015-03-23 11:58:01 +00:00
Martin Staffa afd0807520 docs($compile): clarify link fn's controller argument
Also add "bindToController" to exampe directive definition object.

Closes #10815
2015-03-22 13:58:24 +01:00
Bradley Price 6a6f403f24 docs($http): remove trailing comma
Remove trailing comma to keep the same flow with all other code examples on page.
2015-03-22 13:05:07 +01:00
wiseleo 7811eadac7 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 13:03:43 +01:00
Yuvraj Patil e5d1d6587d 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:36:50 +01:00
Martin Staffa 8c52f1daf4 docs(guide/scope): fix grammar
Closes #9829
2015-03-21 14:36:49 +01:00
Martin Staffa ee6a3ccd24 docs(guide/direcive): don't use shorthand in ddo
All the other examples use the full syntax.
Closes #11180
2015-03-21 14:36:47 +01:00
RaphStein e0e40e8c0a 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:36:46 +01:00
Vojta Jina f8c8cf698a fix($rootScope): allow destroying a root scope
When running (i.e. bootstrapping and killing) multiple apps on the same page,
it makes sense to destroy the root scope.

Closes #11241
Closes #10895
2015-03-20 11:41:21 +00:00
Wesley Cho 9f7a80c53d docs($httpBackend): change to more friendly language
- Change s**t to more neutral word

Closes #11380
Closes #11364
2015-03-20 10:55:49 +00:00
Julie Ralph bea99e34a4 chore(ci): fix location of print logs from wait_for_browser_provider 2015-03-19 14:40:38 -07:00
Julie Ralph c7ebce6fb8 chore(test): bump Protractor version to 2.0.0 2015-03-19 13:27:05 -07:00
Peter Bacon Darwin 41428477ed 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:27:59 +00:00
Peter Bacon Darwin cc4213f03e 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:27:59 +00:00
Peter Bacon Darwin 7c9ad277ad 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:27:59 +00:00
Bob Fanger 4588e627bb feat(ngClass): add support for conditional map within an array.
This change allows `ngClass` expressions to have both objects and strings
within an array:

```js
$scope.classVar = 'nav-item';
$scope.activeVar = true;
```

```html
<div ng-class=" [classVar, {'is-active': activeVar }] ">
```

In this case, the CSS classes that will be added are: 'nav-item' and 'is-active'.

Closes #4807
2015-03-18 11:17:44 +00:00
Julie Ralph ea9fd82ce1 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:57:55 -07:00
Martin Staffa 44337f63fa fix(ngAria): handle elements with role="checkbox/menuitemcheckbox"
Fixes #11317
Closes #11321
2015-03-17 20:53:55 +00:00
Julie Ralph 4b7a46adad 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:03 +00:00
Peter Bacon Darwin 1af563d43e fix($http): throw error if success and error methods do not receive a function
Closes #11330
Closes #11333
2015-03-17 19:13:37 +00:00
Chirayu Krishnappa 1e58488ad6 feat($interpolate): extend interpolation with MessageFormat like syntax
For more detailed information refer to this document:
https://docs.google.com/a/google.com/document/d/1pbtW2yvtmFBikfRrJd8VAsabiFkKezmYZ_PbgdjQOVU/edit

**Example:**

```html

{{recipients.length, plural, offset:1
    =0 {You gave no gifts}
    =1 { {{ recipients[0].gender, select,
              male {You gave him a gift.}
              female {You gave her a gift.}
              other {You gave them a gift.}
          }}
       }
    one { {{ recipients[0].gender, select,
              male {You gave him and one other person a gift.}
              female {You gave her and one other person a gift.}
              other {You gave them and one other person a gift.}
          }}
       }
    other {You gave {{recipients[0].gender}} and # other people gifts. }
}}
```

This is a SEPARATE module so you MUST include `angular-messageformat.js`
or `angular-messageformat.min.js`.

In addition, your application module should depend on the "ngMessageFormat"
(e.g. angular.module('myApp', ['ngMessageFormat']);)

When you use the `ngMessageFormat`, the $interpolate gets overridden with
a new service that adds the new MessageFormat behavior.

**Syntax differences from MessageFormat:**

- MessageFormat directives are always inside `{{ }}` instead of
  single `{ }`.  This ensures a consistent interpolation syntax (else you
  could interpolate in more than one way and have to pick one based on
  the features availability for that syntax.)
- The first part of such a syntax can be an arbitrary Angular
  expression instead of a single identifier.
- You can nest them as deep as you want.  As mentioned earlier, you
  would use `{{ }}` to start the nested interpolation that may optionally
  include select/plural extensions.
- Only `select` and `plural` keywords are currently recognized.
- Quoting support is coming in a future commit.
- Positional arguments/placeholders are not supported. They don't make
  sense in Angular templates anyway (they are only helpful when using
  API calls from a programming language.)
- Redefining of the startSymbol (`{{`) and endSymbol (`}}`) used for
  interpolation is not yet supported.

Closes #11152
2015-03-17 16:17:56 +00:00
Wesley Cho 170ff9a37d 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:41:15 +00:00
rodneyebanks e57138d7ef feat(angular.Module): add decorator method
Closes #11305
Closes #11300
2015-03-17 12:59:29 +00:00
jasperSpeicher 9093efe062 docs(ngRepeat): improve the explanation of keys
Closes #11310
2015-03-17 12:54:02 +00:00
Caitlin Potter 8028315640 test($compile): make test cases more specific for #11326 2015-03-17 08:18:10 -04:00
James Talmage 9900610eea fix($compile): update data() when controller returns custom value
When controller functions return an explicit value that value should
be what is passed to the linking functions, and to any child/sibling
controllers that `require` it. It should also be bound to the data
store on the dom element.

Closes #11147
Closes #11326
2015-03-17 08:18:10 -04:00
Peter Bacon Darwin db866f1f86 docs(CHANGELOG): add changes for 1.4.0-beta.6 and 1.3.15 2015-03-17 12:06:22 +00:00
svershin d8492f4331 docs(misc/Downloading): update o latest stable version
Updated the CDN link and description to 1.3.14

Closes #11327
2015-03-15 21:00:39 +00:00
rodyhaddad 67688d5ca0 fix($sanitize): disallow unsafe svg animation tags
After #11124 got merged, a security vulnerability got introduced.
Animation in SVG became tolerated by the sanitizer.

Exploit Example:
```
<svg>
  <a xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="?">
    <circle r="400"></circle>
    <animate attributeName="xlink:href" begin="0" from="javascript:alert(1)" to="&" />
  </a>
</svg>
```

Here we are animating an anchor's href, starting from a value that's a javascript URI,
allowing the executing of arbitrary javascript in the process.

Preventing only the animation of links is tricky, as SVG is weird and namespaces aren't predictable.
We've decided to have the sanitizer filter out svg animation tags instead.

Considering the sanitizer is commonly used to sanitize untrusted HTML code, this shouldn't affect
many apps in the wild. Also, no release has been with #11124 in it, but not this fix.

Closes #11290
2015-03-15 20:39:45 +00:00
rodyhaddad 9e8a687c37 chore(security): add warning banner to top of security sensitive files 2015-03-15 20:38:28 +00:00
Diego 3613a6007c refactor(ngPluralize):delete default directive restriction
delete the directive restriction to avoid code duplication since the default is already applied

Closes #11301
2015-03-13 21:10:57 +01:00
eeue56 2979bf38dd docs(guide/Services): Fix link to module.Factory 2015-03-13 19:54:22 +01:00
Amy 4c613a2603 docs(guide/Controllers): grammar and header fixes
fixed a comma and made the headers more logical.
2015-03-13 18:35:34 +01:00
Amy e6688ec280 docs(guide/Forms): format headers to match other docs
Primary header with page title, secondary headers for each description section.
2015-03-13 18:35:25 +01:00
Amy 4fdac4d22f docs(guide/Data Binding): add heading to page
the other pages have one, this makes them look more unified.
2015-03-13 18:35:11 +01:00
Matias Niemelä 2f4be3e2b9 chore(apis): add HashMap to the DI
HashMap will be used inside of angular-animate.js to store details of
ongoing animations on a per-element basis. Right now HashMap is only
available in core, but this patch will make it available to other areas.

Closes #11311
2015-03-13 12:40:15 -04:00
Julie Ralph 3086fcd644 chore(ci): bump sc version to 4.3.7 2015-03-13 09:35:17 -07:00
Peter Bacon Darwin 6a03ca2743 fix(ngOptions): fix model<->option interaction when using track by
This problem is beset by the problem of `ngModel` expecting models  to be
atomic things (primitives/objects).

> When it was first invented it was expected that ngModel would only be
a primitive, e.g. a string or a number. Later when things like ngList and
ngOptions were added or became more complex then various hacks were put
in place to make it look like it worked well with those but it doesn't.

-------------

Just to be clear what is happening, lets name the objects:

```js
var option1 = { uid: 1, name: 'someName1' };
var option2 = { uid: 2, name: 'someName2' };
var option3 = { uid: 3, name: 'someName3' };

var initialItem = { uid: 1, name: 'someName1' };

model {
  options: [option1, option2, option3],
  selected: initialItem
};
```

Now when we begin we have:

```js
expect(model.selected).toBe(initialItem);
expect(model.selected.uid).toEqual(option1.uid);
expect(model.selected).not.toBe(option1);
```

So although `ngOptions` has found a match between an option and the
modelValue, these are not the same object.

Now if we change the properties of the `model.selected` object, we are
effectively changing the `initialItem` object.

```js
model.selected.uid = 3;
model.selected.name = 'someName3';

expect(model.selected).toBe(initialItem);
expect(model.selected.uid).toEqual(option3.uid);
expect(model.selected).not.toBe(option3);
```

At the moment `ngModel` only watches for changes to the object identity
and so it doesn't trigger an update to the `ngOptions` directive.

This commit fixes this in `ngOptions` by adding a **deep** watch on the
`attr.ngModel` expression...

```js
scope.$watch(attr.ngModel, updateOptions, true);
```

You can see that in this Plunker:
http://plnkr.co/edit/0PE7qN5FXIA23y4RwyN0?p=preview

-------

But this isn't the end of the story. Since `ngModel` and `ngOptions` did
not make copies between the model and the view, we can't go around just
changing the properties of the `model.selected` object. This is particularly
important in the situation where the user has actually chosen an option,
since the `model.selected` points directly to one of the option objects:

```js
// User selects "someName2" option
expect(model.selected).toBe(option2);
expect(model.selected.uid).toEqual(option2.uid);
expect(model.selected).not.toBe(initialOption);
```

If we now change the `model.selected` object's properties we are actually
changing the `option2` object:

```js
expect(model.selected).toBe(option2);

model.selected.uid = 3;
model.selected.name = 'someName3';

expect(model.selected).toBe(option2);
expect(model.selected).not.toBe(option3);

expect(option2.uid).toEqual(3);
expect(option2.name).toEqual('someName3');
```

which means that the options are now broken:

```js
expect(model.options).toEqual([
  { uid: 1, name: 'someName1' },
  { uid: 3, name: 'someName3' },
  { uid: 3, name: 'someName3' }
]);
```

This commit fixes this in `ngOptions` by making copies when reading the
value if `track by` is being used. If we are not using `track by` then
we really do care about the identity of the object and should not be
copying...

You can see this in the Plunker here:
http://plnkr.co/edit/YEzEf4dxHTnoW5pbeJDp?p=preview

Closes #10869
Closes #10893
2015-03-13 11:55:01 +00:00
Peter Bacon Darwin 210c184184 style(ngOptionsSpec): ensure two newlines between specs 2015-03-13 11:43:49 +00:00
Izhaki 1846572d6f Added some extra sub-headings for clarity
Added `Normalization` and `Directive types`` subheadings to the `Matching directive` heading
2015-03-12 22:16:06 +01:00
Ciro Nunes 1c3bbada27 docs($templateCache): highlight the $templateCache service
Closes #11294
2015-03-12 22:14:43 +01:00
Devyn Stott 891b364c1b 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 21:45:09 +01:00
Marcin Wosinek 67297de109 docs(ngMessage): move up ngMessages link 2015-03-12 21:45:08 +01:00
Amy 68146cc092 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).
2015-03-12 21:44:59 +01:00
Peter Bacon Darwin c01b1f47c0 test(ngMock): test shallow copy of mock controller bindings
See #11239
2015-03-12 19:58:38 +00:00
Julie Ralph 1fc87e2b6a 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:53:45 -07:00
Rouven Weßling 9b2a4c6851 test(IE8): remove workarounds for IE8 2015-03-11 16:53:29 +01:00
Peter Bacon Darwin 2b4dfa9e2b 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:05:05 +00:00
Peter Bacon Darwin 68dbbfbf32 chore(ngLocale): regenerate locale files to include ERA info 2015-03-11 12:01:34 +00:00
Peter Bacon Darwin 4acb0af24c 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:01:33 +00:00
robiferentz bb5bf7f816 fix(jqLite): attr should ignore comment, text and attribute nodes
Follow jQuery handling of the `attr` function

Close #11038
2015-03-10 18:43:39 +01:00
Dave Jeffery 1924cf2216 docs(angular.extend): remove reference to non-existent parameter
The `deep` property is hard-coded to `false` and is not configurable
as the docs suggest.

Closes #11284
2015-03-10 13:26:41 +01:00
Rouven Weßling fb7db4a07b fix(rootScope): prevent memory leak when destroying scopes
Closes #11173
Closes #11169
2015-03-09 14:47:49 +00:00
gdi2290 4f1f9cfdb7 feat($interval): pass additional arguments to the callback
Similar to how [`setInterval`](http://mdn.io/setInterval#Syntax) works, this
commit allows users of `$interval` to add additional parameters to the call,
which will now be passed on to the callback function.

Closes #10632
2015-03-09 14:12:04 +00:00
gdi2290 3a4b6b83ef feat($timeout): pass additional arguments to the callback
Similar to how [`setTimeout`](mdn.io/setTimeout#Syntax) works, this commit
allows users of `$timeout` to add additional parameters to the call, which
will now be passed on to the callback function.

Closes #10631
2015-03-09 13:45:49 +00:00
bborowin 41fdb3d536 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:35:33 +01:00
Edward Delaporte 770a4ddcc6 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:47:36 +01:00
Elliot Bentley f6b51fc0a2 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:14:17 +01:00
jmarkevicius f227f7a5af docs(guide/Animations): change *then* to *than* 2015-03-08 13:56:04 +01:00
Anthony Zotti 212975af96 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 13:56:03 +01:00
b0ri5 abf87673e5 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 13:56:02 +01:00
Martin Staffa 248b036888 docs(tutorial/0 - Bootstrapping): clarify where the callback is registered
Closes #11270
2015-03-08 13:55:56 +01:00
Martin Staffa 3fd48742b0 test(ngJq): add e2e tests
Closes #11182
2015-03-06 13:51:40 +00:00
Martin Staffa 17f02d5bb2 chore(tests): don't rewrite urls for external scripts 2015-03-06 13:51:40 +00:00
Michel Boudreau 342e5f3ce3 fix(ngJq): don't rely on jqlite
Closes #11044
2015-03-06 13:51:39 +00:00
Peter Bacon Darwin 44e9d2ca6c docs(isNumber): fix link to isFinite 2015-03-06 11:54:55 +00:00
Peter Bacon Darwin 7705edc0da docs(isNumber): add info about using isFinite to exclude NaN
Closes #11230
2015-03-06 11:26:20 +00:00
Caitlin Potter d02d0585a0 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:54:14 +00:00
Peter Bacon Darwin 2d0eda10e4 docs(ngMessageExp): split ngMessage docs up to show its alias more clearly 2015-03-04 21:25:01 +00:00
gdi2290 4374f892c6 fix($animate): applyStyles from options on leave
Closes #10068
2015-03-04 14:26:10 +00:00
Peter Bacon Darwin caa0b9dab3 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:14:03 +00:00
Matias Niemelä 0c541cfb2a chore(privateMocks): replace multiple occurrences of $prop for they() 2015-03-04 07:24:04 -05:00
Peter Bacon Darwin 2404b77e48 chore(gruntFile): add tthey and xthey to ddescribe-iit check 2015-03-04 12:20:49 +00:00
Peter Bacon Darwin 8783453784 style(privateMocks): remove unnecessary comment 2015-03-04 12:07:51 +00:00
Matias Niemelä e650c45894 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:05:18 +00:00
Steve Mao 82000111dc docs(CONTRIBUTING): add whitespaces for consistent styling
Closes #11214
2015-03-03 17:51:12 -07:00
Shahar Talmi ddc612056e refactor(filters/ngModel): extract common methods
Closes #11005
2015-03-03 14:57:03 +00:00
Shahar Talmi 0413bee8cc feat(ngModel): support conversion to timezone other than UTC
Closes #11005
2015-03-03 14:44:48 +00:00
Caitlin Potter c0498d45fe feat(angular.merge): provide an alternative to angular.extend that merges 'deeply'
Closes #10507
Closes #10519
2015-03-03 14:39:11 +00:00
Peter Bacon Darwin f591776313 test(filterFilter): improve tests related to custom toString 2015-03-03 14:13:13 +00:00
Martin R. Hufsky f8c4216170 feat(filterFilter): compare object with custom toString() to primitive
Closes #10464
Closes #10548
2015-03-03 14:09:23 +00:00
Peter Bacon Darwin 4501da327d docs(*): The Bootstrap CSS class alert-error is now alert-danger 2015-03-02 22:34:31 +00:00
Shahar Talmi 9b35dfb658 refactor($browser): remove private polling mechanism
The only feature of Angular using this mechanism was `$cookies`,
which no longer mirrors the browser cookie values and so does not
need to poll.

Closes #11222
2015-03-02 22:21:11 +00:00
Shahar Talmi 53c6636991 feat($cookiesProvider): provide path, domain, expires and secure options
This change provides properties on `$cookiesProvider` so that you can set the application
level default options for cookies that are set using the `$cookies` service
2015-03-02 22:20:00 +00:00
Shahar Talmi 92c366d205 feat($cookies): allow passing cookie options
The `put`, `putObject` and `remove` methods now take an options parameter
where you can provide additional options for the cookie value, such as `expires`,
`path`, `domain` and `secure`.

Closes #8324
Closes #3988
Closes #1786
Closes #950
2015-03-02 22:20:00 +00:00
Shahar Talmi 38fbe3ee83 feat($cookies): move logic into $cookies and deprecate $cookieStore
The new API on `$cookies` includes:

 * `get`
 * `put`
 * `getObject`
 * `putObject`
 * `getAll`
 * `remove`

The new API no longer polls the browser for changes to the cookies and no longer copy
cookie values onto the `$cookies` object.

The polling is expensive and caused issues with the `$cookies` properties not
synchronizing correctly with the actual browser cookie values.

The reason the polling was originally added was to allow communication between
different tabs, but there are better ways to do this today (for example `localStorage`).

DEPRECATION NOTICE:

`$cookieStore` is now deprecated as all the useful logic
has been moved to `$cookies`, to which `$cookieStore` now simply
delegates calls.

BREAKING CHANGE:

`$cookies` no longer exposes properties that represent the current browser cookie
values. Now you must explicitly the methods described above to access the cookie
values. This also means that you can no longer watch the `$cookies` properties for
changes to the browser's cookies.

This feature is generally only needed if a 3rd party library was programmatically
changing the cookies at runtime. If you rely on this then you must either write code that
can react to the 3rd party library making the changes to cookies or implement your own polling
mechanism.

Closes #6411
Closes #7631
2015-03-02 22:20:00 +00:00
Shahar Talmi 997fdea1ee refactor(ngCookies): split $cookies/$cookieStore to two files 2015-03-02 22:20:00 +00:00
Shahar Talmi 76b1b2bec2 refactor($browser): split cookie access into $$cookieReader and $$cookieWriter services 2015-03-02 22:19:59 +00:00
Casey Howard c62fa6bd89 fix(filterFilter): Fix filtering using an object expression when the filter value is undefined
Fixes #10419
Closes #10424
2015-03-02 22:16:21 +00:00
Caitlin Potter 3b8163b7b6 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:29:41 +00:00
Brian Ford 2907a0288b docs(TRIAGING.md): improve process around PRs plz! label
Closes #10375
2015-03-02 19:40:54 +00:00
Marcy Sutton bb365070a3 feat(ngAria): add button role to ngClick
Closes #9254
Closes #10318
2015-03-02 13:48:18 +00:00
Peter Bacon Darwin 0f50b01cc7 test(aria): clean up test style and rename helper
Also removes unnecessary calls to `$apply`
2015-03-02 10:41:09 +00:00
Marcy Sutton 29cdaee2b6 feat(ngAria): add roles to custom inputs
This change adds the missing roles: `slider`, `radio`, `checkbox`

Closes #10012
Closes #10318
2015-03-02 10:40:22 +00:00
Jason Bedard 410f7c6826 fix(form): allow dynamic form names which initially evaluate to blank 2015-02-28 18:09:31 +01:00
Josh Kramer 9d071b2fc0 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:02:37 +01:00
Marcin Wosinek 7cfa79e98e refactor(interpolate): remove redundant $watchGroup param
Closes #11021
2015-02-28 13:11:44 +01:00
Pawel Kozlowski f22e1fc961 fix(Angular): properly compare RegExp with other objects for equality
Fixes #11204

Closes #11205
2015-02-28 10:56:56 +01:00
Peter Bacon Darwin 80f139b860 chore(ngLocale): update locales with FIRSTDAYOFWEEK and WEEKENDRANGE 2015-02-27 21:53:10 +00:00
Santi Albo 3d149c7f20 feat(ngLocale): Add FIRSTDAYOFWEEK and WEEKENDRANGE from google data
Add more properties from Google closure localization data into ngLocale.
2015-02-27 21:48:31 +00:00
Dav 2c4ffd6af4 fix(filterFilter): do not throw an error if property is null when comparing objects
Closes #10991
Closes #10992
Closes #11116
2015-02-27 21:05:17 +00:00
Matias Niemelä d7ec5f392e fix(ngMessages): ensure that multi-level transclusion works with ngMessagesInclude
ngRepeat and any other directives that alter the DOM structure using
transclusion may cause ngMessagesInclude to behave in an unpredictable
manner. This fix ensures that the element containing the ngMessagesInclude
directive will stay in the DOM to avoid these issues.

Closes #11196
2015-02-26 23:52:56 -05:00
Peter Bacon Darwin bfd7b227db chore(code.angularjs.org/publish): push snapshot from jenkins master build
Since the CI server is not available, we are not able to pull the current
build from it to update the snapshot.

This commit changes Jenkins to push the snapshot directly
to the code.angularjs.org repository on every successful master build.
2015-02-25 11:03:53 +00:00
Julie Ralph 581ee9d0b6 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:04:36 -08:00
Peter Bacon Darwin 57aa00e5dc docs(CHANGELOG): add changes for 1.4.0-beta.5 and 1.3.14 2015-02-24 17:51:15 +00:00
Peter Bacon Darwin 958bc1ab77 chore(bower/publish): run local precommit script if available
Closes #11164
2015-02-24 17:22:13 +00:00
Martin Staffa 3bc429ad9f chore(grunt): use path.normalize in grunt shell:npm-install
This makes the command runnable on Windows clients.
2015-02-23 20:49:37 +01:00
Tero Parviainen d8832d5527 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 19:58:33 +01:00
Martin Staffa f6d0ac5bc8 docs(ngDisabled): clarify the explanation of attributes & interpolation
Closes #11032
Closes #11133
2015-02-22 20:14:01 +01:00
Igor Minar 0356d72cd9 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:17:53 -08:00
Igor Minar a773f89bc9 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:17:50 -08:00
Igor Minar f497358df1 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:17:50 -08:00
Igor Minar 500d352901 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:17:50 -08:00
Igor Minar 05ae2815dc 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.
2015-02-21 18:17:50 -08:00
Igor Minar f88178323a 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.
2015-02-21 18:17:50 -08:00
Igor Minar 76edec7f9b 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
2015-02-21 18:17:50 -08:00
Igor Minar 367c7d90d4 chore(npm): update npm dependencies 2015-02-21 18:17:50 -08:00
Igor Minar 750d06bc25 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:17:50 -08:00
Igor Minar efb74642a1 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:17:50 -08:00
Jason Bedard ec27ce7198 test($interpolate): ensure constant interpolation watchers are removed
Closes #11057
2015-02-21 19:05:16 +01:00
Hugo Magalhães 46b80654ca fix(ngSanitize): Do not ignore white-listed svg camelCased attributes
Closes #10779
Closes #10990
Closes #11124
2015-02-21 18:54:57 +01:00
Shahar Talmi c67f88b26c doc(filter): support timezones other than UTC
Closes #10999
2015-02-21 13:16:10 +01:00
awdyson cbedff0619 docs($sce): fix typo
Closes #11108
2015-02-21 13:12:45 +01:00
Georgios Kalpakas 5cdefba1b4 docs(limitToFilter): mark the begin param as optional
Closes #11094
2015-02-21 13:09:47 +01:00
bhalajin b299e73130 docs(guide/Services): fix unit test example
Closes #11081
2015-02-21 13:07:42 +01:00
Yousef 16f12c86f6 docs(tutorial/12): fix grammar and punctuation
Closes #11036
Closes #11037
2015-02-21 13:04:09 +01:00
Ahmed Aderopo Alejo a9e02de5e2 docs(minerr/unpr): provide more info on $scope injection errors
Closes #11030
2015-02-21 12:55:12 +01:00
Haowei Zhang 0a8e113542 docs($resource): fix typo
'parametrized' -> 'parameterized'

Closes #11026
2015-02-21 12:43:01 +01:00
Chris Anderson 3f09847b73 docs(guide/concepts): remove scare quotes and so-called
So-called is defined as "commonly named" or "falsely or improperly so named".
The scare quotes are definitely unnecessary, as well.
It makes it sound like things aren't actually called that,
or it hints at sarcasm: "He's the so-called 'mayor', but he never does anything!"

http://en.wikipedia.org/wiki/Scare_quotes

Closes #11018
2015-02-21 12:32:53 +01:00
rwuebker 7a52da6c63 docs(guide/controller): improve wording
Closes #11000
2015-02-21 12:27:58 +01:00
Pawel Kozlowski 5da1256fc2 fix($http): properly access request headers with mixed case
Fixes #10881
Closes #10883
2015-02-21 12:00:41 +01:00
Diego 910de49399 refactor(ngSwitch):delete default directive restriction
delete the directive restriction to avoid code duplication
since the default is already applied

Closes #10987
Closes #11119
2015-02-21 11:21:54 +01:00
Kevin Mayo 7fe139af5a docs(guide/Expressions): add punctuation for clarity
Closes #11107
2015-02-20 19:54:48 +01:00
Igor Minar 507ee2d9ba 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-19 02:41:48 -08:00
Peter Bacon Darwin ef894c87ea fix(ngOptions): ngModel is optional 2015-02-18 13:32:00 +00:00
Peter Bacon Darwin 30b48132e0 fix(select): remove unknown option when model is undefined and empty option is available
Closes #11078
Closes #11092
2015-02-18 13:18:30 +00:00
Stephen Barker da9eac8660 feat(ngOptions): add support for disabling an option
This patch adds support for disabling options based on model values. The
"disable when" syntax allows for listening to changes on those model values,
in order to dynamically enable and disable the options.

The changes prevent disabled options from being written to the selectCtrl
from the model. If a disabled selection is present on the model, normal
unknown or empty functionality kicks in.

Closes #638
Closes #11017
2015-02-18 09:54:54 +00:00
Jason Bedard 5b5228675f perf($compile): replace forEach(controller) with plain loops
Closes #11084
2015-02-17 22:32:22 +00:00
Tamer Aydin aaae3cc416 feat(limitTo): extend the filter to take a beginning index argument
Extend the limitTo filter to take an optional argument for beginning index.
It provides a slice-alike functionality to manipulate the input.

Closes #5355
Closes #10899
2015-02-17 21:45:09 +01:00
Artem 49b54b0d77 docs(ngRepeat): clarify 'as' microsyntax usage
Closes #11087
2015-02-17 19:34:22 +01:00
Adam Bradley f627233312 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-17 19:20:20 +01:00
Jason Bedard 75725b44f8 refactor($compile): combining elementControllers and controllers 2015-02-16 12:48:08 +01:00
Jason Bedard fa0aa83937 perf($compile): avoid .data when fetching required controllers
Closes: ##11059
2015-02-16 12:44:37 +01:00
Martin Staffa bd6c04a112 docs($resource): fix list level
Closes #11055
2015-02-13 23:51:57 +01:00
Peter Bacon Darwin 056a317008 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:22 +00:00
Rouven Weßling 27fcca9a27 refactor(ngSanitize): remove workarounds for IE8
Closes #10758
2015-02-13 11:49:34 +00:00
Peter Bacon Darwin 2015ed2341 test(ngSanitize): add tests for decodeEntities 2015-02-13 11:49:34 +00:00
Peter Bacon Darwin 51faaffdbc perf(ngOptions): only watch labels if a display expression is specified
#11052
2015-02-13 11:29:47 +00:00
Julie Ralph 3c6a0e568d chore(ci): make all browserstack tests allowed failures 2015-02-12 13:21:03 -08:00
Julie Ralph cc744412b3 chore(ci): update to use the latest sauce connect (4.3 to 4.3.6) 2015-02-12 13:18:12 -08:00
Matias Niemelä c9a4421fc3 feat(ngMessages): provide support for dynamic message resolution
Prior to this fix it was impossible to apply a binding to a the
ngMessage directive to represent the name of the error. It was also
not possible to use ngRepeat or any other structural directive to
dynamically update the list of messages. This feature patch ensures
that both ngMessages can render expressions and automatically update
when any dynamic message data changes.

BREAKING CHANGE:

The `ngMessagesInclude` attribute is now its own directive and that must
be placed as a **child** element within the element with the ngMessages
directive. (Keep in mind that the former behaviour of the
ngMessageInclude attribute was that all **included** ngMessage template
code was placed at the **bottom** of the element containing the
ngMessages directive; therefore to make this behave in the same way,
place the element containing the ngMessagesInclude directive at the
end of the container containing the ngMessages directive).

```html
<!-- AngularJS 1.3.x -->
<div ng-messages="model.$error" ng-messages-include="remote.html">
  <div ng-message="required">Your message is required</div>
</div>

<!-- AngularJS 1.4.x -->
<div ng-messages="model.$error">
  <div ng-message="required">Your message is required</div>
  <div ng-messages-include="remote.html"></div>
</div>
```

Closes #10036
Closes #9338
2015-02-12 11:04:10 -05:00
Peter Bacon Darwin 732776f5f3 docs(FAQ): update the zipped file size 2015-02-12 11:59:15 +00:00
Tobyee c211e7a5ad 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:38:56 +01:00
Martin Staffa d6eba21733 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:30:13 +01:00
Peter Bacon Darwin c1199fb6b0 chore(CHANGELOG): add release name! 2015-02-09 11:16:39 +00:00
Peter Bacon Darwin 06c39a033e chore(CHANGELOG): update to 1.4.0-beta.4 and 1.3.13 2015-02-09 10:39:40 +00:00
Marcy Sutton 9d53e5a38d fix(ngAria): ensure native controls fire a single click
Closes #10388
Closes #10766
2015-02-07 10:26:21 +00:00
Lucas Galfaso 030a42e79d 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-06 07:17:04 +01:00
Shahar Talmi 898714df9e 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:32:42 +02:00
Lucas Galfaso 966f6d831f fix($parse): Initialize elements in an array from left to right
When constructing an array, never lazy initialize the elements and build
the array strictly from left to right.
When evaluating the expressions in a function call, never do so lazy.
When evaluating expressions inside object literals, never do so lazy.

Closes: #10968
2015-02-05 11:21:01 +01:00
izeye 28114faff4 docs(misc/Downloading): change AngularJS version to the latest
Closes #10964
2015-02-04 07:53:33 -08:00
Lucas Galfaso cc8755cda6 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:26:44 +01:00
Lukas Elmer 7b7b56d36d chore(docs): fix nav scrolling for non-mobile screens
Closes #10936
2015-02-04 13:37:18 +00:00
Morris Singer 9278ae67c6 docs(guide/forms): improve wording
Closes #01937
2015-02-04 13:16:53 +00:00
dtritus a509e9aa14 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:48:55 +00:00
Michel Boudreau 09ee82d84d feat(ng-jq): adds the ability to force jqLite or a specific jQuery version
Adds the ability to specify that jqLite should be used or to use a specific jQuery version
2015-02-04 11:01:14 +01:00
Peter Bacon Darwin c1cf053f37 docs(CHANGELOG): update changelog for 1.4.0-beta.3 and 1.3.12 2015-02-03 20:51:30 +00:00
Lucas Galfaso 2e5a7e52a0 fix($parse): handle null targets at assign
When assigning to a sub property of a property that its value is `null`
then write an empty object to the property that will contain the sub-property
2015-02-03 19:46:22 +01:00
Peter Bacon Darwin 5dfa630555 docs(CHANGELOG): update changelog for 1.4.0-beta.3 and 1.3.12 2015-02-02 20:27:32 +00:00
Peter Bacon Darwin 452d1cd66e chore(compare-master-to-stable): support beta release versions 2015-02-02 19:56:27 +00:00
Shahar Talmi c6d8512a1d feat(filter): support conversion to timezone other than UTC
Closes #10858
2015-02-02 14:57:42 +00:00
Richard Zschech 8a2c80ce7f style(*) add curly braces to multiline if and for statements
Closes #10865
2015-02-02 14:48:55 +00:00
Chris 2f3633d68f 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:03 +00:00
Hannah Howard 6c6a4086b7 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 11:49:14 +00:00
Lucas Galfaso 0d424263ea refactor($parse): new and more performant $parse
Change the way parse works from the old mechanism to a multiple stages
parsing and code generation. The new parse is a four stages parsing
* Lexer
* AST building
* AST processing
* Cacheing, one-time binding and `$watch` optimizations

The Lexer phase remains unchanged.

AST building phase follows Mozilla Parse API [1] and generates an AST that
is compatible. The only exception was needed for `filters` as JavaScript
does not support filters, in this case, a filter is transformed into a
`CallExpression` that has an extra property named `filter` with the value
of `true`.

The AST processing phase transforms the AST into a function that can be
executed to evaluate the expression. The logic for expressions remains
unchanged. The AST processing phase works in two different ways depending
if csp is enabled or disabled. If csp is enabled, the processing phase
returns pre-generated function that interpret specific parts of the AST.
When csp is disabled, then the entire expression is compiled into a single
function that is later evaluated using `Function`. In both cases, the
returning function has the properties `constant`, `literal` and `inputs`
as in the previous implementation. These are used in the next phase to
perform different optimizations.

The cacheing, one-time binding and `$watch` optimizations phase remains
mostly unchanged.

[1] https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API
2015-01-31 11:19:09 +01:00
Peter Bacon Darwin 2003fcf0de chore(version-info): silence the HTTP curl to get the cdn version 2015-01-30 21:55:46 +00:00
Peter Bacon Darwin 3130a82b21 chore(version-info): remove console.logs and fix code style 2015-01-30 21:25:14 +00:00
Caitlin Potter 6a38dbfd3c fix($compile): do not initialize optional '&' binding if attribute not specified
BREAKING CHANGE:

Previously, '&' expressions would always set up a function in the isolate scope. Now, if the binding
is marked as optional and the attribute is not specified, no function will be added to the isolate scope.

Closes #6404
Closes #9216
2015-01-30 21:25:14 +00:00
Henry Zhu 30e5b52344 style(*): add jscs rule disallowKeywordsOnNewLine: "else" 2015-01-30 12:46:55 +00:00
Henry Zhu ebde4681bd style(*): add jscs rule requireSpaceBeforeKeywords
Closes #10772
2015-01-30 12:36:19 +00:00
Henry Zhu ad68a41e88 style(*): add jscs rule requireSpacesInForStatement
Closes #10772
2015-01-30 12:36:19 +00:00
Henry Zhu 1f3ab484a7 style(*): add jscs rule disallowSpacesInCallExpression
Closes #10772
2015-01-30 12:36:18 +00:00
Henry Zhu d9498a173c style(*): add jscs rule disallowKeywordsOnNewLine: "else"
Closes #10772
2015-01-30 12:36:18 +00:00
Peter Bacon Darwin 29ad3b7f36 chore(npm): update grunt-jscs to 1.2.0 (jscs to 1.10.0), fix styles
Closes #10772
2015-01-30 12:36:18 +00:00
Lucas Galfaso c1500ea775 perf($scope): Add a property $$watchersCount to scope
Add a property $$watchersCount to scope that keeps the number of
watchers in the scope plus all the child scopes. Use this property
when traversing scopes looking for watches

Closes: #5799
2015-01-30 12:29:24 +01:00
Peter Bacon Darwin 4bc89bfe6d chore(doc-gen): update to dgeni-packages 0.10.8
Closes https://github.com/angular/dgeni-packages/pull/105
2015-01-30 10:53:34 +00:00
Rohit Kandhal 54097f63d5 docs(tutorial/step-11): update link to Jasmine matchers
Closes #10909
2015-01-29 22:33:26 +00:00
Ian Young 2264413beb 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:35 +00:00
Martin Staffa 8a6cbb3c94 test(validators): minlength and required must use viewValue in $isEmpty 2015-01-29 23:06:24 +01:00
Martin Staffa bfcf9946e1 fix(validators): maxlength should use viewValue for $isEmpty
Closes #10898
2015-01-29 23:06:23 +01:00
Caitlin Potter b462f5dcf2 docs($compile,$route): reword "controller alias" to clarify
Clarify that these aliases are identifier names used to reference the controller.
2015-01-29 16:48:06 -05:00
Caitlin Potter bb1c379b36 docs($compile): create new error for "missing controller identifier" 2015-01-29 16:48:06 -05:00
Caitlin Potter 62d514b069 fix($compile): respect return value from controller constructor
The return value of the controller constructor is now respected in all cases.

If controllerAs is used, the controller will be re-bound to scope. If bindToController is used,
the previous binding $watches (if any) will be unwatched, and bindings re-installed on the new
controller.
2015-01-29 16:48:06 -05:00
Caitlin Potter 35498d7045 feat($compile): allow using bindToController as object, support both new/isolate scopes
bindToController is now able to be specified as a convenient object notation:

```
bindToController: {
  text: '@text',
  obj: '=obj',
  expr: '&expr'
},
scope: {}
```

It can also be used in conjunction with new scopes, rather than exclusively isolate scopes:

```
bindToController: {
  text: '@text',
  obj: '=obj',
  expr: '&expr'
},
scope: true
```

Closes #10420
Closes #10467
2015-01-29 16:47:30 -05:00
Caitlin Potter 630b80fc00 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:26:54 -05:00
Martin Staffa a80d9449b7 docs(guide/production): clarification in disabling debug data
Closes #10762
2015-01-29 19:59:32 +01:00
Caitlin Potter dda65e992b 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:25 -05:00
Justin Schiff aa0f64496a fix(angular.copy): support copying %TypedArray%s
angular.copy can now copy a %TypedArray%s.

Limitations: It is not possible to update the length of a %TypedArray%, so currently an error is thrown
if the destination object is a %TypedArray%. However, it is possible to change values in a typed array,
so in the future this may only be a problem if the length of the source and destination is different.

Closes #10745
2015-01-29 12:17:10 -05:00
Vojta Jina e61eae1b1f 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:44:42 +00:00
Wes Alvaro 400fbbf1d6 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:38:16 +00:00
Owen Smith 27bf2ce40c 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:25:57 +00:00
marc c69caa7bee 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:45 +00:00
Shahar Talmi 8c46919199 fix(filter): format timezone correctly
This fixes timezone formatting in case UTC timezone is used

Closes #9359
2015-01-29 01:18:22 +02:00
Peter Bacon Darwin d729fcf030 fix(a): don't reload if there is only a name attribute
Closes #6273
Closes #10880
2015-01-28 14:30:51 +00:00
Shahar Talmi 0baa17a3b7 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 13:47:46 +00:00
Pablo Villoslada Puigcerber 2ece1c927b docs(notarray): add error example and code blocks with suggested fixes
Add code examples for the error and the suggested fixes.
Followup of #10352.

Closes #10872
2015-01-27 21:58:57 +01:00
Alex Yursha 7602cd5e7e docs(guide/location): replace invalid link
Closes #10882
2015-01-27 21:25:21 +01:00
Jason Bedard 560951e988 refactor($interpolate): move standalone functions to the service scope
Closes #10413
2015-01-27 15:42:11 +01:00
Agrumas 1735d5e8d5 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:30:55 +00:00
Peter Bacon Darwin c88b119ef5 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:27:46 +00:00
Caitlin Potter 6cf6a1b975 docs(CHANGELOG.md): remove reverted form change 2015-01-26 18:57:50 -05:00
Jeff Cross 76df116574 revert: fix(form): ignore properties in $error prototype chain
This reverts commit 31a5b8353a.
2015-01-26 14:50:48 -08:00
Caitlin Potter 440c122556 docs(CHANGELOG.md): add changelog notes for v1.3.11 and v1.4.0-beta.2
Closes #10876
2015-01-26 16:11:54 -05:00
cmsdkfz f7114d0c1c refactor($q): change variable name
Change the variable name to be more accurate describing what it stands for.
2015-01-26 11:04:44 +01:00
Caitlin Potter 2958cd308b 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:39:54 -05:00
Vinti Maheshwari 9f7c5ceba7 chore(gruntFile): ensure build is run before test:modules
Closes #10188
2015-01-25 02:33:09 +00:00
Peter Bacon Darwin 2f32614378 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:35:22 +00:00
Caitlin Potter 8b33de6fd0 fix($location): don't rewrite when link is shift-clicked
Closes #9904
Closes #9906
2015-01-25 00:34:35 +00:00
Peter Bacon Darwin d40749caab 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:41:29 +00:00
Mark Hoffmeyer e13224b2df 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:40:54 +00:00
Marcin Wosinek 36a14e65d1 docs(select): link to ngOptions
Closes #10854
2015-01-24 19:20:16 +01:00
Georgios Kalpakas 3228d3b499 fix(ngPluralize): fix wrong text content when count is null/undefined
When `lastCount` was evaluated to an non-numeric value (e.g. "other") and
`count` was evaluated to `NaN` (e.g. `null`/`undefined`), the text content
would be (wrongly) based on the previous template.
This commits makes sure the text content is updated correctly.

In order to customize the message shown upon `null`/`undefined` one can
specify a `'NaN'` property on the `when` exression object.

Closes #10836

Closes #10841
2015-01-24 14:01:33 +01:00
Jake Harclerode 6d173aeb5d docs($httpBackend): enhance readability
Closes #10852
2015-01-24 12:46:28 +01:00
samilamti d0ceeaa37e 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:37 +00:00
Caitlin Potter 301663e734 fix(openPlunkr): enable cmd+click for us mac users :> 2015-01-23 16:47:19 -05:00
Mike Haggerty dca5fa7b81 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:47:19 -05:00
Rouven Weßling d557875a8d test($rootScope) test the correct setting of the constructor in Internet Explorer 11
Closes #10759
2015-01-23 21:32:35 +00:00
Caitlin Potter b146af1127 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:39:59 -05:00
Pablo Villoslada Puigcerber cea8e75144 fix(filterFilter): throw error if input is not an array
Throw error if filter is not used with an array.

BREAKING CHANGE: Previously, the filter was not applied if used with a non array.
Now, it throws an error. This can be worked around by converting an object to an array, using
a filter such as https://github.com/petebacondarwin/angular-toArrayFilter

Closes #9992
Closes #10352
2015-01-23 14:21:58 -05:00
Pawel Kozlowski b3a9bd3ae0 fix($templateRequest): cache downloaded templates as strings
Fixes #10630
Closes #10646
2015-01-23 18:43:26 +01:00
Caitlin Potter 31a5b8353a fix(form): ignore properties in $error prototype chain
Closes #10469
Closes #10727
2015-01-23 14:37:17 +00:00
Rouven Weßling 301e7aae24 refactor(Angular): inline the only call to sortedKeys()
Closes #10757
2015-01-21 21:21:44 +01:00
Nick Van Dyck f2e2b31ece docs(ngMessages): fix typo
Closes #10821
2015-01-21 20:18:42 +01:00
Boshen Chen 331cac233f docs(ngInit): fix code block not being displayed in the note section
Closes #10791
2015-01-20 21:34:43 +01:00
Pawel Kozlowski 7e3557e96b docs(CHANGELOG): add changes for 1.3.10 and 1.4.0-beta.1 2015-01-20 20:43:54 +01:00
Pawel Kozlowski d435464c51 feat($http): provide a config object as an argument to header functions
Closes #7235
Closes #10622
2015-01-20 19:42:59 +01:00
Alexandr Subbotin c2031b1e9e 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 10:39:55 -05:00
Pawel Kozlowski d17fbc3862 fix(ngController): allow bound constructor fns as controllers
Fixes #10784
Closes #10790
2015-01-19 20:11:34 +01:00
Matias Niemelä 0db5b21b1d fix($animate): ensure no transitions are applied when an empty inline style object is provided
Closes #10613
Closes #10770
2015-01-19 14:37:58 +00:00
Caitlin Potter c260e73863 fix(ngRepeat): do not sort object keys alphabetically
BREAKING CHANGE:

Previously, the order of items when using ngRepeat to iterate
over object properties was guaranteed to be consistent by sorting the
keys into alphabetic order.

Now, the order of the items is browser dependent based on the order returned
from iterating over the object using the `for key in obj` syntax.

It seems that browsers generally follow the strategy of providing
keys in the order in which they were defined, although there are exceptions
when keys are deleted and reinstated. See
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete#Cross-browser_issues

The best approach is to convert Objects into Arrays by a filter such as
https://github.com/petebacondarwin/angular-toArrayFilter
or some other mechanism, and then sort them manually in the order you need.

Closes #6210
Closes #10538
2015-01-19 09:39:08 +00:00
Peter Bacon Darwin e5ad6d6ecd chore(travis): update browsers to the latest version
Update the used browsers to the latest versions available

Closes #10620
2015-01-19 08:22:51 +00:00
Peter Bacon Darwin bd9bc3f828 test(privateMocks): fix for the latest version of Safari 2015-01-19 08:19:20 +00:00
Alexandr Subbotin 2b8baf7e10 refactor($templateRequest): remove repeated decrementation and unnecessary local variable
Closes #10780
2015-01-18 19:53:24 +01:00
Pawel Kozlowski b8e8c5587f docs(ngClass): fix jscs style errors 2015-01-18 19:25:34 +01:00
Evan Spiler 37dd419478 docs(ngClass): fix formatting
Closes #10793
2015-01-18 19:11:17 +01:00
Robin Andersson 8a433f3cc5 docs($cookie): clarify return value if no cookie exist
Closes #10794
2015-01-18 19:09:10 +01:00
thorn0 1476810a2c docs(angular.bootstrap): passed fns are called on config stage
Closes #10789
2015-01-17 18:10:02 +01:00
Martin Staffa 833ea05abf 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:43:53 +01:00
Martin Staffa ca5fcc6f7a refactor(ngModel): clarify the arguments of $setValidity 2015-01-16 21:43:53 +01:00
Martin Staffa 2408f2ded5 fix(form): clean up success state of controls when they are removed
Fixes #10509
2015-01-16 21:43:53 +01:00
Martin Staffa 1bf1a6203c docs(migration): in 1.3, global controllers are disabled by default
Closes #10775
2015-01-16 21:25:39 +01:00
Sekib Omazic b7117afa2f docs($rootScope.Scope): Simple typo
Closes 10767
2015-01-16 21:11:57 +01:00
Sekib Omazic 3ae79c0105 docs(ngInclude): Typo fixed
Typo fixed
2015-01-16 21:09:17 +01:00
Sekib Omazic 2b64f6e318 docs(ngMessages): --typos.length
Merci~

Closes #10769
2015-01-15 15:46:13 -05:00
Caitlin Potter 23c8a90d22 fix($compile): support class directives on SVG elements
Closes #10736
Closes #10756
2015-01-15 13:58:57 -05:00
Marcin Wosinek 0504395c14 docs(design): highlight source button when focused 2015-01-15 13:57:07 +00:00
Kiran Rao 3831de8a05 docs(CONTRIBUTING): add colons for consistent styling
Closes #10744
2015-01-15 13:54:25 +00:00
campersau 40abdaf407 docs($templateRequest): remove duplicate "the" in return description
Introduced with: 1e5e527c84

Closes #10714
2015-01-15 13:51:58 +00:00
Martin Mouterde 3422cbac80 docs(date): fix milliseconds syntax description
There is no need to prefix 'sss' with ',' or '.'.

Closes #10680
2015-01-15 13:43:25 +00:00
anyong 08035545ed 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:14:56 +00:00
Kok-Hou Chia 9580bc2c2e docs(tutorial/7): correct typos
Closes #10587
2015-01-15 13:12:36 +00:00
Tyler Morgan 5a9dde1c27 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:03:12 +00:00
Olivier Giulieri 3a17799098 docs(css): fix position and size of Table of Contents "close" button
Closes #10555
2015-01-15 12:53:04 +00:00
Peter Bacon Darwin 1a7e9de8d8 chore(version-info): use branchPattern where we are replacing * 2015-01-14 20:44:32 +00:00
Peter Bacon Darwin 299b3e7e01 chore(release-scripts): split BranchPattern from BranchVersion
The release scripts need the BranchPattern to be of the form: 1.4.* so that
they can match the version using Regex.

The doc gen scripts need a SemVer pattern that will match beta releases.
The convention is that 1.4.x is not satisfied by 1.4.0.beta.0
2015-01-14 20:36:17 +00:00
Peter Bacon Darwin 54cae0f1d0 chore(package.json): increment the branch pattern to 1.4 2015-01-14 18:18:46 +00:00
Jonathan Gruber 4af7cdaf4d docs(tutorial/step_10): Added missing semicolon
Added a missing semicolon in definition of $scope.setImage.

Closes #10752
2015-01-14 09:41:49 -05:00
Caitlin Potter 593b18c66a revert: chore(npm): Make require()-able as part of publish script
This reverts commit babc20b43d.

(We wanted to get some feedback before doin this)
2015-01-13 14:25:59 -05:00
Peter Bacon Darwin f2e1a930aa docs(CHANGELOG): add changes for 1.3.9 and 1.4.0-beta.0 2015-01-13 00:58:55 +00:00
Ben Clinkinbeard babc20b43d 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:08:45 -05:00
Peter Bacon Darwin ba90261b75 fix(ngOptions): support one-time binding on the option values
Utilize the $watchDelegate on the watcher used to detect changes to the labels.

Closes #10687
Closes #10694
2015-01-12 19:48:42 +00:00
Peter Bacon Darwin fc21db8a15 fix(ngOptions): prevent infinite digest if track by expression is stable
Closes #9464
2015-01-12 19:48:41 +00:00
Peter Bacon Darwin b4bdec35cb refact(ngOptions): specialize readValue and writeValue based on multiple attribute 2015-01-12 19:48:41 +00:00
Peter Bacon Darwin 933591d69c fix(ngOptions): update model if selected option is removed
Closes #7736
2015-01-12 19:48:41 +00:00
Peter Bacon Darwin cf9331ac66 style(ngOptionsSpec): add extra newline for better formatting 2015-01-12 19:48:41 +00:00
Peter Bacon Darwin 02977c5bab test(ngOptions): should not insert a blank option if one of the options maps to null
Closes #7605
2015-01-12 19:48:41 +00:00
Peter Bacon Darwin 9f5ac048d7 test(ngOptions): should place non-grouped items in the list where they appear
Closes #10531
2015-01-12 19:48:41 +00:00
Peter Bacon Darwin 408f89d8e6 refact(ngOptions): move into its own file
Since select is not aware of ngOptions, it makes sense to move it into its
own file for more easy maintenance.
2015-01-12 19:48:41 +00:00
Peter Bacon Darwin 7fda214c4f fix(ngOptions): ensure that the correct option is selected when options are loaded async
**Major reworking of select and ngOptions**:

* The `SelectController` is now used as an abstraction for the `select` and `ngOptions` directives
to override to get their desired behaviour
* The `select` directive is completely oblivious to the ngOptions directive now - the `ngOptions`
directive could be deleted without having to make any changes to the `select` directive.
* Select related directives (single/multiple/ngOptions) can provide specific versions of
`SelectController.writeValue` and `SelectController.readValue`, which are responsible for getting
the `$viewValue` in or out of the actual `<select>` element and its `<option>` children.

BREAKING CHANGE:

When using `ngOptions`: the directive applies a surrogate key as the value of the `<option>` element.
This commit changes the actual string used as the surrogate key. We now store a string that is computed
by calling `hashKey` on the item in the options collection; previously it was the index or key of the
item in the collection.

(This is in keeping with the way that the unknown option value is represented in the select directive.)

Before you might have seen:

```
<select ng-model="x" ng-option="i in items">
  <option value="1">a</option>
  <option value="2">b</option>
  <option value="3">c</option>
  <option value="4">d</option>
</select>
```

Now it will be something like:

```
<select ng-model="x" ng-option="i in items">
  <option value="string:a">a</option>
  <option value="string:b">b</option>
  <option value="string:c">c</option>
  <option value="string:d">d</option>
</select>
```

If your application code relied on this value, which it shouldn't, then you will need to modify your
application to accommodate this. You may find that you can use the `track by` feaure of `ngOptions`
as this provides the ability to specify the key that is stored.

BREAKING CHANGE:

When iterating over an object's properties using the `(key, value) in obj` syntax
the order of the elements used to be sorted alphabetically. This was an artificial
attempt to create a deterministic ordering since browsers don't guarantee the order.
But in practice this is not what people want and so this change iterates over properties
in the order they are returned by Object.keys(obj), which is almost always the order
in which the properties were defined.

Closes #8019
Closes #9714
Closes #10639
2015-01-12 19:48:41 +00:00
Julie Ralph eb6cb785df chore(testing): bump protractor to version 1.6.0 2015-01-12 11:46:46 -08:00
Roman Konstantinovich aa798f1236 fix($location): right button click in firefox
When user click right mouse button on links in firefox, browser goes to
link. See http://jsfiddle.net/kromxr/76fKM/12/

Closes #7984
2015-01-12 17:13:54 +01:00
vasileorza 5a60302389 feat($timeout): allow fn to be an optional parameter
Closes #9176
Close #9723
2015-01-12 11:38:34 +00:00
Petr Peller 034fade3e8 docs(error/nobase): Added trailing slash for base path
Trailing slash seems to be necessary, otherwise `$routeProvider` does not match routes correctly. Following is not matched:

URL http://www.example.com/b/foo/1234
`<base href="/b/foo">`
```
$routeProvider.when('/:id', {
            templateUrl: '/view/path.html',
            controller: 'MyCtrl',
            reloadOnSearch: false
        });
```
2015-01-11 20:27:12 +01:00
Pawel Kozlowski e24f22bdb1 fix($templateRequest): propagate HTTP status on failed requests
Fixes #10514
Closes #10628
2015-01-11 10:56:19 +01:00
Jesse Palmer 371c1e19d8 docs(app): increment copyright year
Closes #10712
2015-01-11 10:54:42 +01:00
Jason Deppen b5e00cf615 docs(ngModel): from makes more sense than the other thing
Not sure if this is a worthy change but it confused me when I read it. It is worthy, thank you for submitting this! Cheers!

In practice, different from is by far the most common of the three, in both British and American English:
http://www.oxforddictionaries.com/us/words/different-from-than-or-to

Closes #10710
2015-01-11 01:22:06 -05:00
Andrew Joslin 5765061652 docs(ngMessages): fix typo on messages
The css class `.ng-inactive` applies when there is no message present
2015-01-10 17:59:59 +01:00
Leonardo Braga b146cae02c refactor(minErr): cleanup the generation of the error message
Removes a "magic number" used multiple times in the code
Removes unnecessary variables "arg" and "prefix"
Removed a condition within the "for" loop that generates query string parameters
2015-01-10 17:25:58 +01:00
Julie Ralph 3353afbb59 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:10:29 -08:00
Julie Ralph 40cb57c8f6 chore(travis): make browserstack unit tests allowed failures 2015-01-09 10:23:31 -08:00
Peter Bacon Darwin f06f28e018 revert: refact(): no need to trim empty hash from $location.absUrl()
This reverts commit f3b088a4e4.

The commit didn't take into account that IE9 may actually return empty
hash URLs for $location.absUrl().
2015-01-09 13:24:05 +00:00
Peter Bacon Darwin f3b088a4e4 refact(): no need to trim empty hash from $location.absUrl()
Only `$browser.url()` ever contains an empty hash fragment so that is the
only call that needs to be trimmed.

Closes #10515
2015-01-08 20:12:00 +00:00
Lucas Galfaso ef1a9d2cda chore(ngModelOptions): remove reference to angular.copy
Replaced a reference to `angular.copy` with just `copy`
2015-01-08 20:02:28 +01:00
Shahar Talmi 9c9c6b3fe4 fix(ngModelOptions): allow sharing options between multiple inputs
Closes #10667
2015-01-08 12:36:54 +01:00
quentin 51d6774286 feat($filter): Display Infinity symbol when number is Infinity
Infinity is a value and should not be treated as an empty string

Closes #10421
2015-01-08 12:14:48 +01:00
Leonardo Braga e079111b33 fix(ngChecked): ensure that ngChecked doesn't interfere with ngModel
Corrects an issue which occurs when an element's ng-modeol and ng-checked attributes have the same
value.

Closes #10662
Closes #10664
2015-01-07 20:45:41 -05:00
Lucas Galfaso e1132f53b0 fix(ngClass): handle multi-class definitions as an element of an array
Handles multi-class definition as an element of an array

Closes #8578
Closes #10651
2015-01-07 20:36:46 +01:00
Karl ab4b632dbf refactor(ngMessages): remove unused function argument
Closes #10652
2015-01-07 19:56:00 +01:00
eemmosi 1b704071c8 docs(tutorial/Routing): improve wording
Closes #10668
2015-01-07 19:53:11 +01:00
Peter Bacon Darwin 647d93338f chore(benchmark): add ngOptions benchmark 2015-01-07 13:35:25 +00:00
Pawel Kozlowski 1334b8c832 fix(dateFilter): ignore invalid dates
Fixes #10640
2015-01-06 23:18:32 +01:00
Uri Goldshtein d2a9a163fb docs(guide/index): add angular-easyfb with Facebook login to login libraries
Merci~

Closes #5792
2015-01-06 13:40:59 -05:00
Bryce Hanscomb e24d968276 style(ngRoute): move comment inside relevant function
This is a functional workaround for https://github.com/6to5/6to5/issues/376
And makes the comment code-style more consistent with line 143 and line 463.
2015-01-05 21:10:22 +01:00
Andrey Pushkarev a01ce6b81c 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:14:23 -05:00
Marc Laval c66b4b6a13 fix(ngPluralize): generate a warning when using a not defined rule
When using `ng-pluralize` and a rule is missing, then generate a warning

Fix #10207
2015-01-02 12:53:02 +01:00
Leonardo Braga 66ceecc295 refact($SnifferProvider): use bodyStyle var instead of document.body.style
Closes #10602
2014-12-31 15:09:16 +01:00
Pawel Kozlowski 349742b3f0 test($http): remove unused inject() calls
Closes #10611
2014-12-31 14:50:30 +01:00
Rus1 2ff7edfdd1 docs(ngInclude): replace <tt> with <code>
Using obsolete <tt> HTML tag may not be good for Angular examples

Closes #10594
2014-12-30 15:47:59 -05:00
Raphael Luba 1e5e527c84 docs($templateRequest): fix "returns" description to match code
Closes #10603
2014-12-30 19:01:20 +01:00
Mike Sidorov 1c76bf7e94 chore(*): add .gitattributes with new lines configuration
Closes #10431
Closes #10605
2014-12-30 18:53:50 +01:00
Daniel Tsui 6018f5da3f docs(misc/FAQ): grammatical improvements
-Non-idiomatic use of an expression "from the ground up".
-Missing commas.

Closes #10593
2014-12-29 21:19:04 +01:00
袴田 俊輔 3616b9b07c refactor(ngScenario): use Date.now() for get current Time
Closes #10579
2014-12-29 21:15:53 +01:00
Lucas Galfaso d224fe8172 docs(input): fix typo
Fix a typo on an example from the `input` directive
2014-12-28 20:57:43 +01:00
Lucas Galfaso e9bf93d510 refactor(*): rename internal function int to toInt
Renamed the internal function `int` to `toInt` as `int` is a reserved word

Closes #7768
2014-12-28 20:56:05 +01:00
mjfroehlich 2e721a7914 docs(guide/modules): fix minor typos
Closes #10584
2014-12-28 18:50:13 +01:00
Chris Schmitz 1eb6036d29 docs($compile) fix a typo
Remove unnecessary 'and' in $compile docs.

Closes #10582
2014-12-28 18:48:40 +01:00
OKNoah 4836dacae6 docs($http): fix markdown formatting
Closes #10571
2014-12-28 18:42:01 +01:00
Lucas Galfaso 0e2ac3cd70 chore($cache): do not add entry to LRU hash when value is undefined
When adding entries to the cache and the `value` is `undefined`, no
entry should be added to the `lruHash`
2014-12-28 16:59:57 +01:00
Peter Bacon Darwin 0f9fd2f642 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:19:39 +00:00
Peter Bacon Darwin 3e42b22b0e 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:07:07 +00:00
David Souther deb3cb4dae 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:16:51 +00:00
David Souther b43fa3bb30 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 16:28:08 +00:00
gokulkrishh 521c12c265 docs(guide/*): spelling/grammar improvements
Closes #10552
2014-12-22 10:43:55 -05:00
Caitlin Potter 7f5051bb2a docs($rootScope): remove erroneous closing parenthesis
Closes #10549
2014-12-22 08:33:10 -05:00
Kevin Primat 25623b709f 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:24:27 -05:00
Olivier Giulieri e4f23c4d25 docs(guide): fix spaces
Closes #10539
2014-12-22 01:07:46 +00:00
gdi2290 8928d02345 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:35:38 +00:00
Dan Cancro 5bb2636aac 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:02 +00:00
Robert Haritonov c95e38c603 docs(tutorial/12): fix path to jquery in bower
Closes #10504
2014-12-22 00:12:45 +00:00
Peter Bacon Darwin a3c3bf3332 feat(limitTo): ignore limit when invalid
BREAKING CHANGE: limitTo changed behavior when limit value is invalid.
Instead of returning empty object/array it returns unchanged input.

Closes #10510
2014-12-21 10:03:43 +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
1060 changed files with 73093 additions and 26754 deletions
+5
View File
@@ -0,0 +1,5 @@
# Auto detect text files and perform LF normalization
* text=auto
# JS files must always use LF for tools to work
*.js eol=lf
-17
View File
@@ -1,17 +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"],
"requireSpaceAfterBinaryOperators": ["?", ":", "+", "-", "/", "*", "%", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "&&", "||"],
"requireSpaceBeforeBinaryOperators": ["?", ":", "+", "-", "/", "*", "%", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "&&", "||"],
"disallowImplicitTypeConversion": ["string"],
"disallowMultipleLineBreaks": true,
"disallowKeywordsOnNewLine": ["else"],
"validateJSDoc": {
"checkParamNames": true,
"requireParamTypes": true
}
}
+17 -2
View File
@@ -1,6 +1,7 @@
{
"excludeFiles": ["src/ngLocale/**"],
"disallowKeywords": ["with"],
"disallowKeywordsOnNewLine": ["else"],
"disallowMixedSpacesAndTabs": true,
"disallowMultipleLineStrings": true,
"disallowNewlineBeforeBlockStatements": true,
@@ -11,6 +12,7 @@
"disallowSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInCallExpression": true,
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
},
@@ -18,16 +20,29 @@
"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",
"validateParameterSeparator": ", "
"validateLineBreaks": "LF"
}
+31 -7
View File
@@ -1,34 +1,58 @@
language: node_js
sudo: false
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
+1842 -2
View File
File diff suppressed because it is too large Load Diff
+8 -8
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!
@@ -227,11 +227,11 @@ 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**.
+32 -17
View File
@@ -17,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,
@@ -30,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: {
@@ -138,6 +126,9 @@ module.exports = function(grunt) {
ngLocale: {
files: { src: 'src/ngLocale/**/*.js' },
},
ngMessageFormat: {
files: { src: 'src/ngMessageFormat/**/*.js' },
},
ngMessages: {
files: { src: 'src/ngMessages/**/*.js' },
},
@@ -167,7 +158,7 @@ module.exports = function(grunt) {
jscs: {
src: ['src/**/*.js', 'test/**/*.js'],
options: {
config: ".jscs.json"
config: ".jscsrc"
}
},
@@ -212,6 +203,10 @@ module.exports = function(grunt) {
dest: 'build/angular-resource.js',
src: util.wrap(files['angularModules']['ngResource'], 'module')
},
messageformat: {
dest: 'build/angular-message-format.js',
src: util.wrap(files['angularModules']['ngMessageFormat'], 'module')
},
messages: {
dest: 'build/angular-messages.js',
src: util.wrap(files['angularModules']['ngMessages'], 'module')
@@ -244,6 +239,7 @@ module.exports = function(grunt) {
animate: 'build/angular-animate.js',
cookies: 'build/angular-cookies.js',
loader: 'build/angular-loader.js',
messageformat: 'build/angular-message-format.js',
messages: 'build/angular-messages.js',
touch: 'build/angular-touch.js',
resource: 'build/angular-resource.js',
@@ -259,8 +255,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": {
@@ -293,6 +300,10 @@ module.exports = function(grunt) {
},
shell: {
"npm-install": {
command: path.normalize('scripts/npm/install-dependencies.sh')
},
"promises-aplus-tests": {
options: {
stdout: false,
@@ -319,14 +330,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']);
+1 -1
View File
@@ -1,6 +1,6 @@
The MIT License
Copyright (c) 2010-2014 Google, Inc. http://angularjs.org
Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+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
+34 -5
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',
@@ -39,6 +40,7 @@ var angularFiles = {
'src/ng/timeout.js',
'src/ng/urlUtils.js',
'src/ng/window.js',
'src/ng/cookieReader.js',
'src/ng/filter.js',
'src/ng/filter/filter.js',
@@ -52,6 +54,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,7 +63,10 @@ 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/ngOptions.js',
'src/ng/directive/ngPluralize.js',
'src/ng/directive/ngRepeat.js',
'src/ng/directive/ngShowHide.js',
@@ -69,20 +75,41 @@ 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'
],
'angularModules': {
'ngAnimate': [
'src/ngAnimate/animate.js'
'src/ngAnimate/shared.js',
'src/ngAnimate/rafScheduler.js',
'src/ngAnimate/animateChildrenDirective.js',
'src/ngAnimate/animateCss.js',
'src/ngAnimate/animateCssDriver.js',
'src/ngAnimate/animateJs.js',
'src/ngAnimate/animateJsDriver.js',
'src/ngAnimate/animateQueue.js',
'src/ngAnimate/animateRunner.js',
'src/ngAnimate/animation.js',
'src/ngAnimate/module.js'
],
'ngCookies': [
'src/ngCookies/cookies.js'
'src/ngCookies/cookies.js',
'src/ngCookies/cookieStore.js',
'src/ngCookies/cookieWriter.js'
],
'ngMessageFormat': [
'src/ngMessageFormat/messageFormatCommon.js',
'src/ngMessageFormat/messageFormatSelector.js',
'src/ngMessageFormat/messageFormatInterpolationParts.js',
'src/ngMessageFormat/messageFormatParser.js',
'src/ngMessageFormat/messageFormatService.js'
],
'ngMessages': [
'src/ngMessages/messages.js'
@@ -155,7 +182,7 @@ var angularFiles = {
'src/publishExternalApis.js',
'@angularSrcModules',
'@angularScenario',
'@angularTest',
'@angularTest'
],
'karmaExclude': [
@@ -174,6 +201,7 @@ var angularFiles = {
'@angularSrcModules',
'src/ngScenario/browserTrigger.js',
'test/helpers/*.js',
'test/ngMessageFormat/*.js',
'test/ngMock/*.js',
'test/ngCookies/*.js',
'test/ngRoute/**/*.js',
@@ -190,7 +218,7 @@ var angularFiles = {
'src/publishExternalApis.js',
'@angularSrcModules',
'@angularScenario',
'@angularTest',
'@angularTest'
],
'karmaJqueryExclude': [
@@ -202,6 +230,7 @@ var angularFiles = {
angularFiles['angularSrcModules'] = [].concat(
angularFiles['angularModules']['ngAnimate'],
angularFiles['angularModules']['ngMessageFormat'],
angularFiles['angularModules']['ngMessages'],
angularFiles['angularModules']['ngCookies'],
angularFiles['angularModules']['ngResource'],
+31 -1
View File
@@ -14,10 +14,14 @@
<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>interpolation + bind-once: <input type="radio" ng-model="benchmarkType" value="bindOnceInterpolation"></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>
<div>interpolation + filter: <input type="radio" ng-model="benchmarkType" value="interpolationFilter"></div>
<div>ngModel (const name): <input type="radio" ng-model="benchmarkType" value="ngModelConstName"></div>
<div>ngModel (interp name): <input type="radio" ng-model="benchmarkType" value="ngModelInterpName"></div>
<ng-switch on="benchmarkType">
<baseline-binding-table ng-switch-when="baselineBinding">
@@ -34,7 +38,7 @@
</div>
<div ng-switch-when="ngBindOnce">
<h2>baseline binding once</h2>
<div ng-repeat="row in data">
<div ng-repeat="row in ::data">
<span ng-repeat="column in ::row">
<span ng-bind="::column.i"></span>:<span ng-bind="::column.j"></span>|
</span>
@@ -46,6 +50,18 @@
<span ng-repeat="column in row">{{column.i}}:{{column.j}}|</span>
</div>
</div>
<div ng-switch-when="bindOnceInterpolation">
<h2>baseline one-time interpolation</h2>
<div ng-repeat="row in ::data">
<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">
@@ -70,6 +86,20 @@
<span ng-repeat="column in row">{{column.i | noop}}:{{column.j | noop}}|</span>
</div>
</div>
<div ng-switch-when="ngModelConstName">
<h2>ngModel (const name)</h2>
<div ng-repeat="row in data">
<input type="text" ng-model="row.i" name="constName" />
<input type="text" ng-model="row.j" />
</div>
</div>
<div ng-switch-when="ngModelInterpName">
<h2>ngModel (interp name)</h2>
<div ng-repeat="(rowIdx, row) in data">
<input type="text" ng-model="row.i" name="input-{{rowIdx}}" />
<input type="text" ng-model="row.j" name="input2-{{rowIdx}}" />
</div>
</div>
</ng-switch>
</div>
</div>
+95
View File
@@ -0,0 +1,95 @@
"use strict";
/* globals angular, benchmarkSteps */
var app = angular.module('ngOptionsBenchmark', []);
app.config(function($compileProvider) {
if ($compileProvider.debugInfoEnabled) {
$compileProvider.debugInfoEnabled(false);
}
});
app.controller('DataController', function($scope, $element) {
$scope.items = [];
$scope.count = 10000;
function changeOptions() {
$scope.items = [];
for (var i = 0; i < $scope.count; ++i) {
$scope.items.push({
id: i,
label: 'item-' + i,
group: 'group-' + i % 100
});
}
}
var selectElement = $element.find('select');
console.log(selectElement);
benchmarkSteps.push({
name: 'add-options',
fn: function() {
$scope.$apply(function() {
$scope.count = 10000;
changeOptions();
});
}
});
benchmarkSteps.push({
name: 'set-model-1',
fn: function() {
$scope.$apply(function() {
$scope.x = $scope.items[1000];
});
}
});
benchmarkSteps.push({
name: 'set-model-2',
fn: function() {
$scope.$apply(function() {
$scope.x = $scope.items[10];
});
}
});
benchmarkSteps.push({
name: 'remove-options',
fn: function() {
$scope.count = 100;
changeOptions();
}
});
benchmarkSteps.push({
name: 'add-options',
fn: function() {
$scope.$apply(function() {
$scope.count = 10000;
changeOptions();
});
}
});
benchmarkSteps.push({
name: 'set-view-1',
fn: function() {
selectElement.val('2000');
selectElement.triggerHandler('change');
}
});
benchmarkSteps.push({
name: 'set-view-2',
fn: function() {
selectElement.val('1000');
selectElement.triggerHandler('change');
}
});
});
+11
View File
@@ -0,0 +1,11 @@
module.exports = function(config) {
config.set({
scripts: [ {
id: 'angular',
src: '/build/angular.js'
},
{
src: 'app.js',
}]
});
};
+10
View File
@@ -0,0 +1,10 @@
<div ng-app="ngOptionsBenchmark" ng-cloak>
<div ng-controller="DataController">
<div class="container-fluid">
<p>
Tests the execution of ng-options for rendering during model and option updates.
</p>
<select ng-model="x" ng-options="a as a.label group by a.group for a in items track by a.id"></select>
</div>
</div>
</div>
+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);
});
});
});
+2 -2
View File
@@ -103,10 +103,10 @@ then(function (tags) {
sort(semver.rcompare);
}).
then(function (tags) {
var major = tags[0].split('.')[0] + '.x';
var major = tags[0].split('.')[0];
return tags.
filter(function (ver) {
return semver.satisfies(ver, major);
return semver(ver).major == major;
});
}).
then(function (tags) {
+8
View File
@@ -9,3 +9,11 @@
ng\:form {
display: block;
}
.ng-animate-shim {
visibility:hidden;
}
.ng-anchor {
position:absolute;
}
+20 -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;
}
@@ -690,3 +701,7 @@ ul.events > li {
padding-bottom:0px;
}
}
iframe[name="example-anchoringExample"] {
height:400px;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

+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);
});
};
}]);
+2 -2
View File
@@ -35,7 +35,7 @@ angular.module('tutorials', [])
'step': '@docTutorialReset'
},
template:
'<p><a href="" ng-click="show=!show;$event.stopPropagation()">Workspace Reset Instructions ➤</a></p>\n' +
'<p><button class="btn" ng-click="show=!show">Workspace Reset Instructions ➤</button></p>\n' +
'<div class="alert alert-info" ng-show="show">\n' +
' <p>Reset the workspace to step {{step}}.</p>' +
' <p><pre>git checkout -f step-{{step}}</pre></p>\n' +
@@ -43,7 +43,7 @@ angular.module('tutorials', [])
'<a href="http://angular.github.io/angular-phonecat/step-{{step}}/app">Step {{step}} Live Demo</a>.</p>\n' +
'</div>\n' +
'<p>The most important changes are listed below. You can see the full diff on ' +
'<a ng-href="https://github.com/angular/angular-phonecat/compare/step-{{step ? (step - 1): \'0~1\'}}...step-{{step}}">GitHub</a>\n' +
'<a ng-href="https://github.com/angular/angular-phonecat/compare/step-{{step ? (step - 1): \'0~1\'}}...step-{{step}}" title="See diff on Github">GitHub</a>\n' +
'</p>'
};
});
+12 -8
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,17 +16,18 @@ 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) {
var currentPagePath = $location.path().replace(/\/$/, '');
// TODO: We need to do some munging of the path for different versions of the API...
$window.location = version.docsUrl + currentPagePath;
var currentPagePath = $location.path().replace(/\/$/, ''),
url = '';
if (version.isOldDocsUrl) {
url = version.docsUrl;
}else{
url = version.docsUrl + currentPagePath;
}
$window.location = url;
};
}]);
+11 -6
View File
@@ -6,18 +6,18 @@ var packagePath = __dirname;
var Package = require('dgeni').Package;
// 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.
// 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) {
-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>
@@ -3,7 +3,7 @@
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="Description"
content="AngularJS is what HTML would have been, had it been designed for building web-apps.
Declarative templates with data-binding, MVC, dependency injection and great
@@ -76,7 +76,7 @@
<div class="row">
<div class="col-md-9 header-branding">
<a class="brand navbar-brand" href="http://angularjs.org">
<img width="117" height="30" class="logo" ng-src="img/angularjs-for-header-only.svg">
<img width="117" height="30" class="logo" alt="Link to Angular JS Homepage" ng-src="img/angularjs-for-header-only.svg">
</a>
<ul class="nav navbar-nav">
<li class="divider-vertical"></li>
@@ -220,10 +220,10 @@
<p class="pull-right"><a back-to-top>Back to top</a></p>
<p>
Super-powered by Google ©2010-2014
Super-powered by Google ©2010-2015
( <a id="version"
ng-href="https://github.com/angular/angular.js/blob/master/CHANGELOG.md#{{versionNumber}}"
ng-bind-template="v{{version}}">
ng-bind-template="v{{version}}" title="Changelog of this version of Angular JS">
</a>
)
</p>
+60
View File
@@ -0,0 +1,60 @@
{% macro typeList(types) -%}
{% for typeName in types %}<a href="" class="{$ typeName | typeClass $}">{$ typeName | escape $}</a>{% endfor %}
{%- endmacro -%}
{%- macro paramTable(params) %}
<table class="variables-matrix input-arguments">
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
{% for param in params %}
<tr>
<td>
{$ param.name $}
{% if param.alias %}| {$ param.alias $}{% endif %}
{% if param.optional %}<div><em>(optional)</em></div>{% endif %}
</td>
<td>
{$ typeList(param.typeList) $}
</td>
<td>
{$ param.description | marked $}
{% if param.defaultValue %}<p><em>(default: {$ param.defaultValue $})</em></p>{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endmacro -%}
{%- macro directiveParam(name, type, join, sep) %}
{%- if type.optional %}[{% endif -%}
{$ name | dashCase $}{$ join $}{$ type.name $}{$ sep $}
{%- if type.optional %}]{% endif -%}
{% endmacro -%}
{%- macro functionSyntax(fn) %}
{%- set sep = joiner(', ') -%}
{% marked -%}
`{$ fn.name $}({%- for param in fn.params %}{$ sep() $}
{%- if param.type.optional %}[{% endif -%}
{$ param.name $}
{%- if param.type.optional %}]{% endif -%}
{% endfor %});`
{%- endmarked %}
{% endmacro -%}
{%- macro typeInfo(fn) -%}
<table class="variables-matrix return-arguments">
<tr>
<td>{$ typeList(fn.typeList) $}</td>
<td>{$ fn.description | marked $}</td>
</tr>
</table>
{%- endmacro -%}
@@ -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>
+26 -5
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.
@@ -140,7 +140,7 @@ or JavaScript callbacks.
{@link ngAnimate#service Services / Factories}
</td>
<td>
Use {@link ngAnimate.$animate $animate} to trigger animation operations within your directive code.
Use {@link ng.$animate $animate} to trigger animation operations within your directive code.
</td>
</tr>
<tr>
@@ -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 and must not contain leading or trailing whitespaces.
+12
View File
@@ -0,0 +1,12 @@
@ngdoc error
@name $compile:noctrl
@fullName Controller is required.
@description
When using the `bindToController` feature of AngularJS, a directive is required
to have a Controller. A controller may be specified by adding a "controller"
property to the directive definition object. Its value should be either a
string, or an invokable object (a function, or an array whose last element is a
function).
For more information, see the {@link guide/directive directives guide}.
+71
View File
@@ -0,0 +1,71 @@
@ngdoc error
@name $compile:noident
@fullName Controller identifier is required.
@description
When using the `bindToController` feature of AngularJS, a directive is required
to have a Controller identifier, which is initialized in scope with the value of
the controller instance. This can be supplied using the "controllerAs" property
of the directive object, or alternatively by adding " as IDENTIFIER" to the controller
name.
For example, the following directives are valid:
```js
// OKAY, because controller is a string with an identifier component.
directive("okay", function() {
return {
bindToController: true,
controller: "myCtrl as $ctrl"
scope: {
text: "@text"
}
};
});
// OKAY, because the directive uses the controllerAs property to override
// the controller identifier.
directive("okay2", function() {
return {
bindToController: true,
controllerAs: "$ctrl",
controller: function() {
},
scope: {
text: "@text"
}
};
});
```
While the following are invalid:
```js
// BAD, because the controller property is a string with no identifier.
directive("bad", function() {
return {
bindToController: true,
controller: "noIdentCtrl",
scope: {
text: "@text"
}
};
});
// BAD because the controller is not a string (therefore has no identifier),
// and there is no controllerAs property.
directive("bad2", function() {
return {
bindToController: true,
controller: function noControllerAs() {
},
scope: {
text: "@text"
}
};
});
```
+17 -1
View File
@@ -36,9 +36,25 @@ Following are invalid uses of this directive:
```
To resolve this error, always use path expressions with scope properties that are two-way data-bound:
To resolve this error, do one of the following options:
- use path expressions with scope properties that are two-way data-bound like so:
```
<my-directive bind="some.property">
<my-directive bind="some[3]['property']">
```
- Make the binding optional
```
myModule.directive('myDirective', function factory() {
return {
...
scope: {
localValue: '=?bind' // <-- the '?' makes it optional
}
...
}
});
```
@@ -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__`
N'either `__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.
+13 -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.
@@ -69,3 +69,15 @@ angular.module('myModule', [])
```
Use the `$controller` service if you want to instantiate controllers yourself.
Attempting to inject a scope object into anything that's not a controller or a directive,
for example a service, will also throw an `Unknown provider: $scopeProvider <- $scope` error.
This might happen if one mistakenly registers a controller as a service, ex.:
```
angular.module('myModule', [])
.service('MyController', ['$scope', function($scope) {
// This controller throws an unknown provider error because
// a scope object cannot be injected into a service.
}]);
```
@@ -0,0 +1,6 @@
@ngdoc error
@name $interpolate:badexpr
@fullName Expecting end operator
@description
The Angular expression is missing the corresponding closing operator.
@@ -0,0 +1,11 @@
@ngdoc error
@name $interpolate:dupvalue
@fullName Duplicate choice in plural/select
@description
You have repeated a match selection for your plural or select MessageFormat
extension in your interpolation expression. The different choices have to be unique.
For more information about the MessageFormat syntax in interpolation
expressions, please refer to MessageFormat extensions section at
{@link guide/i18n#MessageFormat Angular i18n MessageFormat}
@@ -0,0 +1,12 @@
@ngdoc error
@name $interpolate:logicbug
@fullName Bug in ngMessageFormat module
@description
You've just hit a bug in the ngMessageFormat module provided by angular-message-format.min.js.
Please file a github issue for this and provide the interpolation text that caused you to hit this
bug mentioning the exact version of AngularJS used and we will fix it!
For more information about the MessageFormat syntax in interpolation
expressions, please refer to MessageFormat extensions section at
{@link guide/i18n#MessageFormat Angular i18n MessageFormat}
@@ -0,0 +1,17 @@
@ngdoc error
@name $interpolate:nochgmustache
@fullName Redefinition of start/endSymbol incompatible with MessageFormat extensions
@description
You have redefined `$interpolate.startSymbol`/`$interpolate.endSymbol` and also
loaded the `ngMessageFormat` module (provided by angular-message-format.min.js)
while creating your injector.
`ngMessageFormat` currently does not support redefinition of the
startSymbol/endSymbol used by `$interpolate`. If this is affecting you, please
file an issue and mention @chirayuk on it. This is intended to be fixed in a
future commit and the github issue will help gauge urgency.
For more information about the MessageFormat syntax in interpolation
expressions, please refer to MessageFormat extensions section at
{@link guide/i18n#MessageFormat Angular i18n MessageFormat}
@@ -0,0 +1,12 @@
@ngdoc error
@name $interpolate:reqarg
@fullName Missing required argument for MessageFormat
@description
You must specify the MessageFormat function that you're using right after the
comma following the Angular expression. Currently, the supported functions are
"plural" and "select" (for gender selections.)
For more information about the MessageFormat syntax in interpolation
expressions, please refer to MessageFormat extensions section at
{@link guide/i18n#MessageFormat Angular i18n MessageFormat}
@@ -0,0 +1,11 @@
@ngdoc error
@name $interpolate:reqcomma
@fullName Missing comma following MessageFormat plural/select keyword
@description
The MessageFormat syntax requires a comma following the "plural" or "select"
extension keyword in the extended interpolation syntax.
For more information about the MessageFormat syntax in interpolation
expressions, please refer to MessageFormat extensions section at
{@link guide/i18n#MessageFormat Angular i18n MessageFormat}
@@ -0,0 +1,11 @@
@ngdoc error
@name $interpolate:reqendbrace
@fullName Unterminated message for plural/select value
@description
The plural or select message for a value or keyword choice has no matching end
brace to mark the end of the message.
For more information about the MessageFormat syntax in interpolation
expressions, please refer to MessageFormat extensions section at
{@link guide/i18n#MessageFormat Angular i18n MessageFormat}
@@ -0,0 +1,6 @@
@ngdoc error
@name $interpolate:reqendinterp
@fullName Unterminated interpolation
@description
The interpolation text does not have an ending `endSymbol` ("}}" by default) and is unterminated.
@@ -0,0 +1,12 @@
@ngdoc error
@name $interpolate:reqopenbrace
@fullName An opening brace was expected but not found
@description
The plural or select extension keyword or values (such as "other", "male",
"female", "=0", "one", "many", etc.) MUST be followed by a message enclosed in
braces.
For more information about the MessageFormat syntax in interpolation
expressions, please refer to MessageFormat extensions section at
{@link guide/i18n#MessageFormat Angular i18n MessageFormat}
@@ -0,0 +1,13 @@
@ngdoc error
@name $interpolate:reqother
@fullName Required choice "other" for select/plural in MessageFormat
@description
Your interpolation expression with a MessageFormat extension for either
"plural" or "select" (typically used for gender selection) does not contain a
message for the choice "other". Using either select or plural MessageFormat
extensions require that you provide a message for the selection "other".
For more information about the MessageFormat syntax in interpolation
expressions, please refer to MessageFormat extensions section at
{@link guide/i18n#MessageFormat Angular i18n MessageFormat}
@@ -0,0 +1,12 @@
@ngdoc error
@name $interpolate:unknarg
@fullName Unrecognized MessageFormat extension
@description
The MessageFormat extensions provided by `ngMessageFormat` are currently
limited to "plural" and "select". The extension that you have used is either
unsupported or invalid.
For more information about the MessageFormat syntax in interpolation
expressions, please refer to MessageFormat extensions section at
{@link guide/i18n#MessageFormat Angular i18n MessageFormat}
@@ -0,0 +1,10 @@
@ngdoc error
@name $interpolate:unsafe
@fullName MessageFormat extensions not allowed in secure context
@description
You have attempted to use a MessageFormat extension in your interpolation expression that is marked as a secure context. For security purposes, this is not supported.
Read more about secure contexts at {@link ng.$sce Strict Contextual Escaping
(SCE)} and about the MessageFormat extensions at {@link
guide/i18n#MessageFormat Angular i18n MessageFormat}.
@@ -0,0 +1,6 @@
@ngdoc error
@name $interpolate:untermstr
@fullName Unterminated string literal
@description
The string literal was not terminated in your Angular expression.
@@ -0,0 +1,8 @@
@ngdoc error
@name $interpolate:wantstring
@fullName Expected the beginning of a string
@description
We expected to see the beginning of a string (either a single quote or a double
quote character) in the expression but it was not found. The expression is
invalid. If this is incorrect, please file an issue on github.
@@ -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
@@ -35,7 +35,7 @@ URL of the subcontext:
```html
<head>
<base href="/subapp">
<base href="/subapp/">
...
</head>
```
+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}.
+51
View File
@@ -0,0 +1,51 @@
@ngdoc error
@name filter:notarray
@fullName Not an array
@description
This error occurs when {@link ng.filter filter} is not used with an array:
```html
<input ng-model="search">
<div ng-repeat="(key, value) in myObj | filter:search">
{{ key }} : {{ value }}
</div>
```
Filter must be used with an array so a subset of items can be returned.
The array can be initialized asynchronously and therefore null or undefined won't throw this error.
To filter an object by the value of its properties you can create your own custom filter:
```js
angular.module('customFilter',[])
.filter('custom', function() {
return function(input, search) {
if (!input) return input;
if (!search) return input;
var expected = ('' + search).toLowerCase();
var result = {};
angular.forEach(input, function(value, key) {
var actual = ('' + value).toLowerCase();
if (actual.indexOf(expected) !== -1) {
result[key] = value;
}
});
return result;
}
});
```
That can be used as:
```html
<input ng-model="search">
<div ng-repeat="(key, value) in myObj | custom:search">
{{ key }} : {{ value }}
</div>
```
You could as well convert the object to an array using a filter such as
[toArrayFilter](https://github.com/petebacondarwin/angular-toArrayFilter):
```html
<input ng-model="search">
<div ng-repeat="item in myObj | toArray:false | filter:search">
{{ item }}
</div>
```
+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.
+7
View File
@@ -0,0 +1,7 @@
@ngdoc error
@name ng:cpta
@fullName Copying TypedArray
@description
Copying TypedArray's with a destination is not supported because TypedArray
objects can not be mutated, they are fixed length.
+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>
@@ -16,6 +16,8 @@ Reserved names include:
- `this`
- `undefined`
- `$parent`
- `$id`
- `$root`
- `$even`
- `$odd`
- `$first`
+11 -11
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:
@@ -165,7 +165,7 @@ encoded.
`$location` service has two configuration modes which control the format of the URL in the browser
address bar: **Hashbang mode** (the default) and the **HTML5 mode** which is based on using the
HTML5 [History API](http://www.w3.org/TR/html5/introduction.html#history-0). Applications use the same API in
[HTML5 History API](https://html.spec.whatwg.org/multipage/browsers.html#the-history-interface). Applications use the same API in
both modes and the `$location` service will work with appropriate URL segments and browser APIs to
facilitate the browser URL change and history management.
@@ -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
@@ -693,7 +693,7 @@ A path should always begin with forward slash (`/`); the `$location.path()` sett
forward slash if it is missing.
Note that the `!` prefix in the hashbang mode is not part of `$location.path()`; it is actually
hashPrefix.
`hashPrefix`.
## Crawling your app
@@ -835,7 +835,7 @@ angular.module('locationExample', [])
# Related API
* {@link ng.$location $location API}
* {@link ng.$location `$location` API}
+234 -33
View File
@@ -12,7 +12,7 @@ assistive technologies used by persons with disabilities.
##Including ngAria
Using ngAria is as simple as requiring the ngAria module in your application. ngAria hooks into
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.
@@ -20,20 +20,30 @@ at runtime.
angular.module('myApp', ['ngAria'])...
```
###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:
* <a href="#ngmodel">ngModel</a>
* <a href="#ngdisabled">ngDisabled</a>
* <a href="#ngshow">ngShow</a>
* <a href="#nghide">ngHide</a>
* <a href="#ngclick-and-ngdblclick">ngClick</a>
* <a href="#ngclick-and-ngdblclick">ngDblClick</a>
* {@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 [ngModel](https://docs.angularjs.org/api/ng/directive/ngModel)
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`.
has 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):
@@ -47,15 +57,80 @@ attributes (if they have not been explicitly specified by the developer):
###Example
```html
<md-checkbox ng-model="val" required>
```
Becomes:
```html
<md-checkbox ng-model="val" required aria-required="true" tabIndex="0">
```
<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
@@ -106,6 +181,24 @@ screen reader users won't accidentally focus on "mystery elements". Managing tab
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
@@ -114,28 +207,135 @@ 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 <a href="#ngshow">ngShow</a> when overriding the default CSS.
`display: none`. See explanation for {@link guide/accessibility#ngshow ngShow} when overriding the default CSS.
<h2 id="ngclick">ngClick and ngDblClick</h2>
If `ngClick` or `ngDblClick` is encountered, ngAria will add `tabIndex` if it isn't there already.
Even with this, you must currently still add `ng-keypress` to non-interactive elements such as
`<div>` or `<taco-button>` to enable keyboard access. I have recommended this also bind
`ng-keypress` to be more useful; the conversation is [currently ongoing](https://github.com/angular/angular.js/issues/9254).
<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:
you can use the {@link ngAria.$ariaProvider#config config} method. Just keep in mind this will
tell ngAria to ignore the attribute globally.
```
angular.module('myApp', ['ngAria'], function config($ariaProvider) {
$ariaProvider.config({
tabindex: false
<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
@@ -164,6 +364,7 @@ Accessibility best practices that apply to web apps in general also apply to Ang
* [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)
+4 -4
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?
@@ -253,7 +253,7 @@ The table below explains in detail which animation events are triggered
| {@link ng.directive:ngClass#animations ngClass or &#123;&#123;class&#125;&#125;} | add and remove |
| {@link ng.directive:ngShow#animations ngShow & ngHide} | add and remove (the ng-hide class value) |
For a full breakdown of the steps involved during each animation event, refer to the {@link ngAnimate.$animate API docs}.
For a full breakdown of the steps involved during each animation event, refer to the {@link ng.$animate API docs}.
## How do I use animations in my own directives?
@@ -276,6 +276,6 @@ myModule.directive('my-directive', ['$animate', function($animate) {
## More about animations
For a full breakdown of each method available on `$animate`, see the {@link ngAnimate.$animate API documentation}.
For a full breakdown of each method available on `$animate`, see the {@link ng.$animate API documentation}.
To see a complete demo, see the {@link tutorial/step_12 animation step within the AngularJS phonecat tutorial}.
+3 -3
View File
@@ -88,7 +88,7 @@ As a best practice, consider adding an `ng-strict-di` directive on the same elem
```
This will ensure that all services in your application are properly annotated.
See the {@link guide/di#using-strict-dependency-injection dependancy injection strict mode} docs
See the {@link guide/di#using-strict-dependency-injection dependency injection strict mode} docs
for more.
@@ -145,7 +145,7 @@ This is the sequence that your code should follow:
## Deferred Bootstrap
This feature enables tools like [Batarang](github.com/angular/angularjs-batarang) and test runners
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.
@@ -156,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
+17 -17
View File
@@ -55,11 +55,11 @@ Try out the Live Preview above, and then let's walk through the example and desc
<img class="pull-right" style="padding-left: 3em; padding-bottom: 1em;" src="img/guide/concepts-databinding1.png">
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>.
The loaded, transformed and rendered DOM is then called the <a name="view">"view"</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 <a name="compiler">{@link compiler compiler}</a>.
The loaded, transformed and rendered DOM is then called the <a name="view"></a>*view*.
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 <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`}
@@ -75,16 +75,16 @@ stores/updates the value of the input field into/from a variable.
The second kind of new markup are the double curly braces `{{ expression | filter }}`:
When the compiler encounters this markup, it will replace it with the evaluated value of the markup.
An <a name="expression">"{@link expression expression}"</a> in a template is a JavaScript-like code snippet that allows
An <a name="expression">{@link expression expression}</a> in a template is a JavaScript-like code snippet that allows
to read and write variables. Note that those variables are not global variables.
Just like variables in a JavaScript function live in a scope,
Angular provides a <a name="scope">"{@link scope scope}"</a> for the variables accessible to expressions.
The values that are stored in variables on the scope are referred to as the <a name="model">"model"</a>
Angular provides a <a name="scope">{@link scope scope}</a> for the variables accessible to expressions.
The values that are stored in variables on the scope are referred to as the <a name="model"></a>*model*
in the rest of the documentation.
Applied to the example above, the markup directs Angular to "take the data we got from the input widgets
and multiply them together".
The example above also contains a <a name="filter">"{@link guide/filter filter}"</a>.
The example above also contains a <a name="filter">{@link guide/filter filter}</a>.
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.
@@ -92,7 +92,7 @@ into an output that looks like money.
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>.
The concept behind this is <a name="databinding">{@link databinding two-way data binding}</a>.
## Adding UI logic: Controllers
@@ -150,11 +150,11 @@ 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 <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
and all of the element's children.
@@ -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.
@@ -255,15 +255,15 @@ We moved the `convertCurrency` function and the definition of the existing curre
into the new file `finance2.js`. But how does the controller
get a hold of the now separated function?
This is where <a name="di">"{@link di Dependency Injection}"</a> comes into play.
This is where <a name="di">{@link di Dependency Injection}</a> comes into play.
Dependency Injection (DI) is a software design pattern that
deals with how objects and functions get created and how they get a hold of their dependencies.
Everything within Angular (directives, filters, controllers,
services, ...) is created and wired using dependency injection. Within Angular,
the DI container is called the <a name="injector">"{@link di injector}"</a>.
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 <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.
+8 -8
View File
@@ -30,12 +30,12 @@ Do not use controllers to:
services} instead.
- Manage the life-cycle of other components (for example, to create service instances).
# Setting up the initial state of a `$scope` object
## Setting up the initial state of a `$scope` object
Typically, when you create an application you need to set up the initial state for the Angular
`$scope`. You set up the initial state of a scope by attaching properties to the `$scope` object.
The properties contain the **view model** (the model that will be presented by the view). All the
`$scope` properties will be available to the template at the point in the DOM where the Controller
`$scope` properties will be available to the {@link templates template} at the point in the DOM where the Controller
is registered.
The following example demonstrates creating a `GreetingController`, which attaches a `greeting`
@@ -69,13 +69,13 @@ now be data-bound to the template:
```
# Adding Behavior to a Scope Object
## Adding Behavior to a Scope Object
In order to react to events or execute computation in the view we must provide behavior to the
scope. We add behavior to the scope by attaching methods to the `$scope` object. These methods are
then available to be called from the template/view.
The following example uses a Controller to add a method to the scope, which doubles a number:
The following example uses a Controller to add a method, which doubles a number, to the scope:
```js
var myApp = angular.module('myApp',[]);
@@ -99,7 +99,7 @@ objects (or primitives) assigned to the scope become model properties. Any metho
the scope are available in the template/view, and can be invoked via angular expressions
and `ng` event handler directives (e.g. {@link ng.directive:ngClick ngClick}).
# Using Controllers Correctly
## Using Controllers Correctly
In general, a Controller shouldn't try to do too much. It should contain only the business logic
needed for a single view.
@@ -125,7 +125,7 @@ following components:
- A model consisting of a string named `spice`
- A Controller with two functions that set the value of `spice`
The message in our template contains a binding to the `spice` model, which by default is set to the
The message in our template contains a binding to the `spice` model which, by default, is set to the
string "very". Depending on which button is clicked, the `spice` model is set to `chili` or
`jalapeño`, and the message is automatically updated by data-binding.
@@ -259,7 +259,7 @@ Inheritance works with methods in the same way as it does with properties. So in
examples, all of the properties could be replaced with methods that return string values.
## Testing Controllers
# Testing Controllers
Although there are many ways to test a Controller, one of the best conventions, shown below,
involves injecting the {@link ng.$rootScope $rootScope} and {@link ng.$controller $controller}:
@@ -326,7 +326,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
+2
View File
@@ -3,6 +3,8 @@
@sortOrder 210
@description
# Data Binding
Data-binding in Angular apps is the automatic synchronization of data between the model and view
components. The way that Angular implements data-binding lets you treat the model as the
single-source-of-truth in your application. The view is a projection of the model at all times.
+57 -32
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`).
@@ -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
@@ -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);
}
}
};
}]);
+4 -4
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,7 +23,7 @@ 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.
@@ -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
+32 -13
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.
@@ -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`}
@@ -283,23 +297,29 @@ then the expression is not fulfilled and will remain watched.
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
deregistration tasks. For each watch to be deregistered check if it still evaluates
to value that is not `undefined`. If that's the case, deregister the watch. Otherwise
4. When digest loop is done and all the values have settled, process the queue of watch
deregistration tasks. For each watch to be deregistered, check if it still evaluates
to a value that is not `undefined`. If that's the case, deregister the watch. Otherwise,
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>
<div name="attr: {{::color}}">text: {{::name | uppercase}}</div>
```
When using a directive with bidirectional binding and the parameters will not change
When using a directive with bidirectional binding and parameters that 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>
<li ng-repeat="item in ::items | orderBy:'name'">{{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.
+61 -49
View File
@@ -3,17 +3,20 @@
@sortOrder 290
@description
# Forms
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
## 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}
@@ -27,8 +30,8 @@ for other directives to augment its behavior.
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>
@@ -61,7 +64,7 @@ For example: inputs of type `email` must have a value in the form of `user@domai
# Using CSS classes
## Using CSS classes
To allow styling of form as well as controls, `ngModel` adds these CSS classes:
@@ -77,29 +80,29 @@ To allow styling of form as well as controls, `ngModel` adds these CSS classes:
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.
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>
</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>
@@ -125,13 +128,13 @@ with an error until after interacting with the control, and failing to satisfy i
# Binding to form and control state
## Binding to form and control state
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
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.
@@ -140,34 +143,45 @@ 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>
</div>
</file>
@@ -181,14 +195,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>
@@ -196,7 +210,7 @@ This allows us to extend the above example with these features:
# Custom model update 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
@@ -237,7 +251,7 @@ will update the model only when the control loses focus (blur event).
# Non-immediate (debounced) model updates
## Non-immediate (debounced) model updates
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
@@ -278,11 +292,11 @@ after last change.
</file>
</example>
# Custom Validation
## 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}),
{@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`).
@@ -328,7 +342,7 @@ In the following example we create two directives:
<div>
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.$pending.username">Checking if this name is available...</span>
<span ng-show="form.name.$error.username">This username is already taken!</span>
</div>
@@ -395,7 +409,7 @@ In the following example we create two directives:
</file>
</example>
# Modifying built-in validators
## 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
@@ -440,7 +454,7 @@ Note that you can alternatively use `ng-pattern` to further restrict the validat
</example>
# Implementing custom form controls (using `ngModel`)
## 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,
@@ -477,9 +491,7 @@ The following example shows how to add two-way data-binding to contentEditable e
link: function(scope, elm, attrs, ctrl) {
// view -> model
elm.on('blur', function() {
scope.$apply(function() {
ctrl.$setViewValue(elm.html());
});
ctrl.$setViewValue(elm.html());
});
// model -> view
+243 -2
View File
@@ -18,8 +18,10 @@ application means providing translations and localized formats for the abstracte
Angular supports i18n/l10n for {@link ng.filter:date date}, {@link ng.filter:number number} and
{@link ng.filter:currency currency} filters.
Additionally, Angular supports localizable pluralization support through the {@link
ng.directive:ngPluralize `ngPluralize` directive}.
Localizable pluralization is supported via the {@link ng.directive:ngPluralize `ngPluralize`
directive}. Additionally, you can use {@link guide/i18n#messageformat-extensions MessageFormat extensions} to
`$interpolate` for localizable pluralization and gender support in all interpolations via the
`ngMessageFormat` module.
All localizable Angular components depend on locale-specific rule sets managed by the {@link
ng.$locale `$locale` service}.
@@ -137,3 +139,242 @@ The Angular datetime filter uses the time zone settings of the browser. The same
application will show different time information depending on the time zone settings of the
computer that the application is running on. Neither JavaScript nor Angular currently supports
displaying the date with a timezone specified by the developer.
<a name="MessageFormat"></a>
## MessageFormat extensions
You can write localizable plural and gender based messages in Angular interpolation expressions and
`$interpolate` calls.
This syntax extension is provided by way of the `ngMessageFormat` module that your application can
depend upon (shipped separately as `angular-message-format.min.js` and `angular-message-format.js`.)
A current limitation of the `ngMessageFormat` module, is that it does not support redefining the
`$interpolate` start and end symbols. Only the default `{{` and `}}` are allowed.
The syntax extension is based on a subset of the ICU MessageFormat syntax that covers plurals and
gender selections. Please refer to the links in the “Further Reading” section at the bottom of this
section.
You may find it helpful to play with our [Plnkr Example](http://plnkr.co/edit/QBVRQ70dvKZDWmHW9RyR?p=preview)
as you read the examples below.
### Plural Syntax
The syntax for plural based message selection looks like the following:
```text
{{NUMERIC_EXPRESSION, plural,
=0 {MESSAGE_WHEN_VALUE_IS_0}
=1 {MESSAGE_WHEN_VALUE_IS_1}
=2 {MESSAGE_WHEN_VALUE_IS_2}
=3 {MESSAGE_WHEN_VALUE_IS_3}
...
zero {MESSAGE_WHEN_PLURAL_CATEGORY_IS_ZERO}
one {MESSAGE_WHEN_PLURAL_CATEGORY_IS_ONE}
two {MESSAGE_WHEN_PLURAL_CATEGORY_IS_TWO}
few {MESSAGE_WHEN_PLURAL_CATEGORY_IS_FEW}
many {MESSAGE_WHEN_PLURAL_CATEGORY_IS_MANY}
other {MESSAGE_WHEN_THERE_IS_NO_MATCH}
}}
```
Please note that whitespace (including newline) is generally insignificant except as part of the
actual message text that occurs in curly braces. Whitespace is generally used to aid readability.
Here, `NUMERIC_EXPRESSION` is an expression that evaluates to a numeric value based on which the
displayed message should change based on pluralization rules.
Following the Angular expression, you would denote the plural extension syntax by the `, plural,`
syntax element. The spaces there are optional.
This is followed by a list of selection keyword and corresponding message pairs. The "other"
keyword and corresponding message are **required** but you may have as few or as many of the other
categories as you need.
#### Selection Keywords
The selection keywords can be either exact matches or language dependent [plural
categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html).
Exact matches are written as the equal sign followed by the exact value. `=0`, `=1`, `=2` and
`=123` are all examples of exact matches. Note that there should be no space between the equal sign
and the numeric value.
Plural category matches are single words corresponding to the [plural
categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html) of
the CLDR plural category spec. These categories vary by locale. The "en" (English) locale, for
example, defines just "one" and "other" while the "ga" (Irish) locale defines "one", "two", "few",
"many" and "other". Typically, you would just write the categories for your language. During
translation, the translators will add or remove more categories depending on the target locale.
Exact matches always win over keyword matches. Therefore, if you define both `=0` and `zero`, when
the value of the expression is zero, the `=0` message is the one that will be selected. (The
duplicate keyword categories are helpful when used with the optional `offset` syntax described
later.)
#### Messages
Messages immediately follow a selection keyword and are optionally preceded by whitespace. They are
written in single curly braces (`{}`). They may contain Angular interpolation syntax inside them.
In addition, the `#` symbol is a placeholder for the actual numeric value of the expression.
### Simple plural example
```text
{{numMessages, plural,
=0 {You have no new messages}
=1 {You have one new message}
other {You have # new messages}
}}
```
Because these messages can themselves contain Angular expressions, you could also write this as
follows:
```text
{{numMessages, plural,
=0 {You have no new messages}
=1 {You have one new message}
other {You have {{numMessages}} new messages}
}}
```
### Plural syntax with optional `offset`
The plural syntax supports an optional `offset` syntax that is used in matching. It's simpler to
explain this with an example.
```text
{{recipients.length, plural, offset:1
=0 {You gave no gifts}
=1 {You gave {{recipients[0].name}} a gift}
one {You gave {{recipients[0].name}} and one other person a gift}
other {You gave {{recipients[0].name}} and # other people a gift}
}}
```
When an `offset` is specified, the matching works as follows. First, the exact value of the Angular
expression is matched against the exact matches (i.e. `=N` selectors) to find a match. If there is
one, that message is used. If there was no match, then the offset value is subtracted from the
value of the expression and locale specific pluralization rules are applied to this new value to
obtain its plural category (such as “one”, “few”, “many”, etc.) and a match is attempted against the
keyword selectors and the matching message is used. If there was no match, then the “other”
category (required) is used. The value of the `#` character inside a message is the value of
original expression reduced by the offset value that was specified.
### Escaping / Quoting
You will need to escape curly braces or the `#` character inside message texts if you want them to
be treated literally with no special meaning. You may quote/escape any character in your message
text by preceding it with a `\` (backslash) character. The backslash character removes any special
meaning to the character that immediately follows it. Therefore, you can escape or quote the
backslash itself by preceding it with another backslash character.
### Gender (aka select) Syntax
The gender support is provided by the more generic "select" syntax that is more akin to a switch
statement. It is general enough to support use for gender based messages.
The syntax for gender based message selection looks like the following:
```text
{{EXPRESSION, select,
male {MESSAGE_WHEN_EXPRESSION_IS_MALE}
female {MESSAGE_WHEN_EXPRESSION_IS_FEMALE}
...
other {MESSAGE_WHEN_THERE_IS_NO_GENDER_MATCH}
}}
```
Please note that whitespace (including newline) is generally insignificant except as part of the
actual message text that occurs in curly braces. Whitespace is generally used to aid readability.
Here, `EXPRESSION` is an Angular expression that evaluates to the gender of the person that
is used to select the message that should be displayed.
The Angular expression is followed by `, select,` where the spaces are optional.
This is followed by a list of selection keyword and corresponding message pairs. The "other"
keyword and corresponding message are **required** but you may have as few or as many of the other
gender values as you need (i.e. it isn't restricted to male/female.) Note however, that the
matching is **case-sensitive**.
#### Selection Keywords
Selection keywords are simple words like "male" and "female". The keyword, "other", and its
corresponding message are required while others are optional. It is used when the Angular
expression does not match (case-insensitively) any of the other keywords specified.
#### Messages
Messages immediately follow a selection keyword and are optionally preceded by whitespace. They are
written in single curly braces (`{}`). They may contain Angular interpolation syntax inside them.
### Simple gender example
```text
{{friendGender, select,
male {Invite him}
female {Invite her}
other {Invite them}
}}
```
### Nesting
As mentioned in the syntax for plural and select, the embedded messages can contain Angular
interpolation syntax. Since you can use MessageFormat extensions in Angular interpolation, this
allows you to nest plural and gender expressions in any order.
Please note that if these are intended to reach a translator and be translated, it is recommended
that the messages appear as a whole and not be split up.
### More complex example that demonstrates nesting
This is taken from the [plunker example](http://plnkr.co/edit/QBVRQ70dvKZDWmHW9RyR?p=preview) linked to earlier.
```text
{{recipients.length, plural, offset:1
=0 {You ({{sender.name}}) gave no gifts}
=1 { {{ recipients[0].gender, select,
male {You ({{sender.name}}) gave him ({{recipients[0].name}}) a gift.}
female {You ({{sender.name}}) gave her ({{recipients[0].name}}) a gift.}
other {You ({{sender.name}}) gave them ({{recipients[0].name}}) a gift.}
}}
}
one { {{ recipients[0].gender, select,
male {You ({{sender.name}}) gave him ({{recipients[0].name}}) and one other person a gift.}
female {You ({{sender.name}}) gave her ({{recipients[0].name}}) and one other person a gift.}
other {You ({{sender.name}}) gave them ({{recipients[0].name}}) and one other person a gift.}
}}
}
other {You ({{sender.name}}) gave {{recipients.length}} people gifts. }
}}
```
### Differences from the ICU MessageFormat syntax
This section is useful to you if you're already familiar with the ICU MessageFormat syntax.
This syntax extension, while based on MessageFormat, has been designed to be backwards compatible
with existing AngularJS interpolation expressions. The key rule is simply this: **All
interpolations are done inside double curlies.** The top level comma operator after an expression
inside the double curlies causes MessageFormat extensions to be recognized. Such a top level comma
is otherwise illegal in an Angular expression and is used by MessageFormat to specify the function
(such as plural/select) and it's related syntax.
To understand the extension, take a look at the ICU MessageFormat syntax as specified by the ICU
documentation. Anywhere in that MessageFormat that you have regular message text and you want to
substitute an expression, just put it in double curlies instead of single curlies that MessageFormat
dictates. This has a huge advantage. **You are no longer limited to simple identifiers for
substitutions**. Because you are using double curlies, you can stick in any arbitrary interpolation
syntax there, including nesting more MessageFormat expressions!
### Further Reading
For more details, please refer to our [design doc](https://docs.google.com/a/google.com/document/d/1pbtW2yvtmFBikfRrJd8VAsabiFkKezmYZ_PbgdjQOVU/edit).
You can read more about the ICU MessageFormat syntax at
[Formatting Messages | ICU User Guide](http://userguide.icu-project.org/formatparse/messages#TOC-MessageFormat).
+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).
+8 -5
View File
@@ -41,7 +41,7 @@ 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}
@@ -53,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 Faceb0ok 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)
@@ -62,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)
@@ -101,13 +102,15 @@ This is a short list of libraries with specific support and documentation for wo
## 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/)
@@ -116,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/)
+12 -12
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,10 +28,10 @@ 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 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.
+627 -146
View File
@@ -13,30 +13,437 @@ which drives many of these changes.
* Several new features, especially animations, would not be possible without a few changes.
* Finally, some outstanding bugs were best fixed by changing an existing API.
# Migrating from 1.3 to 1.4
Angular 1.4 fixes major animation issues and introduces a new API for `ngCookies`. Further, there
are changes to `ngMessages`, `$compile`, `ngRepeat`, `ngOptions `and some fixes to core filters:
`limitTo` and `filter`.
The reason for the ngAnimate refactor was to fix timing issues and to expose new APIs to allow
for developers to construct more versatile animations. We now have access to `$animateCss`
and the many timing-oriented bugs were fixed which results in smoother animations.
If animation is something of interest, then please read over the breaking changes below for animations when
`ngAnimate` is used.
`ngMessages` has been upgraded to allow for dynamic message resolution. This handy feature allows for developers
to render error messages with ngMessages that are listed with a directive such as ngRepeat. A great usecase for this
involves pulling error message data from a server and then displaying that data via the mechanics of ngMessages. Be
sure to read the breaking change involved with `ngMessagesInclude` to upgrade your template code.
Other changes, such as the ordering of elements with ngRepeat and ngOptions, may also affect the behavior of your
application. And be sure to also read up on the changes to `$cookies`. The migration jump from 1.3 to 1.4 should be
relatively straightforward otherwise.
## Animation (`ngAnimate`)
Animations in 1.4 have been refactored internally, but the API has stayed much the same. There are, however,
some breaking changes that need to be addressed when upgrading to 1.4.
Due to [c8700f04](https://github.com/angular/angular.js/commit/c8700f04fb6fb5dc21ac24de8665c0476d6db5ef),
JavaScript and CSS animations can no longer be run in
parallel. With earlier versions of ngAnimate, both CSS and JS animations
would be run together when multiple animations were detected. This
feature has been removed, however, the same effect, with even more
possibilities, can be achieved by injecting `$animateCss` into a
JavaScript-defined animation and creating custom CSS-based animations
from there.
By using `$animateCss` inside of a JavaScript animation in Angular 1.4, we can trigger custom CSS-based animations
directly from our JavaScript code.
```js
ngModule.animation('.slide-animation', ['$animateCss', function($animateCss) {
return {
enter: function(element, doneFn) {
// this will trigger a `.ng-enter` and `.ng-enter-active` CSS animation
var animation = $animateCss(element, {
event: 'enter'
// any other CSS-related properties
// addClass: 'some-class',
// removeClass: 'some-other-class',
// from: {},
// to: {}
});
// make sure to read the ngAnimate docs to understand how this works
animation.start().done(doneFn);
}
}
}]);
```
{@link ngAnimate.$animateCss Click here to learn how to use $animateCss in your animation code}
Due to [c8700f04](https://github.com/angular/angular.js/commit/c8700f04fb6fb5dc21ac24de8665c0476d6db5ef),
animation-related callbacks are now fired on `$animate.on` instead of directly being on the element.
```js
// < 1.4
element.on('$animate:before', function(e, data) {
if (data.event === 'enter') { ... }
});
element.off('$animate:before', fn);
// 1.4+
$animate.on('enter', element, function(data) {
//...
});
$animate.off('enter', element, fn);
```
Due to [c8700f04](https://github.com/angular/angular.js/commit/c8700f04fb6fb5dc21ac24de8665c0476d6db5ef),
the function params for `$animate.enabled()` when an element is used are now flipped. This fix allows
the function to act as a getter when a single element param is provided.
```js
// < 1.4
$animate.enabled(false, element);
// 1.4+
$animate.enabled(element, false);
```
Due to [c8700f04](https://github.com/angular/angular.js/commit/c8700f04fb6fb5dc21ac24de8665c0476d6db5ef),
in addition to disabling the children of the element, `$animate.enabled(element, false)` will now also
disable animations on the element itself.
Due to [c8700f04](https://github.com/angular/angular.js/commit/c8700f04fb6fb5dc21ac24de8665c0476d6db5ef),
there is no need to call `$scope.$apply` or `$scope.$digest` inside of a animation promise callback anymore
since the promise is resolved within a digest automatically. (Not to worry, any extra digests will not be
run unless the promise is used.)
```js
// < 1.4
$animate.enter(element).then(function() {
$scope.$apply(function() {
$scope.explode = true;
});
});
// 1.4+
$animate.enter(element).then(function() {
$scope.explode = true;
});
```
Due to [c8700f04](https://github.com/angular/angular.js/commit/c8700f04fb6fb5dc21ac24de8665c0476d6db5ef),
when an enter, leave or move animation is triggered then it will always end any pending or active parent
class based animations (animations triggered via ngClass) in order to ensure that any CSS styles are resolved in time.
## Forms (`ngMessages`, `ngOptions`, `select`)
### ngMessages
The ngMessages module has also been subject to an internal refactor to allow it to be more flexible
and compatible with dynamic message data. The `ngMessage` directive now supports a new attribute
called `ng-message-exp` which will evaluate an expression and will keep track of that expression
as it changes in order to re-evaluate the listed messages.
[Click here to learn more about dynamic ng-messages](https://docs.angularjs.org/api/ngMessages#dynamic-messaging)
There is only one breaking change. Please consider the following when including remote
message templates via `ng-messages-include`:
Due to [c9a4421f](https://github.com/angular/angular.js/commit/c9a4421fc3c97448527eadef1f42eb2f487ec2e0),
the `ngMessagesInclude` attribute has now been removed and cannot be used in the same element containing
the `ngMessages` directive. Instead, `ngMessagesInclude` is to be used on its own element inline with
other inline messages situated as children within the `ngMessages` container directive.
```html
<!-- AngularJS 1.3.x -->
<div ng-messages="model.$error" ng-messages-include="remote.html">
<div ng-message="required">Your message is required</div>
</div>
<!-- AngularJS 1.4.x -->
<div ng-messages="model.$error">
<div ng-message="required">Your message is required</div>
<div ng-messages-include="remote.html"></div>
</div>
```
Depending on where the `ngMessagesInclude` directive is placed it will be prioritized inline with the other messages
before and after it.
### ngOptions
The `ngOptions` directive has also been refactored and as a result some long-standing bugs
have been fixed. The breaking changes are comparatively minor and should not affect most applications.
Due to [7fda214c](https://github.com/angular/angular.js/commit/7fda214c4f65a6a06b25cf5d5aff013a364e9cef),
when `ngOptions` renders the option values within the DOM, the resulting HTML code is different.
Normally this should not affect your application at all, however, if your code relies on inspecting
the value property of `<option>` elements (that `ngOptions` generates) then be sure
to [read the details](https://github.com/angular/angular.js/commit/7fda214c4f65a6a06b25cf5d5aff013a364e9cef).
Due to [7fda214c](https://github.com/angular/angular.js/commit/7fda214c4f65a6a06b25cf5d5aff013a364e9cef),
when iterating over an object's properties using the `(key, value) in obj` syntax
the order of the elements used to be sorted alphabetically. This was an artificial
attempt to create a deterministic ordering since browsers don't guarantee the order.
But in practice this is not what people want and so this change iterates over properties
in the order they are returned by Object.keys(obj), which is almost always the order
in which the properties were defined.
### select
Due to [7fda214c](https://github.com/angular/angular.js/commit/7fda214c4f65a6a06b25cf5d5aff013a364e9cef),
the `select` directive will now use strict comparison of the `ngModel` scope value against `option`
values to determine which option is selected. This means `Number` scope values will not be matched
against numeric option strings.
In Angular 1.3.x, setting `scope.x = 200` would select the option with the value 200 in the following `select`:
```
<select ng-model="x">
<option value="100">100</option>
<option value="200">200</option>
</select>
```
In Angular 1.4.x, the 'unknown option' will be selected.
To remedy this, you can simply initialize the model as a string: `scope.x = '200'`, or if you want to
keep the model as a `Number`, you can do the conversion via `$formatters` and `$parsers` on `ngModel`:
```js
ngModelCtrl.$parsers.push(function(value) {
return parseInt(value, 10); // Convert option value to number
});
ngModelCtrl.$formatters.push(function(value) {
return value.toString(); // Convert scope value to string
});
```
## Templating (`ngRepeat`, `$compile`)
### ngRepeat
Due to [c260e738](https://github.com/angular/angular.js/commit/c260e7386391877625eda086480de73e8a0ba921),
previously, the order of items when using ngRepeat to iterate over object properties was guaranteed to be consistent
by sorting the keys into alphabetic order.
Now, the order of the items is browser dependent based on the order returned
from iterating over the object using the `for key in obj` syntax.
It seems that browsers generally follow the strategy of providing
keys in the order in which they were defined, although there are exceptions
when keys are deleted and reinstated. See
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete#Cross-browser_issues
The best approach is to convert Objects into Arrays by a filter such as
https://github.com/petebacondarwin/angular-toArrayFilter
or some other mechanism, and then sort them manually in the order you need.
### $compile
Due to [6a38dbfd](https://github.com/angular/angular.js/commit/6a38dbfd3c34c8f9efff503d17eb3cbeb666d422),
previously, '&' expressions would always set up a function in the isolate scope. Now, if the binding
is marked as optional and the attribute is not specified, no function will be added to the isolate scope.
Due to [62d514b](https://github.com/angular/angular.js/commit/62d514b06937cc7dd86e973ea11165c88343b42d),
returning an object from a controller constructor function will now override the scope. Views that use the
controllerAs method will no longer get the this reference, but the returned object.
## Cookies (`ngCookies`)
Due to [38fbe3ee](https://github.com/angular/angular.js/commit/38fbe3ee8370fc449b82d80df07b5c2ed2cd5fbe),
`$cookies` will no longer expose properties that represent the current browser cookie
values. `$cookies` no longer polls the browser for changes to the cookies and ***no longer copies
cookie values onto the `$cookies` object***.
This was changed because the polling is expensive and caused issues with the `$cookies` properties
not synchronizing correctly with the actual browser cookie values (The reason the polling
was originally added was to allow communication between different tabs,
but there are better ways to do this today, for example `localStorage`.)
The new API on `$cookies` is as follows:
* `get`
* `put`
* `getObject`
* `putObject`
* `getAll`
* `remove`
You must explictly use the methods above in order to access cookie data. This also means that
you can no longer watch the properties on `$cookies` to detect changes
that occur on the browsers cookies.
This feature is generally only needed if a 3rd party library was programmatically
changing the cookies at runtime. If you rely on this then you must either write code that
can react to the 3rd party library making the changes to cookies or implement your own polling
mechanism.
**DEPRECATION NOTICE**
`$cookieStore` is now deprecated as all the useful logic
has been moved to `$cookies`, to which `$cookieStore` now simply
delegates calls.
## Server Requests (`$http`)
Due to [5da1256](https://github.com/angular/angular.js/commit/5da1256fc2812d5b28fb0af0de81256054856369),
`transformRequest` functions can no longer modify request headers.
Before this commit `transformRequest` could modify request headers, ex.:
```javascript
function requestTransform(data, headers) {
headers = angular.extend(headers(), {
'X-MY_HEADER': 'abcd'
});
}
return angular.toJson(data);
}
```
This behavior was unintended and undocumented, so the change should affect very few applications. If one
needs to dynamically add / remove headers it should be done in a header function, for example:
```javascript
$http.get(url, {
headers: {
'X-MY_HEADER': function(config) {
return 'abcd'; //you've got access to a request config object to specify header value dynamically
}
}
})
```
## Filters (`filter`, `limitTo`)
### `filter` filter
Due to [cea8e751](https://github.com/angular/angular.js/commit/cea8e75144e6910b806b63a6ec2a6d118316fddd),
the `filter` filter will throw an error when used with a non-array. Beforehand it would silently
return an empty array.
If necessary, this can be worked around by converting an object to an array,
using a filter such as https://github.com/petebacondarwin/angular-toArrayFilter.
### `limitTo` filter
Due to [a3c3bf33](https://github.com/angular/angular.js/commit/a3c3bf3332e5685dc319c46faef882cb6ac246e1),
the limitTo filter has changed behavior when the provided limit value is invalid.
Now, instead of returning empty object/array, it returns unchanged input.
# 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 +460,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 +521,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 +580,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 +651,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 +707,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 +761,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 +782,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 +817,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 +1244,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 +1501,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
+3 -3
View File
@@ -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 consists of a collection of two kinds
of blocks:
1. **Configuration blocks** - get executed during the provider registrations and configuration
@@ -197,14 +197,14 @@ Then Angular applies configuration blocks in the same order they were registered
## Run Blocks
Run blocks are the closest thing in Angular to the main method. A run block is the code which
needs to run to kickstart the application. It is executed after all of the service have been
needs to run to kickstart the application. It is executed after all of the services have been
configured and the injector has been created. Run blocks typically contain code which is hard
to unit-test, and for this reason should be declared in isolated modules, so that they can be
ignored in the unit-tests.
## Dependencies
Modules can list other modules as their dependencies. Depending on a module implies that required
Modules can list other modules as their dependencies. Depending on a module implies that the required
module needs to be loaded before the requiring module is loaded. In other words the configuration
blocks of the required modules execute before the configuration blocks of the requiring module.
The same is true for the run blocks. Each module can only be loaded once, even if multiple other
+5 -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()`.
+5 -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.
@@ -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.
@@ -345,7 +345,7 @@ access on JavaScript object.
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 stategy.
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
+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 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}
+2 -2
View File
@@ -82,7 +82,7 @@ on the service.
### Registering Services
Services are registered to modules via the {@link angular.Module Module API}.
Typically you use the {@link angular.module Module#factory} API to register a service:
Typically you use the {@link angular.Module#factory Module factory} API to register a service:
```js
var myModule = angular.module('myModule', []);
@@ -181,7 +181,7 @@ of a real browser alert.
```js
var mock, notify;
beforeEach(module('myServiceModule'));
beforeEach(function() {
mock = {alert: jasmine.createSpy()};
+223 -223
View File
@@ -8,15 +8,15 @@ comes with almost no help from the compiler. For this reason we feel very strong
written in JavaScript needs to come with a strong set of tests. We have built many features into
Angular which makes testing your Angular applications easy. So there is no excuse for not testing.
# Separation of Concerns
## Separation of Concerns
Unit testing as the name implies is about testing individual units of code. Unit tests try to
Unit testing, as the name implies, is about testing individual units of code. Unit tests try to
answer questions such as "Did I think about the logic correctly?" or "Does the sort function order
the list in the right order?"
In order to answer such a question it is very important that we can isolate the unit of code under test.
That is because when we are testing the sort function we don't want to be forced into creating
related pieces such as the DOM elements, or making any XHR calls in getting the data to sort.
related pieces such as the DOM elements, or making any XHR calls to fetch the data to sort.
While this may seem obvious it can be very difficult to call an individual function on a
typical project. The reason is that the developers often mix concerns resulting in a
@@ -24,12 +24,10 @@ piece of code which does everything. It makes an XHR request, it sorts the respo
manipulates the DOM.
With Angular we try to make it easy for you to do the right thing, and so we
provide dependency injection for your XHR (which you can mock out) and we created abstractions which
allow you to sort your model without having to resort to manipulating the DOM. So that in the end,
it is easy to write a sort function which sorts some data, so that your test can create a data set,
apply the function, and assert that the resulting model is in the correct order. The test does not
have to wait for the XHR response to arrive, create the right kind of test DOM, nor assert that your
function has mutated the DOM in the right way.
provide dependency injection for your XHR requests, which can be mocked, and we provide abstractions which
allow you to test your model without having to resort to manipulating the DOM. The test can then
assert that the data has been sorted without having to create or look at the state of the DOM or
wait for any XHR requests to return data. The individual sort function can be tested in isolation.
## With great power comes great responsibility
@@ -38,230 +36,218 @@ We tried to make the right thing easy, but if you ignore these guidelines you ma
untestable application.
## Dependency Injection
There are several ways in which you can get a hold of a dependency. You can:
1. Create it using the `new` operator.
2. Look for it in a well-known place, also known as a global singleton.
3. Ask a registry (also known as service registry) for it. (But how do you get a hold of
the registry? Most likely by looking it up in a well known place. See #2.)
4. Expect it to be handed to you.
Out of the four options in the list above, only the last one is testable. Let's look at why:
Angular comes with {@link di dependency injection} built-in, which makes testing components much
easier, because you can pass in a component's dependencies and stub or mock them as you wish.
### Using the `new` operator
Components that have their dependencies injected allow them to be easily mocked on a test by
test basis, without having to mess with any global variables that could inadvertently affect
another test.
While there is nothing wrong with the `new` operator fundamentally, a problem arises when calling `new`
on a constructor. This permanently binds the call site to the type. For example, let's say that we try to
instantiate an `XHR` that will retrieve data from the server.
## Additional tools for testing Angular applications
For testing Angular applications there are certain tools that you should use that will make testing much
easier to set up and run.
### Karma
[Karma](http://karma-runner.github.io/) is a JavaScript command line tool that can be used to spawn
a web server which loads your application's source code and executes your tests. You can configure
Karma to run against a number of browsers, which is useful for being confident that your application
works on all browsers you need to support. Karma is executed on the command line and will display
the results of your tests on the command line once they have run in the browser.
Karma is a NodeJS application, and should be installed through npm. Full installation instructions
are available on [the Karma website](http://karma-runner.github.io/0.12/intro/installation.html).
### Jasmine
[Jasmine](http://jasmine.github.io/1.3/introduction.html) is a behavior driven development framework for
JavaScript that has become the most popular choice for testing Angular applications. Jasmine
provides functions to help with structuring your tests and also making assertions. As your tests
grow, keeping them well structured and documented is vital, and Jasmine helps achieve this.
In Jasmine we use the `describe` function to group our tests together:
```js
function MyClass() {
this.doWork = function() {
var xhr = new XHR();
xhr.open(method, url, true);
xhr.onreadystatechange = function() {...}
xhr.send();
}
}
describe("sorting the list of users", function() {
// individual tests go here
});
```
A problem surfaces in tests when we would like to instantiate a `MockXHR` that would
allow us to return fake data and simulate network failures. By calling `new XHR()` we are
permanently bound to the actual XHR and there is no way to replace it. Yes, we could monkey
patch, but that is a bad idea for many reasons which are outside the scope of this document.
Here's an example of how the class above becomes hard to test when resorting to monkey patching:
And then each individual test is defined within a call to the `it` function:
```js
var oldXHR = XHR;
XHR = function MockXHR() {};
var myClass = new MyClass();
myClass.doWork();
// assert that MockXHR got called with the right arguments
XHR = oldXHR; // if you forget this bad things will happen
describe('sorting the list of users', function() {
it('sorts in descending order by default', function() {
// your test assertion goes here
});
});
```
Grouping related tests within `describe` blocks and describing each individual test within an
`it` call keeps your tests self documenting.
### Global look-up:
Another way to approach the problem is to look for the service in a well-known location.
Finally, Jasmine provides matchers which let you make assertions:
```js
function MyClass() {
this.doWork = function() {
global.xhr({
method:'...',
url:'...',
complete:function(response){ ... }
})
}
}
describe('sorting the list of users', function() {
it('sorts in descending order by default', function() {
var users = ['jack', 'igor', 'jeff'];
var sorted = sortUsers(users);
expect(sorted).toEqual(['jeff', 'jack', 'igor']);
});
});
```
While no new dependency instance is created, it is fundamentally the same as `new` in
that no way exists to intercept the call to `global.xhr` for testing purposes, other than
through monkey patching. The basic issue for testing is that a global variable needs to be mutated in
order to replace it with call to a mock method. For further explanation of why this is bad see: [Brittle Global
State & Singletons](http://misko.hevery.com/code-reviewers-guide/flaw-brittle-global-state-singletons/)
Jasmine comes with a number of matchers that help you make a variety of assertions. You should [read
the Jasmine documentation](http://jasmine.github.io/1.3/introduction.html#section-Matchers) to see
what they are. To use Jasmine with Karma, we use the
[karma-jasmine](https://github.com/karma-runner/karma-jasmine) test runner.
The class above is hard to test since we have to change the global state:
### angular-mocks
Angular also provides the {@link ngMock} module, which provides mocking for your tests. This is used
to inject and mock Angular services within unit tests. In addition, it is able to extend other
modules so they are synchronous. Having tests synchronous keeps them much cleaner and easier to work
with. One of the most useful parts of ngMock is {@link ngMock.$httpBackend}, which lets us mock XHR
requests in tests, and return sample data instead.
## Testing a Controller
Because Angular separates logic from the view layer, it keeps controllers easy to test. Let's take a
look at how we might test the controller below, which provides `$scope.grade`, which sets a property
on the scope based on the length of the password.
```js
var oldXHR = global.xhr;
global.xhr = function mockXHR() {};
var myClass = new MyClass();
myClass.doWork();
// assert that mockXHR got called with the right arguments
global.xhr = oldXHR; // if you forget this bad things will happen
angular.module('app', [])
.controller('PasswordController', function PasswordController($scope) {
$scope.password = '';
$scope.grade = function() {
var size = $scope.password.length;
if (size > 8) {
$scope.strength = 'strong';
} else if (size > 3) {
$scope.strength = 'medium';
} else {
$scope.strength = 'weak';
}
};
});
```
### Service Registry:
It may seem that this can be solved by having a registry of all the services and then
having the tests replace the services as needed.
Because controllers are not available on the global scope, we need to use {@link
angular.mock.inject} to inject our controller first. The first step is to use the `module` function,
which is provided by angular-mocks. This loads in the module it's given, so it is available in your
tests. We pass this into `beforeEach`, which is a function Jasmine provides that lets us run code
before each test. Then we can use `inject` to access `$controller`, the service that is responsible
for instantiating controllers.
```js
function MyClass() {
var serviceRegistry = ????;
this.doWork = function() {
var xhr = serviceRegistry.get('xhr');
xhr({
method:'...',
url:'...',
complete:function(response){ ... }
})
}
describe('PasswordController', function() {
beforeEach(module('app'));
var $controller;
beforeEach(inject(function(_$controller_){
// The injector unwraps the underscores (_) from around the parameter names when matching
$controller = _$controller_;
}));
describe('$scope.grade', function() {
it('sets the strength to "strong" if the password length is >8 chars', function() {
var $scope = {};
var controller = $controller('PasswordController', { $scope: $scope });
$scope.password = 'longerthaneightchars';
$scope.grade();
expect($scope.strength).toEqual('strong');
});
});
});
```
However, where does the serviceRegistry come from? If it is:
* `new`-ed up, the test has no chance to reset the services for testing.
* a global look-up then the service returned is global as well (but resetting is easier, since
only one global variable exists to be reset).
The class above is hard to test since we have to change the global state:
Notice how by nesting the `describe` calls and being descriptive when calling them with strings, the
test is very clear. It documents exactly what it is testing, and at a glance you can quickly see
what is happening. Now let's add the test for when the password is less than three characters, which
should see `$scope.strength` set to "weak":
```js
var oldServiceLocator = global.serviceLocator;
global.serviceLocator.set('xhr', function mockXHR() {});
var myClass = new MyClass();
myClass.doWork();
// assert that mockXHR got called with the right arguments
global.serviceLocator = oldServiceLocator; // if you forget this bad things will happen
describe('PasswordController', function() {
beforeEach(module('app'));
var $controller;
beforeEach(inject(function(_$controller_){
// The injector unwraps the underscores (_) from around the parameter names when matching
$controller = _$controller_;
}));
describe('$scope.grade', function() {
it('sets the strength to "strong" if the password length is >8 chars', function() {
var $scope = {};
var controller = $controller('PasswordController', { $scope: $scope });
$scope.password = 'longerthaneightchars';
$scope.grade();
expect($scope.strength).toEqual('strong');
});
it('sets the strength to "weak" if the password length <3 chars', function() {
var $scope = {};
var controller = $controller('PasswordController', { $scope: $scope });
$scope.password = 'a';
$scope.grade();
expect($scope.strength).toEqual('weak');
});
});
});
```
### Passing in Dependencies:
Last, the dependency can be passed in.
Now we have two tests, but notice the duplication between the tests. Both have to
create the `$scope` variable and create the controller. As we add new tests, this duplication is
only going to get worse. Thankfully, Jasmine provides `beforeEach`, which lets us run a function
before each individual test. Let's see how that would tidy up our tests:
```js
function MyClass(xhr) {
this.doWork = function() {
xhr({
method:'...',
url:'...',
complete:function(response){ ... }
})
}
describe('PasswordController', function() {
beforeEach(module('app'));
var $controller;
beforeEach(inject(function(_$controller_){
// The injector unwraps the underscores (_) from around the parameter names when matching
$controller = _$controller_;
}));
describe('$scope.grade', function() {
var $scope, controller;
beforeEach(function() {
$scope = {};
controller = $controller('PasswordController', { $scope: $scope });
});
it('sets the strength to "strong" if the password length is >8 chars', function() {
$scope.password = 'longerthaneightchars';
$scope.grade();
expect($scope.strength).toEqual('strong');
});
it('sets the strength to "weak" if the password length <3 chars', function() {
$scope.password = 'a';
$scope.grade();
expect($scope.strength).toEqual('weak');
});
});
});
```
This is the preferred method since the code makes no assumptions about the origin of `xhr` and cares
instead about whoever created the class responsible for passing it in. Since the creator of the
class should be different code than the user of the class, it separates the responsibility of
creation from the logic. This is dependency-injection in a nutshell.
We've moved the duplication out and into the `beforeEach` block. Each individual test now
only contains the code specific to that test, and not code that is general across all tests. As you
expand your tests, keep an eye out for locations where you can use `beforeEach` to tidy up tests.
`beforeEach` isn't the only function of this sort that Jasmine provides, and the [documentation
lists the others](http://jasmine.github.io/1.3/introduction.html#section-Setup_and_Teardown).
The class above is testable, since in the test we can write:
```js
function xhrMock(args) {...}
var myClass = new MyClass(xhrMock);
myClass.doWork();
// assert that xhrMock got called with the right arguments
```
Notice that no global variables were harmed in the writing of this test.
Angular comes with {@link di dependency injection} built-in, making the right thing
easy to do, but you still need to do it if you wish to take advantage of the testability story.
## Controllers
What makes each application unique is its logic, and the logic is what we would like to test. If the logic
for your application contains DOM manipulation, it will be hard to test. See the example
below:
```js
function PasswordCtrl() {
// get references to DOM elements
var msg = $('.ex1 span');
var input = $('.ex1 input');
var strength;
this.grade = function() {
msg.removeClass(strength);
var pwd = input.val();
password.text(pwd);
if (pwd.length > 8) {
strength = 'strong';
} else if (pwd.length > 3) {
strength = 'medium';
} else {
strength = 'weak';
}
msg
.addClass(strength)
.text(strength);
}
}
```
The code above is problematic from a testability point of view since it requires your test to have the right kind
of DOM present when the code executes. The test would look like this:
```js
var input = $('<input type="text"/>');
var span = $('<span>');
$('body').html('<div class="ex1">')
.find('div')
.append(input)
.append(span);
var pc = new PasswordCtrl();
input.val('abc');
pc.grade();
expect(span.text()).toEqual('weak');
$('body').empty();
```
In angular the controllers are strictly separated from the DOM manipulation logic and this results in
a much easier testability story as the following example shows:
```js
function PasswordCtrl($scope) {
$scope.password = '';
$scope.grade = function() {
var size = $scope.password.length;
if (size > 8) {
$scope.strength = 'strong';
} else if (size > 3) {
$scope.strength = 'medium';
} else {
$scope.strength = 'weak';
}
};
}
```
and the test is straight forward:
```js
var $scope = {};
var pc = $controller('PasswordCtrl', { $scope: $scope });
$scope.password = 'abc';
$scope.grade();
expect($scope.strength).toEqual('weak');
```
Notice that the test is not only much shorter, it is also easier to follow what is happening. We say
that such a test tells a story, rather than asserting random bits which don't seem to be related.
## Filters
## Testing Filters
{@link ng.$filterProvider Filters} are functions which transform the data into a user readable
format. They are important because they remove the formatting responsibility from the application
logic, further simplifying the application logic.
@@ -273,12 +259,27 @@ myModule.filter('length', function() {
}
});
var length = $filter('length');
expect(length(null)).toEqual(0);
expect(length('abc')).toEqual(3);
describe('length filter', function() {
var $filter;
beforeEach(inject(function(_$filter_){
$filter = _$filter_;
}));
it('returns 0 when given null', function() {
var length = $filter('length');
expect(length(null)).toEqual(0);
});
it('returns the correct value when given a string of chars', function() {
var length = $filter('length');
expect(length('abc')).toEqual(3);
});
});
```
## Directives
## Testing Directives
Directives in angular are responsible for encapsulating complex functionality within custom HTML tags,
attributes, classes or comments. Unit tests are very important for directives because the components
you create with directives may be used throughout your application and in many different contexts.
@@ -309,28 +310,28 @@ verify this functionality. Note that the expression `{{1 + 1}}` times will also
```js
describe('Unit testing great quotes', function() {
var $compile;
var $rootScope;
var $compile,
$rootScope;
// Load the myApp module, which contains the directive
beforeEach(module('myApp'));
// Load the myApp module, which contains the directive
beforeEach(module('myApp'));
// Store references to $rootScope and $compile
// so they are available to all tests in this describe block
beforeEach(inject(function(_$compile_, _$rootScope_){
// The injector unwraps the underscores (_) from around the parameter names when matching
$compile = _$compile_;
$rootScope = _$rootScope_;
}));
// Store references to $rootScope and $compile
// so they are available to all tests in this describe block
beforeEach(inject(function(_$compile_, _$rootScope_){
// The injector unwraps the underscores (_) from around the parameter names when matching
$compile = _$compile_;
$rootScope = _$rootScope_;
}));
it('Replaces the element with the appropriate content', function() {
// Compile a piece of HTML containing the directive
var element = $compile("<a-great-eye></a-great-eye>")($rootScope);
// fire all the watches, so the scope expression {{1 + 1}} will be evaluated
$rootScope.$digest();
// Check that the compiled element contains the templated content
expect(element.html()).toContain("lidless, wreathed in flame, 2 times");
});
it('Replaces the element with the appropriate content', function() {
// Compile a piece of HTML containing the directive
var element = $compile("<a-great-eye></a-great-eye>")($rootScope);
// fire all the watches, so the scope expression {{1 + 1}} will be evaluated
$rootScope.$digest();
// Check that the compiled element contains the templated content
expect(element.html()).toContain("lidless, wreathed in flame, 2 times");
});
});
```
@@ -431,4 +432,3 @@ Otherwise you may run into issues if the test directory hierarchy differs from t
## Sample project
See the [angular-seed](https://github.com/angular/angular-seed) project for an example.
+1 -1
View File
@@ -153,7 +153,7 @@ grunt test:unit --browsers Opera,Firefox
Note there should be _no spaces between browsers_. `Opera, Firefox` is INVALID.
During development it's however more productive to continuously run unit tests every time the source or test files
During development, however, it's more productive to continuously run unit tests every time the source or test files
change. To execute tests in this mode run:
1. To start the Karma server, capture Chrome browser and run unit tests, run:
+2 -2
View File
@@ -15,14 +15,14 @@ development.
production.
To point your code to an angular script on the Google CDN server, use the following template. This
example points to the minified version 1.2.0:
example points to the minified version 1.3.14:
```
<!doctype html>
<html ng-app>
<head>
<title>My Angular App</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
</head>
<body>
</body>
+44 -8
View File
@@ -20,6 +20,42 @@ AngularJS is 100% JavaScript, 100% client-side and compatible with both desktop
So it's definitely not a plugin or some other native browser extension.
### What is the AngularJS versioning strategy?
In Angular 1 we do not allow intentional breaking changes to appear in versions where only the "patch"
number changes. For example between 1.3.12 and 1.3.13 there can be no breaking changes. We do allow
breaking changes happen between "minor" number changes. For example between 1.3.15 and 1.4.0 there
will be a number of breaking changes. We also allow breaking changes between beta releases of Angular.
For example between 1.4.0-beta.4 and 1.4.0-beta.5 there may be breaking changes. We try hard to minimize
these kinds of change only to those where there is a strong use case such as a strongly requested feature
improvement, a considerable simplification of the code or a measurable performance improvement.
When adding new code to branches of Angular, have a very stringent commit policy:
- Every commit must contain tests and documentation updates alongside the code changes and that all the
tests must pass;
- Commit messages must be written in a specific manner that allows us to parse them and extract the changes
for release notes.
The Angular code base has a very large set of unit tests (over 4000) and end to end tests, which are pretty
comprehensive. This means that a breaking change will require one or more tests to be changed to allow the
tests to pass. So when a commit includes tests that are being removed or modified, this is a flag that the
code might include a breaking change. When reviewing the commit we can then decide whether there really is
a breaking change and if it is appropriate for the branch to which it is being merged. If so, then we
require that the commit message contains an appropriate breaking change message.
Additionally, when a commit lands in our master repository it is synced to Google where we test it against
over 2000 applications using the test suites of these applications. This allows us to catch regressions
quickly before a release. We've had a pretty good experience with this setup. Only bugs that affect features
not used at Google or without sufficient test coverage, have a chance of making it through.
Lastly, when we are making a release we generate updates to the changelog directly from the commits. This
generated update contains a highlighted section that contains all the breaking changes that have been
extracted from the commits. We can quickly see in the new changelog exactly what commits contain breaking
changes and so can application developers when they are deciding whether to update to a new version of
Angular.
### Is AngularJS a templating system?
At the highest level, Angular does look like just another templating system. But there is one
@@ -33,7 +69,7 @@ templating systems.
### Do I need to worry about security holes in AngularJS?
Like any other technology, AngularJS is not impervious to attack. Angular does, however, provide
built-in protection from basic security holes including cross-site scripting and HTML injection
built-in protection from basic security holes, including cross-site scripting and HTML injection
attacks. AngularJS does round-trip escaping on all strings for you and even offers XSRF protection
for server-side communication.
@@ -52,7 +88,7 @@ Yes. See instructions in {@link downloading}.
We run our extensive test suite against the following browsers: Safari, Chrome, Firefox, Opera 15,
IE9 and mobile browsers (Android, Chrome Mobile, iOS Safari). See {@link guide/ie Internet
Explorer Compatibility} for more details in supporting legacy IE browsers.
Explorer Compatibility} for more details on supporting legacy IE browsers.
### What's Angular's performance like?
@@ -61,13 +97,13 @@ The startup time heavily depends on your network connection, state of the cache,
available hardware, but typically we measure bootstrap time in tens or hundreds of milliseconds.
The runtime performance will vary depending on the number and complexity of bindings on the page
as well as the speed of your backend (for apps that fetch data from the backend). Just for an
illustration we typically build snappy apps with hundreds or thousands of active bindings.
as well as the speed of your backend (for apps that fetch data from the backend). For an
illustration, we typically build snappy apps with hundreds or thousands of active bindings.
### How big is the angular.js file that I need to include?
The size of the file is < 36KB compressed and minified.
The size of the file is ~50KB compressed and minified.
### Can I use the open-source Closure Library with Angular?
@@ -88,7 +124,7 @@ but we don't guarantee that.
### What is testability like in Angular?
Very testable and designed this way from ground up. It has an integrated dependency injection
Very testable and designed this way from the ground up. It has an integrated dependency injection
framework, provides mocks for many heavy dependencies (server-side communication). See
{@link ngMock} for details.
@@ -158,7 +194,7 @@ Conditionally showing and hiding things using jQuery is a common pattern in othe
`ng-show` (and `ng-hide`) conditionally show and hide elements based on boolean expressions.
Describe the conditions for showing and hiding an element in terms of `$scope` variables:
<div ng-show="!loggedIn">Click <a href="#/login">here</a> to log in</div>
<div ng-show="!loggedIn"><a href="#/login">Click here to log in</a></div>
Note also the counterpart `ng-hide` and similar `ng-disabled`.
Note especially the powerful `ng-switch` that should be used instead of several mutually exclusive `ng-show`s.
@@ -189,7 +225,7 @@ Then whenever a value on a scope changes, all `$watch`es observing that element
Sometimes, usually when you're writing a custom directive, you will have to define your own `$watch` on a scope value to make the directive react to changes.
On the flip side, sometimes you change a scope value in some code but the app doesn't react to it.
On the flip side, sometimes you change a scope value in some code, but the app doesn't react to it.
Angular checks for scope variable changes after pieces of your code have finished running; for example, when `ng-click` calls a function on your scope, Angular will check for changes and react.
However, some code is outside of Angular and you'll have to call `scope.$apply()` yourself to trigger the update.
This is most commonly seen in event handlers in custom directives.
+6 -4
View File
@@ -116,7 +116,7 @@ npm --version
```
<div class="alert alert-info">If you need to run a different versions of node.js
<div class="alert alert-info">If you need to run different versions of node.js
in your local environment, consider installing
<a href="https://github.com/creationix/nvm" title="Node Version Manager Github Repo link">
Node Version Manager (nvm)
@@ -129,7 +129,8 @@ Once you have Node.js installed on your machine you can download the tool depend
npm install
```
This command will download the following tools, into the `node_modules` directory:
This command reads angular-phonecat's `package.json` file and downloads the following tools
into the `node_modules` directory:
- [Bower][bower] - client-side code package manager
- [Http-Server][http-server] - simple local static web server
@@ -160,7 +161,7 @@ globally and run directly from a terminal/command prompt. You don't need to do t
tutorial, but if you decide you do want to run them directly, you can install these modules globally
using, `sudo npm install -g ...`.
For instance to install the Bower command line executable you would do:
For instance, to install the Bower command line executable you would do:
```
sudo npm install -g bower
@@ -198,7 +199,7 @@ http://localhost:8000/app/index.html
<div class="alert alert-info">
To serve the web app on a different ip address or port, edit the "start" script within package.json.
You can `-a` to set the address and `-p` to set the port.
You can use `-a` to set the address and `-p` to set the port.
</div>
### Running Unit Tests
@@ -270,6 +271,7 @@ It is good to run the end to end tests whenever you make changes to the HTML vie
that the application as a whole is executing correctly. It is very common to run End to End tests
before pushing a new commit of changes to a remote repository.
Now that you have set up your local machine, let's get started with the tutorial: {@link step_00 Step 0 - Bootstrapping}
[git]: http://git-scm.com/
[node]: http://nodejs.org/
+21 -18
View File
@@ -31,7 +31,10 @@ npm install
To see the app running in a browser, open a *separate* terminal/command line tab or window, then
run `npm start` to start the web server. Now, open a browser window for the app and navigate to
<a href="http://localhost:8000/app/" target="_blank">`http://localhost:8000/app/`</a>
<a href="http://localhost:8000/app/" target="_blank" title="Open app on localhost">`http://localhost:8000/app/`</a>
Note that if you already ran the master branch app prior to checking out step-0, you may see the cached
master version of the app in your browser window at this point. Just hit refresh to re-load the page.
You can now see the page in your browser. It's not very exciting, but that's OK.
@@ -62,7 +65,7 @@ __`app/index.html`:__
## What is the code doing?
* `ng-app` directive:
**`ng-app` directive:**
<html ng-app>
@@ -74,41 +77,41 @@ __`app/index.html`:__
This gives application developers the freedom to tell Angular if the entire html page or only a
portion of it should be treated as the Angular application.
* AngularJS script tag:
**AngularJS script tag:**
<script src="bower_components/angular/angular.js">
This code downloads the `angular.js` script and registers a callback that will be executed by the
This code downloads the `angular.js` script which registers a callback that will be executed by the
browser when the containing HTML page is fully downloaded. When the callback is executed, Angular
looks for the {@link ng.directive:ngApp ngApp} directive. If
Angular finds the directive, it will bootstrap the application with the root of the application DOM
being the element on which the `ngApp` directive was defined.
* Double-curly binding with an expression:
**Double-curly binding with an expression:**
Nothing here {{'yet' + '!'}}
This line demonstrates two core features of Angular's templating capabilities:
This line demonstrates two core features of Angular's templating capabilities:
* a binding, denoted by double-curlies `{{ }}`
* a simple expression `'yet' + '!'` used in this binding.
* a binding, denoted by double-curlies `{{ }}`
* a simple expression `'yet' + '!'` used in this binding.
The binding tells Angular that it should evaluate an expression and insert the result into the
DOM in place of the binding. Rather than a one-time insert, as we'll see in the next steps, a
binding will result in efficient continuous updates whenever the result of the expression
evaluation changes.
The binding tells Angular that it should evaluate an expression and insert the result into the
DOM in place of the binding. Rather than a one-time insert, as we'll see in the next steps, a
binding will result in efficient continuous updates whenever the result of the expression
evaluation changes.
{@link guide/expression Angular expression} is a JavaScript-like code snippet that is
evaluated by Angular in the context of the current model scope, rather than within the scope of
the global context (`window`).
{@link guide/expression Angular expression} is a JavaScript-like code snippet that is
evaluated by Angular in the context of the current model scope, rather than within the scope of
the global context (`window`).
As expected, once this template is processed by Angular, the html page contains the text:
"Nothing here yet!".
As expected, once this template is processed by Angular, the html page contains the text:
"Nothing here yet!".
## Bootstrapping AngularJS apps
Bootstrapping AngularJS apps automatically using the `ngApp` directive is very easy and suitable
for most cases. In advanced cases, such as when using script loaders, you can use
for most cases. In advanced cases, such as when using script loaders, you can use the
{@link guide/bootstrap imperative / manual way} to bootstrap the app.
There are 3 important things that happen during the app bootstrap:
+1 -1
View File
@@ -182,7 +182,7 @@ You can now rerun `npm run protractor` to see the tests run.
# Experiments
* In the `PhoneListCtrl` controller, remove the statement that sets the `orderProp` value and
you'll see that Angular will temporarily add a new "unknown" option to the drop-down list and the
you'll see that Angular will temporarily add a new blank ("unknown") option to the drop-down list and the
ordering will default to unordered/natural order.
* Add an `{{orderProp}}` binding into the `index.html` template to display its current value as
+2 -2
View File
@@ -258,8 +258,8 @@ You should now see the following output in the Karma tab:
# Experiments
* At the bottom of `index.html`, add a `<pre>{{phones | json}}</pre>` binding to see the list of phones
displayed in json format.
* At the bottom of `index.html`, add a `<pre>{{phones | filter:query | orderBy:orderProp | json}}</pre>`
binding to see the list of phones displayed in json format.
* In the `PhoneListCtrl` controller, pre-process the http response by limiting the number of phones
to the first 5 in the list. Use the following code in the `$http` callback:
+3 -3
View File
@@ -16,8 +16,8 @@ about the phones in the catalog.
## Data
Note that the `phones.json` file contains unique ids and image urls for each of the phones. The
urls point to the `app/img/phones/` directory.
Note that the `phones.json` file contains unique IDs and image URLs for each of the phones. The
URLs point to the `app/img/phones/` directory.
__`app/phones/phones.json`__ (sample snippet):
@@ -59,7 +59,7 @@ the element attribute.
We also added phone images next to each record using an image tag with the {@link
ng.directive:ngSrc ngSrc} directive. That directive prevents the
browser from treating the Angular `{{ expression }}` markup literally, and initiating a request to
invalid url `http://localhost:8000/app/{{phone.imageUrl}}`, which it would have done if we had only
invalid URL `http://localhost:8000/app/{{phone.imageUrl}}`, which it would have done if we had only
specified an attribute binding in a regular `src` attribute (`<img src="{{phone.imageUrl}}">`).
Using the `ngSrc` directive prevents the browser from making an http request to an invalid location.
+7 -7
View File
@@ -11,7 +11,7 @@ multiple views by adding routing, using an Angular module called 'ngRoute'.
* When you now navigate to `app/index.html`, you are redirected to `app/index.html/#/phones`
and the phone list appears in the browser.
* When you click on a phone link the url changes to one specific to that phone and the stub of a
* When you click on a phone link, the url changes to that specific phone and the stub of a
phone detail page is displayed.
<div doc-tutorial-reset="7"></div>
@@ -21,7 +21,7 @@ multiple views by adding routing, using an Angular module called 'ngRoute'.
The routing functionality added by this step is provided by angular in the `ngRoute` module, which
is distributed separately from the core Angular framework.
We are using [Bower][bower] to install client side dependencies. This step updates the
We are using [Bower][bower] to install client-side dependencies. This step updates the
`bower.json` configuration file to include the new dependency:
```json
@@ -46,7 +46,7 @@ The new dependency `"angular-route": "~1.3.0"` tells bower to install a version
angular-route component that is compatible with version 1.3.x. We must tell bower to download
and install this dependency.
If you have bower installed globally then you can run `bower install` but for this project we have
If you have bower installed globally, then you can run `bower install` but for this project, we have
preconfigured npm to run bower install for us:
```
@@ -70,7 +70,7 @@ the current "route" — the view that is currently displayed to the user.
Application routes in Angular are declared via the {@link ngRoute.$routeProvider $routeProvider},
which is the provider of the {@link ngRoute.$route $route service}. This service makes it easy to
wire together controllers, view templates, and the current URL location in the browser. Using this
feature we can implement [deep linking](http://en.wikipedia.org/wiki/Deep_linking), which lets us
feature, we can implement [deep linking](http://en.wikipedia.org/wiki/Deep_linking), which lets us
utilize the browser's history (back and forward navigation) and bookmarks.
@@ -81,7 +81,7 @@ AngularJS, so it's important for you to understand a thing or two about how it w
When the application bootstraps, Angular creates an injector that will be used to find and inject all
of the services that are required by your app. The injector itself doesn't know anything about what
`$http` or `$route` services do, in fact it doesn't even know about the existence of these services
`$http` or `$route` services do. In fact, the injector doesn't even know about the existence of these services
unless it is configured with proper module definitions.
The injector only carries out the following steps :
@@ -295,7 +295,7 @@ phonecatControllers.controller('PhoneDetailCtrl', ['$scope', '$routeParams',
Again, note that we created a new module called `phonecatControllers`. For small AngularJS
applications, it's common to create just one module for all of your controllers if there are just a
few. As your application grows it is quite common to refactor your code into additional modules.
few. As your application grows, it is quite common to refactor your code into additional modules.
For larger apps, you will probably want to create separate modules for each major feature of
your app.
@@ -349,7 +349,7 @@ the same binding into the `phone-list.html` template, the binding will work as e
<div style="display: none">
* In `PhoneCatCtrl`, create a new model called "`hero`" with `this.hero = 'Zoro'`. In
`PhoneListCtrl` let's shadow it with `this.hero = 'Batman'`, and in `PhoneDetailCtrl` we'll use
`PhoneListCtrl`, let's shadow it with `this.hero = 'Batman'`. In `PhoneDetailCtrl`, we'll use
`this.hero = "Captain Proton"`. Then add the `<p>hero = {{hero}}</p>` to all three of our templates
(`index.html`, `phone-list.html`, and `phone-detail.html`). Open the app and you'll see scope
inheritance and model property shadowing do some wonders.
+2 -2
View File
@@ -20,7 +20,7 @@ fleshed out the `phone-detail.html` view template.
## Data
In addition to `phones.json`, the `app/phones/` directory also contains one json file for each
In addition to `phones.json`, the `app/phones/` directory also contains one JSON file for each
phone:
__`app/phones/nexus-s.json`:__ (sample snippet)
@@ -53,7 +53,7 @@ show this data in the phone detail view.
## Controller
We'll expand the `PhoneDetailCtrl` by using the `$http` service to fetch the json files. This works
We'll expand the `PhoneDetailCtrl` by using the `$http` service to fetch the JSON files. This works
the same way as the phone list controller.
__`app/js/controllers.js`:__

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