Commit graph

2672 commits

Author SHA1 Message Date
quazzie
c32a859bdb feat(select): match options by expression other than object identity
Extend ng-options with a new clause, "track by [trackByExpression]", which can be used when
working with objects.  The `trackByExpression` should uniquely identify select options objects.
This solves the problem of previously having to match ng-options objects by identity.
You can now write: `ng-options="obj as obj.name for obj in objects track by obj.id"`
The "track by" expression will be used when checking for equality of objects.

Examples:
<select
    ng-model="user.favMovieStub"
    ng-options="movie as movie.name for movie in movies track by movie.id">
</select>

scope: {
  user: { name: 'Test user', favMovieStub: { id: 1, name: 'Starwars' } }
  movies: [{ id: 1, name: 'Starwars', rating: 5, ... }, { id: 13, ... }]
}

The select input will match user favMovieStub to the first movie in the movies array, and show
"Star Wars" as the selected item.
2013-05-14 19:58:05 +01:00
Matias Niemelä
4acc28a310 feat(ngAnimate): cancel previous incomplete animations when new animations take place 2013-05-13 21:09:43 -07:00
Matias Niemelä
c8197b44eb feat(ngdocs): external links to github, plunkr and jsfiddle available for code examples 2013-05-13 16:55:14 -07:00
Matias Niemelä
b6e5972eb3 chore(ngdocs): update to new version of FontAwesome 2013-05-13 16:55:14 -07:00
Matias Niemelä
0930d9dfe7 chore($sniffer): replace remaining supportsTransitions/supportsAnimations flags inside tests 2013-05-13 18:12:25 -04:00
Matias Niemelä
3e4d43b42c docs(animation): fix code example to work with most recent ngAnimate
ngAnimate: Rename CSS classes in example code to work with new ngAnimate naming conventions
ngInclude: Include animations toggle in ngInclude example code
ngAnimate: Remove ms- prefix and fix up CSS animation example code
2013-05-13 14:09:03 +01:00
Chirayu Krishnappa
3952d35abe fix($browser): should use first value for a cookie.
With this change, $browser.cookies()["foo"] will behave like
docCookies.getItem("foo") where docCookies is defined at
https://developer.mozilla.org/en-US/docs/DOM/document.cookie

This fixes the issue where, if there's a value for the XSRF-TOKEN cookie
value with the path /, then that value is used for all applications in
the domain even if they set path specific values for XSRF-TOKEN.

Closes #2635
2013-05-11 09:28:14 -07:00
willtj
bffe6fa8a6 docs($scope): clarify documentation for $broadcast 2013-05-10 21:24:08 +01:00
veselinn
ac8ba104d4 docs(guide): fix a typo 2013-05-10 20:52:18 +01:00
Lucas Galfasó
67a4a25b89 fix(ngPluralize): handle the empty string as a valid override
Fix the check for overrides so it is able to handle the empty string

Closes #2575
2013-05-10 20:03:24 +01:00
Alfred Nutile
f6caab598f docs(guide): fix typo on model name 2013-05-10 14:58:00 +01:00
Alex Pods
04d4c738b5 docs(Angular.js) move forEach docs to correct place 2013-05-09 22:04:13 +01:00
Anatoly Shikolay
4ae4f1edd2 style(*): fix up semicolon and var usage 2013-05-09 15:01:22 +01:00
Pete Bacon Darwin
40c36ee7fe docs(tutorial): add comment about injection annotation
Closes: #1163
2013-05-09 13:56:36 +01:00
Pete Bacon Darwin
02ad012e7f docs($window): fix example 2013-05-09 12:47:41 +01:00
Misko Hevery
29efd39745 fix(scenario): update to use our angular-scenario.js rather then karma 2013-05-08 16:40:35 -07:00
Matias Niemelä
11f712bc3e chore(ngAnimate): CSS classes X-setup/X-start -> X/X-active
BREAKING CHANGE: css classes foo-setup/foo-start become foo/foo-active

The CSS transition classes have changed suffixes. To migrate rename
.foo-setup {...} to .foo {...}
.foo-start {...} to .foo-active {...}

or for type: enter, leave, move, show, hide

.foo-type-setup {...} to .foo-type {...}
.foo-type-start {...} to .foo-type-active {...}
2013-05-08 16:03:31 -07:00
Matias Niemelä
14757874a7 feat(ngAnimate): Add support for CSS3 Animations with working delays and multiple durations 2013-05-08 15:56:53 -07:00
Matias Niemelä
88c3480aff feat($sniffer): Add support for supportsAnimations flag for detecting CSS Animations browser support 2013-05-08 15:40:37 -07:00
Matias Niemelä
0cb04e2e91 chore(ngIf): Add animation code to ngIf example and docs text to ngAnimate docs 2013-05-08 15:34:35 -07:00
Matias Niemelä
404c9a653a feat(ngdocs): add variable type hinting with colors 2013-05-08 15:25:56 -07:00
Igor Minar
ee2689051b refactor($resource): simplify url template expansion 2013-05-08 15:08:49 -07:00
Igor Minar
5137a15417 chore(docs): use done() in gen-docs.js 2013-05-08 07:57:34 -07:00
Igor Minar
35adade6ac test(sortedHtml): ignore bogus rowspan=1 and colspan=1 in IE 2013-05-08 07:57:34 -07:00
Igor Minar
86b33eb3f1 test(sortedHtml): fix comment support in sortedHtml helper 2013-05-08 07:57:34 -07:00
Igor Minar
202087f03d style($compile): clarify argument name 2013-05-08 07:57:33 -07:00
R. Merkert
6d0b325f7f fix(angular): do not copy $$hashKey in copy/extend functions.
Copying the $$hashKey as part of copy/extend operations makes little
sense since hashkey is used primarily as an object id, especially in
the context of the ngRepeat directive. This change maintains the
existing $$hashKey of an object that is being copied into (likewise for
extend).
It is not uncommon to take an item in a collection, copy it,
and then append it to the collection. By copying the $$hashKey, this
leads to duplicate object errors with the current ngRepeat.

Closes #1875
2013-05-08 12:45:32 +01:00
Illniyar
cf4729faa3 feat($cookieStore): $cookieStore.get now parses blank string as blank string
closes #1918
2013-05-08 10:04:07 +01:00
Kevin Wells
4f2e360685 fix(date): correctly format dates with more than 3 sub-second digits
This date {{2003-09-10T13:02:03.123456Z | date: yyyy-mm-dd ss} is now
treated as having 123.45ms. Previously it had 123456ms so 123 seconds
were added to the formatted date.
Use local date in unit tests so they work in any time zone
2013-05-07 22:59:46 +01:00
Chad Smith
4622af3f07 fix(select): ensure empty option is not lost in IE9
Fix a check inside render for select elements with ngOptions, which
compares the selected property of an element with it's desired state.
Ensure the placeholder, if available, is explicitly selected if the model
value can not be found in the option list.
Without these fixes it's up to the browser implementation to decide which
option to choose. In most browsers, this has the effect of displaying the
first item in the list. In IE9 however, this causes the select to display
nothing.

Closes #2150, #1826
2013-05-07 21:27:42 +01:00
Pete Bacon Darwin
f046f6f73c fix(dateFilter): correctly format ISODates on Android<=2.1
In older Android browsers, `undefined` does not act like `0` in some
arithmetic operations. This leads to dates being formatted with `NaN`
strings in the dateFilter because the implementation of the `dateGetter`
function allows offset to be an optional parameter.
The fix is to convert offset to 0 if it is undefined.

Closes #2277, #2275
2013-05-07 11:43:25 +01:00
Hamish Macpherson
52c1498e25 doc(input): fix small typo in code example 2013-05-07 09:48:40 +01:00
Misko Hevery
2c69a6735e fix($location): prevent navigation when event isDefaultPrevented 2013-05-06 21:52:53 -07:00
Misko Hevery
c575a56fc5 docs(injector): add docs for $injector.has 2013-05-06 21:52:53 -07:00
Matthieu Larcher
af0eaa3047 feat(ngInclude): $includeContentRequested event
Adding a $includeContentRequested event in order to better keep track of
how many includes are sent and be able to compare it with how many have
finished.
2013-05-03 19:55:47 +01:00
Misko Hevery
a348e90aa1 fix($location): compare against actual instead of current URL 2013-05-02 18:22:03 -04:00
Misko Hevery
4bd7bedf48 fix($location): prevent navigation if already on the URL 2013-05-02 15:22:17 -04:00
Misko Hevery
fd21c7502f fix(ngAnamite): eval ng-animate expression on each animation 2013-05-02 15:22:16 -04:00
Misko Hevery
80341cb9ba feat(injector): add has method for querying
Closes #2556
2013-05-02 15:22:16 -04:00
Misko Hevery
9956baedd7 fix(ngView): accidentally compiling leaving content
closes: #2304
2013-05-02 15:22:16 -04:00
Gonzalo Ruiz de Villa
1d8e11ddfb fix(ngRepeat): correctly iterate over array-like objects
Check if the object is array-like to iterate over it like it's done with arrays.

Closes #2546
2013-05-02 15:12:37 +01:00
Gonzalo Ruiz de Villa
6452707d40 fix($rootScope) ensure $watchCollection correctly handles arrayLike objects 2013-05-02 15:12:37 +01:00
quazzie
dc9a580617 fix($location): back-button should fire $locationChangeStart
Before $locationChangeStart event is not broadcast when pressing the back-button on the browser.

Closes #2109
2013-05-01 14:42:10 +01:00
Pete Bacon Darwin
660605bdb8 test(ngAnimate): also provide W3C transition property to work on IE10
Closes: #2492
2013-05-01 13:57:44 +01:00
Siddique Hameed
89c0b5d096 docs(injector): fix typo
Closes: #2551
2013-05-01 13:14:54 +01:00
Braden Shepherdson
52a55ec618 feat(ngTap): Add a CSS class while the element is held down. 2013-04-30 16:56:24 -07:00
Vojta Jina
e295eeefaa test(controller): instantiate controller defined on window
Just adding a missing spec.
2013-04-30 14:38:14 -07:00
Vojta Jina
de2cdb0658 fix(ngController): allow dots in a controller name
The issue was introduced in cd38cbf975
2013-04-30 14:38:14 -07:00
David Bennett
cda7b71146 feat($httpBackend): add timeout support for JSONP requests
Documentation implies that timeout works for all requests, though it
only works with XHR. To implement:
- Change $httpBackend to set a timeout for JSONP requests which will
immediately resolve the request when fired.
- Cancel the timeout when requests are completed.
2013-04-30 20:42:34 +01:00
Chris Nicola
fc25a443f8 docs(guide:directive): add directive controller usage
Specifically adding a directive controller to the example definition
and how to use declare injectables to avoid minification errors.
2013-04-30 10:47:14 +01:00