Compare commits

...

1045 Commits

Author SHA1 Message Date
Martin Staffa 617b36117a docs(changelog): add release notes for 1.6.4 2017-03-31 10:47:45 +02:00
Jason Bedard 189461f9bf fix($parse): standardize one-time literal vs non-literal and interceptors
Previously literal one-time bindings did not use the expression `inputs`, causing infinite digest issues with literal values. This often forces the use of deepEquals when watching one-time literals.

`ng-class` is one example of deepEquals which is no longer required.

This one-time/literal behavior is now also consistently propogated through interceptors.

Closes #15858
2017-03-31 09:36:19 +02:00
Jason Bedard 93879b3c72 fix($parse): fix infinite digest errors when watching objects with .valueOf in literals
Closes #15867
2017-03-31 09:17:55 +02:00
Jason Bedard c2b8fab0a4 fix($rootScope): provide correct value of one-time bindings in watchGroup 2017-03-30 22:22:22 -07:00
bennycoomans f403925ee0 docs(guide/Migrating from Previous Versions): fix typo "indentifiers"
Closes #15871
2017-03-29 14:49:00 +02:00
Michał Gołębiowski 1e841a89c1 docs($compile): remove a mention of preassigning bindings in controllers
The deprecation warning is no longer needed as the feature has been removed
in 1.7.

Closes #15870
2017-03-29 14:15:26 +02:00
Jason Bedard 2b0c0505e2 refactor($parse): move duplicate $parse interpreter/compiler logic into Parser
- the construction of the AST is now in the Parser
- the assigning of the literal and constant flags is now in the Parser
- remove unused references to the lexer, $filter and options on the Parser
2017-03-27 23:29:02 -07:00
Jason Bedard 9d74f0fdcb refactor($compile): reuse shared simpleCompare method 2017-03-27 23:25:22 -07:00
Jason Bedard f1d0f03863 refactor($parse): make use of local variable instead of refetching property 2017-03-27 22:53:12 -07:00
Jason Bedard b0f6afcdac test($compile): add test for #15833 2017-03-27 22:47:25 -07:00
Jason Bedard 2931a6df03 refactor(ngModel): use local scope param in watcher 2017-03-27 22:47:15 -07:00
Michał Gołębiowski bf5c2eef34 fix(jqLite): make jqLite invoke jqLite.cleanData as a method
The previous implementation of jqLite didn't use cleanData from the jqLite
object but instead used a cached version which maede it impossible to
monkey-patch jqLite.cleanData similarly to how you can do it in jQuery.

The cleanData method is not meant to be called directly by userland code;
its purpose is mainly to be able to be monkey-patched; therefore, the previous
implementation didn't make a lot of sense.

This commit enables one of the tests so far run only with jQuery to run with
jqLite as well.

Ref #8486
Ref #8695
Closes #15846
2017-03-27 11:55:56 +02:00
Michał Gołębiowski dcdd5def8f test(jQuery): run tests with jQuery 2.1, 2.2 & 3.2
Also, update jQuery 2.2.x mentions in the tutorial to 3.2.x.

Closes #15843
2017-03-27 11:23:49 +02:00
Peter Mertz f3aa1d183a docs($interval): Update interval promise docs
It's currently not clear when or why the promise returned by `$interval` resolves. This updates the docs to be more specific.

Closes #15862
2017-03-25 18:08:38 +02:00
Martin Staffa 80077f35d0 docs(faq): clarify the versioning strategy
- When do breaking changes appear
- Relationship with Semver
- Compatibility of modules

Closes #15845
2017-03-24 12:45:28 +01:00
Martin Staffa 32f38a33b6 docs($animate): remove obsolete error doc 2017-03-24 10:44:51 +01:00
Martin Staffa 9de0842719 chore(doc-gen): report on missing or obsolete error docs
Closes #12527
2017-03-24 10:44:51 +01:00
Rodrigo b9d2b30808 docs(filterFilter): clarify the comparator parameter
Closes #15827
2017-03-23 16:00:37 +02:00
Michał Gołębiowski 3d0abffbc0 chore(yarn): rely on Travis built-in Yarn support, update Yarn in Jenkins
On Travis we now rely on built-in Yarn support and we only cache the Yarn cache,
not node_modules. This creates a more stable environment as we don't install
over previous node_modules state but we still won't download packages from the
internet in the second run for the same yarn.lock as Yarn takes packages from
its local cache if they exist there.

We install a new Yarn verison manually on Jenkins; the location of the install
script changed.

Closes #15851
2017-03-22 22:49:51 +01:00
Martin Staffa c35786ae26 chore(github): update issue template
Closes #15824
2017-03-22 17:03:44 +01:00
Michał Gołębiowski 60644d5d05 chore(*): remove unused docs/bower_components mentions 2017-03-22 16:49:16 +01:00
Michał Gołębiowski 233f47b98a chore($parse): make sure no one changes .toEqual(-0) to .toBe(-0) 2017-03-22 12:08:05 +01:00
Martin Staffa 421040588c docs(component-router): give deprecation notice red color 2017-03-22 12:00:32 +01:00
Jason Bedard f132ce740a refactor($controller): remove unused injected $window
Closes #15839
2017-03-22 11:54:55 +01:00
Joshua J Wilborn 5377baf0fc docs ($compile): add error documentation for noslot error in $compile
Fixes #15790
Closes  #15828
2017-03-22 11:51:55 +01:00
Michał Gołębiowski bf7685abbd test(jqLite): test not firing $destroy on jqLite.cleanData with jQuery UI
So far it wasn't tested that Angular's logic for skipping it triggering
the $destroy event on jQuery.cleanData in the replaceWith internal function
works correctly when Angular is not the last one to patch the cleanData method
(e.g. if jQuery UI does the patching later). This commits adds the relevant
test.

Ref #8486
2017-03-22 10:37:17 +00:00
Michał Gołębiowski ba2e0d3d9b docs(faq): document the AngularJS/jqLite deprecation strategy
Fixes #15282
2017-03-22 10:32:28 +00:00
Raphael Jamet 0d9d57d418 docs($sce): overhaul the $sce service documentation
A big docs update around `$sce`:
There is a lot of content in there that is often misunderstood, and some of the
documentation starts to get really old too. Also fixed capitalization,
formatting, indentation and uniformized `@param` descriptions.

Closes #15735
2017-03-21 17:34:33 +02:00
Richard Kaufhold d96e58fdc8 feat($resource): add hasBody action configuration option
By default, only `PUT`, `POST` and `PATCH` requests have a body, but you can use
`hasBody` to configure any action to either have or not have a body, regardless
of its HTTP method.

Fixes #10128

Closes #12181
2017-03-21 12:43:48 +02:00
Georgios Kalpakas 70dbb15846 docs($sanitize): fix incorrect test description 2017-03-20 16:26:14 +02:00
BobChao87 d94153939c docs($resource): encode ) in link
JSDoc to HTML converter was treating the close parenthesis in
`[MDN](...#toJson()_behavior)` as the final close parenthesis, thus resulting in
a broken link.
This commit fixes it by percent-encoding the parentesis in the link address.

Closes #15825
2017-03-20 12:50:18 +02:00
xfg eacf06f5cf docs(ngMock/$httpBackend): add catch() block to example
Make the `it should fail authentication` test pass.

Closes #15822
2017-03-20 12:45:06 +02:00
TheRealMaxion bb2a247aa5 docs(tutorial/step_09) fix typo
Closes #15829
2017-03-20 12:32:39 +02:00
TheRealMaxion 24c94b83fa docs(tutorial/step_04): fix typo (each --> its)
Closes #15826
2017-03-20 12:27:44 +02:00
Vitaliy 0c3620bbf5 docs($interpolate): fix typo
There was missing `JS` at line 141.

Closes #15817
2017-03-15 18:19:06 +01:00
Michał Gołębiowski 38f8c97af7 fix($compile): remove the preAssignBindingsEnabled flag
Closes #15782

BREAKING CHANGE:

Previously, the `$compileProvider.preAssignBindingsEnabled` flag was supported.
The flag controlled whether bindings were available inside the controller
constructor or only in the `$onInit` hook. The bindings are now no longer
available in the constructor.

To migrate your code:

1. If you haven't invoked `$compileProvider.preAssignBindingsEnabled()` you
don't have to do anything to migrate.

2. If you specified `$compileProvider.preAssignBindingsEnabled(false)`, you
can remove that statement - since AngularJS 1.6.0 this is the default so your
app should still work even in AngularJS 1.6 after such removal. Afterwards,
migrating to AngularJS 1.7.0 shouldn't require any further action.

3. If you specified `$compileProvider.preAssignBindingsEnabled(true)` you need
to first migrate your code so that the flag can be flipped to `false`. The
instructions on how to do that are available in the "Migrating from 1.5 to 1.6"
guide:
https://docs.angularjs.org/guide/migration#migrating-from-1-5-to-1-6
Afterwards, remove the `$compileProvider.preAssignBindingsEnabled(true)`
statement.
2017-03-15 15:38:44 +01:00
Chirag Bhatia c80fa1cfe1 fix($http): throw more informative error on invalid JSON response
Fixes #15695

Closes #15724
2017-03-14 14:47:39 +02:00
Martin Staffa 11d9ad1eb2 fix(ngTouch): remove ngClick override, $touchProvider, and $touch
Closes #15761
Closes #15755

BREAKING CHANGE:

The `ngClick` directive from the ngTouch module has been removed, and with it the
corresponding `$touchProvider` and `$touch` service.

If you have included ngTouch v1.5.0 or higher in your application, and have not
changed the value of `$touchProvider.ngClickOverrideEnabled()`, or injected and used the `$touch`
service, then there are no migration steps for your code. Otherwise you must remove references to
the provider and service.

The `ngClick` override directive had been deprecated and by default disabled since v1.5.0,
because of buggy behavior in edge cases, and a general trend to avoid special touch based
overrides of click events. In modern browsers, it should not be necessary to use a touch override
library:

- Chrome, Firefox, Edge, and Safari remove the 300ms delay when
  `<meta name="viewport" content="width=device-width">` is set.
- Internet Explorer 10+, Edge, Safari, and Chrome remove the delay on elements that have the
  `touch-action` css property is set to `manipulation`.

You can find out more in these articles:
https://developers.google.com/web/updates/2013/12/300ms-tap-delay-gone-away
https://developer.apple.com/library/content/releasenotes/General/WhatsNewInSafari/Articles/Safari_9_1.html#//apple_ref/doc/uid/TP40014305-CH10-SW8
https://blogs.msdn.microsoft.com/ie/2015/02/24/pointer-events-w3c-recommendation-interoperable-touch-and-removing-the-dreaded-300ms-tap-delay/
2017-03-14 11:48:54 +01:00
eeeqxxtg 5a13cacf9f docs(changelog): fix typo (resourceUrlWhiteList --> resourceUrlWhitelist)
Closes #15809
2017-03-14 11:30:14 +02:00
Ash Searle 28bad725b1 fix(dateFilter): correctly handle newlines in format string
Fixes #15794

Closes #15792
2017-03-13 19:28:26 +02:00
Martin Staffa 1daa4f2231 fix(Angular): remove angular.lowercase and angular.uppercase
Closes #15445

BREAKING CHANGE:

The helper functions `angular.lowercase` `and angular.uppercase` have
been removed.

These functions have been deprecated since 1.5.0. They are internally
used, but should not be exposed as they contain special locale handling 
(for Turkish) to maintain internal consistency regardless of user-set locale.

Developers should generally use the built-ins `toLowerCase` and `toUpperCase`
or `toLocaleLowerCase` and `toLocaleUpperCase` for special cases.

Further, we generally discourage using the angular.x helpers in application code.
2017-03-08 14:33:34 +01:00
Martin Staffa 4d43ee3327 docs(changelog): move bootstrap fixes to Bug Fix section 2017-03-08 12:47:23 +01:00
Martin Staffa a59f46b37d docs(changelog): add release notes for 1.6.3 2017-03-08 12:22:32 +01:00
Pablo Targa 728ce72372 docs(ngAnimate): update staggering config for use with css animations
Closes #15743
2017-03-07 20:20:01 +01:00
diegomrsantos b779091ffd docs(guide/migration): add info for 1.4 (ng)Pattern BC
Breaking change was introduced in commit 0e001084ff.
This content being included in the migration guide is taken from the commit message of commit 0e001084ff.

Closes #15758
Closes #15765
2017-03-07 20:13:24 +01:00
Raphael Jamet 6ccbfa65d6 feat($compile): lower the xlink:href security context for SVG's a and image elements
Previously, `xlink:href` on SVG's `<a>` and `<image>` elements, was
`$sce.RESOURCE_URL`. While this makes sense for other `xlink:href` usecases, it
was an overkill for these elements.
This commit lowers the `xlink:href` security context for these specific
elements, treating it in the same way as `a[href]` or `img[src]` respectively.
The `xlink:href` security context for other elements is not affected.

BREAKING CHANGE:

In the unlikely case that an app relied on RESOURCE_URL whitelisting for the
purpose of binding to the `xlink:href` property of SVG's `<a>` or `<image>`
elements and if the values do not pass the regular URL sanitization, they will
break.

To fix this you need to ensure that the values used for binding to the affected
`xlink:href` contexts are considered safe URLs, e.g. by whitelisting them in
`$compileProvider`'s `aHrefSanitizationWhitelist` (for `<a>` elements) or
`imgSrcSanitizationWhitelist` (for `<image>` elements).

Closes #15736
2017-03-05 00:57:04 +02:00
mohamed amr cc793a1364 test(errorHandlingConfig): add tests for errorHandlingConfig() (independent of minErr)
Closes #15770
2017-03-05 00:44:45 +02:00
Michał Gołębiowski 3dc0096dc4 fix($log): don't parse error stacks manually outside of IE/Edge
IE/Edge display errors in such a way that it requires the user to click in
4 places to see the stack trace. There is no way to feature-detect it so
there's a chance of the user agent sniffing to go wrong but since it's only
about logging, this shouldn't break apps. Other browsers display errors in
a sensible way and some of them map stack traces along source maps if available
so it makes sense to let browsers display it as they want.

Fixes #15590
Closes #15767
2017-03-03 11:38:58 +01:00
jason-larigakis-hs 846fa1cdf6 docs(guide/Providers): remove confusing section
This part of the guide  is called "Providers", which means the section no longer applies.

Closes #15771
2017-03-03 11:08:54 +01:00
Peter Bacon Darwin 60e294cbd8 feat(info): add angularVersion info to each module
You can now check what version of AngularJS a core module is designed for:

```
var angularVersion = $injector.modules['myModule'].info().angularVersion;
```
2017-03-02 08:22:08 +00:00
Peter Bacon Darwin 550f309dba feat($injector): add new modules property
The `modules` property is a hash of the modules loaded into the injector
at bootstrap time. This can be used to access the module's info.
2017-03-02 08:22:08 +00:00
Peter Bacon Darwin 49aba51e6b feat(Module): add info() method
The new `info()` method lets developers store arbitrary information about
their module for consumption later.

Closes #15225
2017-03-02 08:22:08 +00:00
Martin Staffa e269c14425 fix($controller): remove instantiating controllers defined on window
This also removes the likewise deprecated `$controllerProvider.allowGlobals()` method.

Closes #15349
Closes #15762

BREAKING CHANGE:

The option to instantiate controllers from constructors on the global `window` object
has been removed. Likewise, the deprecated `$controllerProvider.allowGlobals()`
method that could enable this behavior, has been removed.

This behavior had been deprecated since AngularJS v1.3.0, because polluting the global scope
is bad. To migrate, remove the call to $controllerProvider.allowGlobals() in the config, and
register your controller via the Module API or the $controllerProvider, e.g.

```
angular.module('myModule', []).controller('myController', function() {...});

angular.module('myModule', []).config(function($controllerProvider) {
  $controllerProvider.register('myController', function() {...});
});

```
2017-03-01 13:27:17 +01:00
Peter Bacon Darwin 19bc52127f fix(Angular): do not autobootstrap if the src exists but is empty
In Chrome an empty `src` attribute will be ignored, but in Firefox it seems
happy to prepend the `base[href]` and try to load whatever that is.
2017-02-27 11:53:44 +00:00
Georgios Kalpakas 4f69d38f09 fix($sanitize): prevent clobbered elements from freezing the browser
Closes #15699
2017-02-24 16:38:16 +00:00
Peter Bacon Darwin ebe90051ed fix(Angular): do not auto bootstrap if the currentScript has been clobbered 2017-02-24 14:53:22 +00:00
Peter Bacon Darwin a649758655 fix(Angular): do not auto bootstrap if the script source is bad and inside SVG 2017-02-24 14:52:13 +00:00
Peter Bacon Darwin c357b1aba6 test(Angular): refactor auto bootstrap tests 2017-02-24 14:46:27 +00:00
Martin Staffa 603b66e1fa docs(changelog): insert release notes for 1.2.32
They were only in the v1.2.x branch.
2017-02-24 11:09:11 +01:00
Martin Staffa 295043d32e docs($compile): clarify to which element scope isolation applies
Closes #13556
2017-02-22 21:05:44 +01:00
waahhhh 892d236afc docs(changelog): correct typo
changed spelling from "auto-bootstraping" to "auto-bootstrapping".

Closes #15729
2017-02-21 15:20:14 +01:00
Peter Bacon Darwin b7ee5ee3c6 chore(jenkins): disable unit testing on Safari
There is a strange failure in the animation code that only appears to happen
on Safari 10 on OS/X. While we investigate we are disabling this browser
to allow the development (and doc generation) to continue.
2017-02-20 20:09:38 +00:00
Georgios Kalpakas b55637a8f7 fix($animate): reset classNameFilter to null when a disallowed RegExp is used
Closes #14913
2017-02-17 11:26:23 +02:00
Georgios Kalpakas 9a2efb7b66 fix($animate): improve detection on ng-animate in classNameFilter RegExp
Fixes #14806
2017-02-17 11:26:21 +02:00
Martin Staffa db46d24491 chore(docs-app): add debounce to search input
This fixes issues where the search results do not correctly reflect
the search query. This happens in Firefox when you enter a search query
very rapidly.
There is probably an issue with the async behavior of the search / webworker,
so this is just a workaround.
2017-02-16 14:28:43 +01:00
Keith Walsh f779230f70 docs($resource): add minor clarification
Closes #15711
2017-02-16 11:59:35 +02:00
Martin Staffa 62494bae38 chore(docs-app): update links in header menu
They are now in the same order as angularjs.org

Closes #14351
2017-02-15 15:53:51 +01:00
Martin Staffa f85656e934 chore(docs-app): update the header style
Also adds a new fixed strip / bar about the AngularJS version

Closes #14963
Closes #15670
2017-02-15 15:53:51 +01:00
Martin Staffa b9d3185e52 docs(select, ngOptions): add ngAttrSize as argument
Closes #1619
2017-02-15 15:25:25 +01:00
Martin Staffa 43cf54c3a2 docs(ngModelController): improve $formatters and $parsers info
Closes #11714
Closes #8194
2017-02-15 13:05:15 +01:00
Martin Staffa 15149c1da1 docs(filterFilter): add note about self-referencing objects in array
Relate #6655, #6319
2017-02-15 12:19:06 +01:00
Martin Staffa 23e747331b docs(guide/directive): clarify which type of matching directives support
Closes #15710
2017-02-15 12:19:06 +01:00
Georgii Dolzhykov 71f437c15a refactor($rootScope): remove extraneous call to $parse in $evalAsync
Closes #15682
2017-02-09 23:38:03 +02:00
Michał Gołębiowski 2c7400e7d0 chore(jenkins): get rid of Opera from the Jenkins build script
The Opera launcher hasn't been installed for ages, but until Karma 1.4.0 the
error of Opera not being able to start was ignored. Karma has fixed the bug and
now Jenkins is failing.

This commit also removes Opera/Opera launcher mentions from the docs. We don't
support Opera officially anymore (it's sort-of supported via being based on
Blink).

Closes #15691
2017-02-09 12:56:59 +02:00
PRIJCK Frederik (FPRJ) 2af2607fba fix(filterFilter): don't throw if key.charAt is not a function
Previously, when an object has keys which are not of type string, `filterFilter`
would throw an exception for trying to call `key.charAt()`, which is a string
method.

This commit checks whether `charAt` is defined before calling it.

Fixes #15644

Closes #15660
2017-02-08 23:17:26 +02:00
mohamed amr a0641ea475 feat(errorHandlingConfig): make the depth for object stringification in errors configurable
Closes #15402
Closes #15433
2017-02-08 19:05:43 +02:00
Martin Staffa 538f4606ff fix(select): add attribute "selected" for select[multiple]
This helps screen readers identify the selected options,
see #14419
2017-02-08 17:44:47 +01:00
Martin Staffa 4385e1268a fix(select): keep original selection when using shift to add options in IE/Edge
In IE9-11 + Edge, the selected options were previously incorrect under the following
circumstances:
- at least two options are selected
- shift+click or shift+down/up is used to add to the selection (any number of options)

In these cases, only the last of the previously selected options and the newly selected
options would be selected.

The problems seems to be that the render engine gets confused when an option that
already has selected = true gets selected = true set again.

Note that this is not testable via unit test because it's not possible to simulate
click / keyboard events on option elements (the events are delegated to the select element
change event), and the problem also doesn't appear when modifying the option elements directly
and then using the selectController API. It seems that this only happens when you manipulate the
select directly in the user interface.

Fixes #15675
Closes #15676
2017-02-08 17:44:47 +01:00
Martin Staffa ba8b924bf5 test($http): ensure json deserialization errors are forwarded to error handler
Since https://github.com/angular/angular.js/commit/e13eeabd7e34a78becec06cfbe72c23f2dcb85f9,
errors thrown from onFulfilled and onRejected handlers are passed to the regular http
error handlers. Before this, JSON deserialization errors lead to hard application errors, and could
not be handled by application code. This behavior was introduced in https://github.com/angular/angular.js/commit/7b6c1d08aceba6704a40302f373400aed9ed0e0b, and originally, a malformed JSON string was forwarded
as the data to the http success response handler.

This commit adds a specifc test case, even though the behavior is unlikely to break in the future without
a change in the $q rejection handling.

Related #11433
Closes #15689
2017-02-08 17:41:23 +01:00
Matt Lewis 0ce9348bc0 fix($jsonpCallbacks): allow $window to be mocked in unit tests
Fixes #15685

Closes #15686
2017-02-08 18:07:17 +02:00
Georgios Kalpakas a29f66c465 chore(*): update dependencies (including changez-angular) 2017-02-08 18:07:17 +02:00
Georgios Kalpakas 79c4a712d7 docs(changelog): update with changes for 1.6.2 2017-02-07 15:26:25 +02:00
Martin Staffa 2f667b177c docs(guide/scopes): mention component directive scopes, reorder info
Closes #15634
2017-02-06 17:25:14 +01:00
Martin Staffa 07f34e7af3 docs: fix some dangling links
They broke during the Angular -> AngularJS rename
2017-02-06 16:42:49 +01:00
Georgios Kalpakas 493b4967de test($resource): fix broken test
(Introduced while "cleaning up" the tests for in edfb691.)
2017-02-05 17:56:51 +02:00
Georgios Kalpakas 8c1b4c020d refactor(*): remove ignored expensiveChecks argument passed to $parse()
This is a follow-up to #15094.

Closes #15680
2017-02-05 15:38:27 +02:00
Kyle Wuolle edfb691deb fix($resource): do not swallow errors in success callback
Previously, errors thrown inside the `success` callback would be swallowed by a
noop `catch()` handler. The `catch()` handler was added in order to avoid an
unnecessary "Possibly Unhandled Rejection" error, in case the user provided an
`error` callback (which would handle request errors).

The handler was added too "eagrly" and as a result would swallow errors thrown
in the `success` callback, despite the fact that those errors would _not_ be
handled by the `error` callback.

This commit fixes this, by adding the `catch()` handler "lazily", only when it
is certain that a rejection will be handled by the `error` callback.

Fixes #15624

Closes #15628
2017-02-04 21:00:32 +02:00
Kindy Lin 8162362217 fix($parse): make sure ES6 object computed properties are watched
Add the missing watches for ES6 object computed properties which were
implemented in #14407.

Closes #15678
2017-02-04 16:16:04 +02:00
Dimitris Vardoulakis 15581287a4 refactor(*): avoid non-existent property warnings from Closure Compiler
Closes #15672
2017-02-02 22:37:17 +02:00
Chris fd76d872fc docs(misc/started): update Twitter handle (@angularjs --> @angular)
Closes #15671
2017-02-02 19:29:25 +02:00
Jessica Soltero 3708162bc8 docs(guide/expression): typo in one-time-binding
Closes #15668
2017-02-02 12:45:10 +02:00
Michał Gołębiowski 813117da31 refactor($injector): remove the Chrome stringification hack
The Chrome stringification hack added in afcedff34c
is no longer needed. I verified that both of the commented out tests pass
on Chrome 56.
2017-02-01 15:02:11 +00:00
Michał Gołębiowski dc8762eff1 chore(anchorScroll): remove a Jasmine toHaveBeenCalled workaround
The Jasmine fix landed long time ago and we've updated Jasmine since that
happened.
2017-02-01 13:36:08 +00:00
Michał Gołębiowski 1e3c7d2922 docs($location): fix examples
The examples contained tests with assertions in form of regular equality
comparisons which would be noops and in case of an error nothing would get
reported. Also, one of the test mixed a HTML5 browser scenario with a non-HTML5
one.
2017-02-01 13:35:01 +00:00
Michał Gołębiowski 187fce7cdf docs($animation): fix weird spaces around colons 2017-02-01 13:29:06 +00:00
Peter Bacon Darwin 2b00e8893e feat(ngModel): add $overrideModelOptions support
This change allows developers to modify the model options for an `ngModel`
directive programmatically.

Closes #15415
2017-02-01 12:19:37 +00:00
Patrick McElhaney d03357a320 docs(guide/component): add replace option
Add `replace` to the table comparing components to directives options. The
`replace` option is deprecated, but it is still documented for directives, so
it is worth pointing it out as a difference between directives and components.

Closes #15658
2017-01-31 19:34:29 +02:00
Georgios Kalpakas 03dbd94cb8 fix($compile): do not swallow thrown errors in test
In e13eeab, errors/rejections produced during fetching the template or compiling
an asynchronous directive, where overzealously silenced. This doesn't make any
difference in (most) production apps, where `$exceptionHandler` does not rethrow
the errors. In tests though (where `$exceptionHandler` rethrows by default), it
can unexpectedly "swallow" thrown errors.

This commit fixes it by removing the extraneous `.catch(noop)`, thus letting
errors thrown by `$exceptionHandler` to surface.

The changes in 'compileSpec.js' essentially revert the modifications that were
unnecessarily (and incorrectly) done in e13eeab (and also one incorrect
modification from [c22615c][1]).

[1]: https://github.com/angular/angular.js/commit/c22615cbfbaa7d1712e79b6bf2ace6eb41313bac#diff-348c2f3781ed66a24894c2046a52c628L2084

Fixes #15629

Closes #15631
2017-01-30 19:23:50 +02:00
Peter Bacon Darwin 0ef193f1a3 chore(docs): don't use bower for docs dependencies 2017-01-30 13:31:56 +00:00
Frederik Prijck dea8ae9af0 chore(doc-gen): show arguments as a subsection of the usage section
Previously, on the docs of directives which include the `animation` section, `arguments` are shown as an `h3` element below the `animation` `h2` element, making it look like it's a subsection of `animations`.

This commit ensures that the àrgument` `h3`element is rendered correctly after the `usage` `h2` element.

Fixes #15645
Closes #15646
2017-01-28 15:20:05 +01:00
vteremasov 39a90a9c20 fix($resource): correctly unescape /\. even if \. comes from a param value
Closes #15627
2017-01-27 18:15:49 +02:00
Jason Bedard fd4f011118 perf($compile): do not use deepWatch in literal one-way bindings
Avoiding deep watchers for array/object literals will improve watcher
performance of all literals passed as one-way bindings, especially those
containing references to large/complex objects.

BREAKING CHANGE:
Previously when a literal value was passed into a directive/component via
one-way binding it would be watched with a deep watcher.

For example, for `<my-component input="[a]">`, a new instance of the array
would be passed into the directive/component (and trigger $onChanges) not
only if `a` changed but also if any sub property of `a` changed such as
`a.b` or `a.b.c.d.e` etc.

This also means a new but equal value for `a` would NOT trigger such a
change.

Now literal values use an input-based watch similar to other directive/component
one-way bindings. In this context inputs are the non-constant parts of the
literal. In the example above the input would be `a`. Changes are only
triggered when the inputs to the literal change.

Closes #15301
2017-01-27 10:05:51 +00:00
Jason Bedard 7084deccaa feat($parse): allow watching array/object of inputs to literal values
The inputs of array/object literals are now watched for changes.
If the an input changes then a new instance of the literal will be
provided when the parsed expression is executed.

Closes #15301
2017-01-27 10:05:50 +00:00
frederikprijck 7019d9f27a fix($sniffer): allow history for NW.js apps
Previously `$sniffer` incorrectly detected NW.js apps as Chrome Packaged Apps,
disallowing them to use the history API.

This commit correctly detects NW.js apps and allows them to use the History API.

Fixes #15474

Closes #15633
2017-01-27 00:11:58 +02:00
Martin Staffa 89f3e3b0af fix(select): keep ngModel when selected option is recreated by ngRepeat
Fixes #15630 
Closes #15632
2017-01-26 13:29:11 +01:00
Georgios Kalpakas 641e13acc1 refactor(*): replace HashMap with NgMap
For the time being, we will be using `NgMap`, which is an API-compatible
implementation of native `Map` (for the features required in Angular). This will
make it easy to switch to using the native implementations, once they become
more stable.

Note:
At the moment some native implementations are still buggy (often in subtle ways)
and can cause hard-to-debug failures.)

Closes #15483
2017-01-25 23:20:18 +02:00
Georgios Kalpakas 028fa1abb2 test(hashKey): add tests for hashKey() 2017-01-25 23:17:06 +02:00
Martin Staffa 3c259ce624 docs(ngDisabled): list some elements that natively support
Closes #15473
2017-01-25 20:07:50 +01:00
Martin Staffa ef7d18b1c4 docs($compile): fix AngularJS versions 2017-01-25 20:03:04 +01:00
Peter Bacon Darwin 03043839d5 docs(*): ensure naming is correct for Angular(JS) versions 2017-01-25 08:18:39 +00:00
Georgios Kalpakas d24617bf32 fix(ngAnimate): correctly animate transcluded clones with templateUrl
Previously, `$animate` would decide whether an animation should be cancelled
based on some assumption that didn't hold in specific cases (e.g. when animating
transcluded clones with `templateUrl` directives on them for the first time). As
a result, the entering elements would not be animated in such cases. This
affected commonly used, structural built-in directives (`ngIf`, `ngRepeat`,
`ngSwitch` etc).
This commit fixes it by avoiding invalid assumptions (i.e. by taking into
account the transformations that take place while compiling such elements).

Partly addresses #14074 and #14124.

Fixes #15510

Closes #15514
2017-01-24 23:54:33 +02:00
Georgios Kalpakas 2b7a359363 test(ngAnimate): make expectations more specific 2017-01-24 23:54:33 +02:00
Georgios Kalpakas e7d8eee46d refactor(ngAnimate): simplify functions and remove redundant args/calls
Simplifies/Optimizes the following functions:

- `areAnimationsAllowed()`
- `cleanupEventListeners()`
- `closeChildAnimations()`
- `clearElementAnimationState()`
- `markElementAnimationState()`
- `findCallbacks()`

Although not its primary aim, this commit also offers a small performance boost
to animations (~5% as measured with the `animation-bp` benchmark).
2017-01-24 23:54:32 +02:00
Georgios Kalpakas 565ca6a1f5 chore(benchmarks): add basic animation benchmark 2017-01-24 23:54:32 +02:00
Georgios Kalpakas 54a7caf667 docs(*): document the breaking change in 7ceb5f6 2017-01-20 22:47:27 +02:00
Peter Bacon Darwin eba7c28261 chore(package): relax yarn version constraint 2017-01-19 08:18:40 +00:00
Peter Bacon Darwin 83b67b6c54 revert:docs(guide/scope): access the current element's scope in the console
This reverts commit c6bd58eb58.
The recommended approach of just typing scope does not appear to work out of the box.

See https://github.com/angular/angular.js/pull/4884#issuecomment-273686380
2017-01-19 07:55:33 +00:00
frederikprijck d85b3f56ac fix(ngValue): correctly update the value property when value is undefined
Previously, when the expression evaluated to `undefined` the `value` property
was not updated. This happened because jqLite/jQuery's `prop(_, undefined)` is
treated as a getter, thus not apdating the property.

This commit fixes it by setting the property to `null` instead.
(On IE9 we use `''` - see inline comments for more info.)

Fixes #15603

Closes #15605
2017-01-18 19:01:11 +02:00
Raphael Jamet 1cf728e209 fix($compile) : add base[href] to the list of RESOURCE_URL context attributes
Previously, `base[href]` didn't have an SCE context. This was not ideal, because
`base[href]` affects the behavior of all relative URLs across the page.
Furthermore, since #15145, `base[href]` also affects which URLs are considered
trusted under the 'self' policy for white- or black-listed resource URLs.

This commit tightens the security of Angular apps, by adding `base[href]` to the
list of RESOURCE_URL context attributes, essentially putting the same
constraints on bindings to `base[href]` as on iframe or script sources.

Refer to the
[`$sce` API docs](https://code.angularjs.org/snapshot/docs/api/ng/service/$sce)
for more info on SCE trusted contexts.

Closes #15597

BREAKING CHANGE:

Previously, `<base href="{{ $ctrl.baseUrl }}" />` would not require `baseUrl` to
be trusted as a RESOURCE_URL. Now, `baseUrl` will be sent to `$sce`'s
RESOURCE_URL checks. By default, it will break unless `baseUrl` is of the same
origin as the application document.

Refer to the
[`$sce` API docs](https://code.angularjs.org/snapshot/docs/api/ng/service/$sce)
for more info on how to trust a value in a RESOURCE_URL context.

Also, concatenation in trusted contexts is not allowed, which means that the
following won't work: `<base href="/something/{{ $ctrl.partialPath }}" />`.

Either construct complex values in a controller (recommended):

```js
this.baseUrl = '/something/' + this.partialPath;
```
```html
<base href="{{ $ctrl.baseUrl }}" />
```

Or use string concatenation in the interpolation expression (not recommended
except for the simplest of cases):

```html
<base href="{{ '/something/' + $ctrl.partialPath }}" />
```
2017-01-18 12:02:15 +02:00
Martin Brown 675f99bc5a docs(guide/i18n): fix typos
Closes #15616
2017-01-17 18:09:19 +02:00
Georgios Kalpakas 5b6763f575 docs(changelog): update with changes for 1.5.11 2017-01-13 01:07:45 +02:00
Georgios Kalpakas 22392ef949 style($compile): remove trailing whitespace 2017-01-12 23:12:01 +02:00
Grace Benz f63c46406f docs($compile): add some detail about $onChanges
Closes #15604
2017-01-12 22:39:47 +02:00
Georgios Kalpakas 3983a66eda test(e2e): make test less flakey-prone 2017-01-12 22:24:49 +02:00
Peter Bacon Darwin 74e232dab7 fix(ngMockE2E): ensure that mocked $httpBackend uses correct $browser
The fix from #13124 enabled ngMock and ngMockE2E to work together but
did it in a way that meant that the "real" `$httpBackend` service that
was used in pass-through depended upon a different `$browser` service
to the rest of the app.

This broke Protractor since it watches the `$browser` for outstanding
requests and the pass through requests were being tracked by the wrong
`$browser` instance.

Closes #15593
2017-01-12 09:46:24 +00:00
Georgios Kalpakas 2e27df690c chore(*): update dgeni-packages (and other devDependencies)
`dgeni-packages` prior to version 0.16.3 specified `engine.yarn: '^0.17.9'`,
which was unnecessarily strict and would cause any task to fail if someone had a
yarn version >=0.18.0.
Other devDependencies were also updated (because why not).

Closes #15600
2017-01-12 00:33:26 +02:00
Sammy Jelin c522a43f41 fix($route): make asynchronous tasks count as pending requests
Protractor users were having a problem where if they had asynchonous code in a
`route.resolve` or `route.resolveRedirectTo` variable, Protractor was not
waiting for that code to complete before continuing. See
https://github.com/angular/protractor/issues/789#issuecomment-190983200 for
details.

This commit fixes it by ensuring that `$browser#outstandingRequestCount` is
properly increased/decreased while `$route` (asynchronously) processes a route.

Also, enhanced `ngMock` to wait for pending requests, before calling callbacks
from `$browser.notifyWhenNoOutstandingRequests()`.

Related to angular/protractor#789.

Closes #14159
2017-01-12 00:07:22 +02:00
frederikprijck 9c722cfcd2 fix($compile): allow the usage of "$" in isolate scope property alias
Previously, when using an alias for an isolate scope or `bindings` property
(e.g. `alias: '<attrName'` instead of `attrName: '<'`), a `$compile:iscp` error
was thrown if the attribute name contained a "$".
This commit removes the error by changing the regex to allow "$" characters in
the attribute name when using a property alias.

Fixes: #15586

Closes #15594
2017-01-11 11:39:03 +02:00
Alex Dobkin 9412962696 fix($sce): consider document base URL in 'self' URL policy
Page authors can use the `<base>` tag in HTML to specify URL to use as a base
when resovling relative URLs. This can cause SCE to reject relative URLs on the
page, because they fail the same-origin test.

To improve compatibility with the `<base>` tag, this commit changes the logic
for matching URLs to the 'self' policy to allow URLs that match the protocol and
domain of the base URL in addition to URLs that match the loading origin.

**Security Note:**
If an attacker can inject a `<base>` tag into the page, they can circumvent SCE
protections. However, injecting a `<base>` tag typically requires the ability to
inject arbitrary HTML into the page, which is a more serious vulnerabilty than
bypassing SCE.

Fixes #15144

Closes #15145
2017-01-10 14:20:15 +02:00
Georgios Kalpakas 752f411c8b fix($location): correctly handle external URL change during $digest
Previously, when the URL was changed directly (e.g. via `location.href`) during
a `$digest` (e.g. via `scope.$evalAsync()` or `promise.then()`) the change was
not handled correctly, unless a `popstate` or `hashchange` event was fired
synchronously.

This was an issue when calling `history.pushState()/replaceState()` in all
browsers, since these methods do not emit any event. This was also an issue when
setting `location.href` in IE11, where (unlike other browsers) no `popstate`
event is fired at all for hash-only changes ([known bug][1]) and the
`hashchange` event is fired asynchronously (which is too late).

This commit fixes both usecases by:

1. Keeping track of `$location` setter methods being called and only processing
   a URL change if it originated from such a call. If there is a URL difference
   but no setter method has been called, this means that the browser URL/history
   has been updated directly and the change hasn't yet been propagated to
   `$location` (e.g. due to no event being fired synchronously or at all).
2. Checking for URL/state changes at the end of the `$digest`, in order to
   detect changes via `history` methods (that took place during the `$digest`).

[1]: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/3740423/

Fixes #11075
Fixes #12571
Fixes #15556

Closes #15561
2017-01-09 23:58:10 +02:00
Georgios Kalpakas 2b360bf305 fix(*): detect external changes in history.state
Previously, `$browser.$$checkUrlChange()` (which was run before each `$digest`)
would only detect an external change (i.e. not via `$location`) to the browser
URL. External changes to `history.state` would not be detected and propagated to
`$location`.

This would not be a problem if changes were followed by a `popstate` or
`hashchange` event (which would call `cacheStateAndFireUrlChange()`). But since
`history.pushState()/replaceState()` do not fire any events, calling these
methods manually would result in `$location` getting out-of-sync with the actual
history state.

This was not detected in tests, because the mocked `window.history` would
incorrectly trigger `popstate` when calling `pushState()/replaceState()`, which
"covered" the bug.

This commit fixes it by always calling `cacheState()`, before looking for and
propagating a URL/state change.
2017-01-09 23:57:31 +02:00
Nikhil Wins c00903be7a refactor($interpolate): remove unnecessary else
Closes: #15575
2017-01-05 13:57:56 +01:00
David Jöch 3776b2ef30 style($log): fix indentation
Closes #15579
2017-01-05 13:02:01 +02:00
Florian Berger e193cda800 docs(*): fix typos
Closes #15577
2017-01-05 11:04:17 +02:00
Nic Mitchell 296e9f6cdf chore(*): update copyright year
Closes #15573
2017-01-04 12:14:45 +02:00
Georgios Kalpakas 035f1cd90e docs(guide/$location): correctly format heading 2017-01-03 22:36:28 +02:00
Georgios Kalpakas 0694af8fc4 fix(angularInit): allow auto-bootstraping from inline script
Some browsers (e.g. Safari 9.x, PhantomJS) do not set `link.origin/protocol`
correctly, when setting `link.href` to `null`, which prevented auto-bootstraping
Angular from scripts without a `src` attribute (i.e. inline scripts).
Inline scripts are on the same origin as the loading page, so auto-bootstraping
should be allowed.

Fixes #15567

Closes #15571
2017-01-03 19:14:57 +02:00
Soumya Ranjan Mohanty 090a839ac9 docs(guide/services): fix syntax for Jasmine v2.x
Closes #15570
2017-01-03 16:13:22 +02:00
Georgios Kalpakas 5294d208ae docs(ngShow/ngHide): improve docs and fix inconsistencies between ngShow/ngHide
Closes #15471
2017-01-03 12:41:11 +02:00
Deco 4082fb03b6 docs(tutorial/step_04): fix typo
Closes #15562
2016-12-31 12:31:31 +02:00
Georgios Kalpakas a24777a2c4 fix(input): fix step validation for input[type=number/range]
Previously, the validation would incorrectly fail in certain cases (e.g.
`step: 0.01`, `value: 1.16 or 20.1`), due to Floating Point Arithmetic
limitations. The previous fix for FPA limitations (081d06ff) tried to solve the
issue by converting the numbers to integers, before doing the actual
calculation, but it failed to account for cases where the conversion itself
returned non-integer values (again due to FPA limitations).
This commit fixes it by ensuring that the values used in the final calculation
are always integers.

Fixes #15504

Closes #15506
2016-12-29 10:16:07 +02:00
Georgios Kalpakas 99a3adbdaa docs(CHANGELOG.md): add missing commas 2016-12-29 10:08:40 +02:00
supasak 922a83e94f fix($resource): delete $cancelRequest() in toJSON()
Closes #15244
2016-12-29 10:00:42 +02:00
Peter Bacon Darwin ee1458fdba docs(CHANGELOG): add 1.6.1 release info 2016-12-23 10:53:38 +00:00
Peter Bacon Darwin cfc16b17f7 chore(deps): update changez-angular version 2016-12-23 10:52:32 +00:00
Naomi Black 8ceeeccdd7 docs(guide/forms): remove implicit bias from example
Closes #15543
2016-12-23 11:42:16 +02:00
Thomas Grainger 316f60fd14 fix($q): Add traceback to unhandled promise rejections
Fixes #14631
Closes #15527
2016-12-21 20:08:24 +01:00
sp00m f768da2488 fix($$cookieReader): correctly handle forbidden access to document.cookie
In certain cases (e.g. on LG webOS using the `file:` protocol), access to
`document.cookie` may not be allowed and throw an error. This could break
`$http` which relies on `$$cookieReader()` for retrieving the XSRF token.
This commit fixes it by treating `document.cookie` as empty, when access to it
is fordibben.

Fixes  #15523

Closes #15532
2016-12-20 23:28:34 +02:00
Simon Legner c898ae9e45 docs(CHANGELOG): fix typo
Closes #15529
2016-12-20 10:29:36 +02:00
Thomas Grainger 47b14bf3e3 docs(guide/migration): improve grammar
Closes #15526
2016-12-20 01:16:24 +02:00
Georgios Kalpakas 4e143fcae3 fix(ngOptions): do not unset the selected property unless necessary
Previously, when updating the value of a `select[multiple]` element, all options
were first set to `selected = false` and then the selected ones were set to
`true`. By setting an already selected option to `selected = false` and then
`true` again - essentially unselecting and reselecting it - caused some browsers
(including Firefox, IE and under some circumstances Chrome) to unexpectedly
scroll to the last selected option.

This commit fixes it by ensuring that the `selected` property is only set if its
current value is different than the new one and even then it is set to its final
value at once (i.e. without first setting it to `false`), thus avoiding the
undesirable behavior.

Fixes #15477

Closes #15478
2016-12-19 22:44:36 +02:00
Peter Neave 15d07c0108 docs(tutorial/step_13): add missing dependency phoneDetails module
Closes #15521
2016-12-19 20:53:38 +02:00
Peter Bacon Darwin d08e31984d chore(doc-gen): update to dgeni-packages@0.16.2 2016-12-16 14:08:37 +00:00
Georgios Kalpakas fbe0b73ab5 docs(CHANGELOG.md): remove reverted bug fix
Related to 02f045b.
2016-12-16 11:11:22 +02:00
Peter Bacon Darwin 07987e26e9 docs(CHANGELOG): add note to 1.5.0-beta.1 2016-12-15 20:41:13 +00:00
Georgios Kalpakas c6842b5a65 docs(CHANGELOG.md): add changes for v1.5.10 2016-12-15 19:18:29 +02:00
Georgios Kalpakas baa30695f3 docs(CHANGELOG.md): add missing entries for v1.6.0-rc.0/v1.6.0 2016-12-15 19:18:28 +02:00
Georgios Kalpakas d03cac4cd5 docs($q): document the default value for errorOnUnhandledRejections 2016-12-14 00:43:52 +02:00
Jannick Fahlbusch e9a4de035d docs($interval): improve fn description
If no additional arguments are passed, the function is called with the current iteration count.

Closes #15503
2016-12-13 14:07:58 +02:00
Georgios Kalpakas ce8abac66d fix(ngModelOptions): work correctly when on the template of replace directives
Previously, in order for `ngModel` and `ngModelOptions` to work correctly
together, the latter's pre-linking function should be run before the former's
pre-linking function. This was typically what happened, except when `ngModel`
was used on an element which also had a `replace` directive, whose template
included `ngModelOptions`. In that case, the order was reversed.

This commit fixes it by moving the initialization logic of `ngModelOptions` from
its pre-linking function to its controller's `$onInit()` lifecycle hook.

Fixes #15492

Closes #15493
2016-12-13 00:09:56 +02:00
Georgios Kalpakas fade1db253 refactor(testabilityPatch): remove code duplication 2016-12-13 00:04:57 +02:00
Aaron Brewer 29f3bf4bd6 docs(ngMessageExp): improve description
Closes #15486
2016-12-11 20:58:13 +02:00
idhindsight 7f8bc587ae docs(tutorial/step_09): fix typo (it's --> its)
Closes #15485
2016-12-10 22:15:35 +02:00
David Rodenas Pico 1ecf6efa81 chore(benchpress): add an ngClass benchmark
Closes #15243
2016-12-09 12:20:31 +02:00
Georgios Kalpakas b82097085d perf(ngClass): avoid unnecessary .data() accesses, deep-watching and copies
Includes the following commits (see #15246 for details):

- **perf(ngClass): only access the element's `data` once**

- **refactor(ngClass): simplify conditions**

- **refactor(ngClass): move helper functions outside the closure**

- **refactor(ngClass): exit `arrayDifference()` early if an input is empty**

- **perf(ngClass): avoid deep-watching (if possible) and unnecessary copies**

  The cases that should benefit most are:

  1. When using large objects as values (e.g.: `{loaded: $ctrl.data}`).
  2. When using objects/arrays and there are frequent changes.
  3. When there are many `$index` changes (e.g. addition/deletion/reordering in large `ngRepeat`s).

  The differences in operations per digest include:

  1. `Regular expression (when not changed)`
     **Before:** `equals()`
     **After:**  `toClassString()`

  2. `Regular expression (when changed)`
     **Before:** `copy()` + 2 x `arrayClasses()` + `shallowCopy()`
     **After:**  2 x `split()`

  3. `One-time expression (when not changed)`
     **Before:** `equals()`
     **After:**  `toFlatValue()` + `equals()`*

  4. `One-time expression (when changed)`
     **Before:** `copy()` + 2 x `arrayClasses()` + `shallowCopy()`
     **After:**  `copy()`* + `toClassString()`* + 2 x `split()`

  5. `$index modulo changed`
     **Before:** `arrayClasses()`
     **After:**  -

  (*): on flatter structure

  In large based on #14404. Kudos to @drpicox for the initial idea and a big part
  of the implementation.

Closes #14404

Closes #15246
2016-12-09 11:49:10 +02:00
Georgios Kalpakas 5fd5e131b6 fix(ngClassOdd/Even): add/remove the correct classes when expression/$index change simultaneously 2016-12-09 11:49:09 +02:00
David Rodenas Pico 7b2ed4ae41 test(ngClass): add some tests about one-time bindings and objects inside arrays 2016-12-09 11:49:09 +02:00
Georgios Kalpakas 7c80d8afa9 refactor(ngClass): remove redundant $observer and dependency on $animate
Includes the following commits (see #15246 for details):

- **refactor(ngClass): remove unnecessary dependency on `$animate`**

- **refactor(ngClass): remove redundant `$observe`r**

  The code was added in b41fe9f in order to support having both `ngClass` and
  interpolation in `class` work together. `ngClass` has changed considerably since
  b41fe9f and for simple cases to work the `$observe`r is no longer necessary (as
  indicated by the expanded test still passing).

  That said, it is a [documented known issue][1] that `ngClass` should not be used
  together with interpolation in `class` and more complicated cases do not work
  anyway.

[1]: https://docs.angularjs.org/api/ng/directive/ngClass#known-issues
2016-12-09 11:48:02 +02:00
Aman Mittal d05f894aff docs(guide/external-resources): add "AngularJS in Action" book
Closes #15480
2016-12-09 11:34:53 +02:00
Georgios Kalpakas 1c0c2605d3 fix($rootScope): when adding/removing watchers during $digest
Previously, adding a watcher during a `$digest` (i.e. from within a watcher),
would result in the next watcher getting skipped. Similarly, removing a watcher
during a `$digest` could result in the current watcher being run twice (if the
removed watcher had not run yet in the current `$digest`).

This commit fixes both cases by keeping track of the current watcher index
during a digest and properly updating it when adding/removing watchers.

Fixes #15422

Closes #15424
2016-12-09 10:39:54 +02:00
Peter Bacon Darwin 5b477614ff chore(docs): fix plnkrOpener to use $onInit
Since 1.6.0 does not preassign bindings before running the controller
constructor function, we must move initialisation into the `$onInit`
method.
2016-12-09 01:12:59 +00:00
Peter Bacon Darwin 9595337f67 chore(package): update docs app to run on 1.6.0 2016-12-08 23:42:55 +00:00
Georgios Kalpakas a9e91461a8 fix(jqLite): silently ignore after() if element has no parent
Previously, the element was always assumed to have a parent and an error was
thrown when that was not the case.
This commit makes jqLite consistent with jQuery, which silently ignores a call
on elements that do not have a parent.

Fixes #15331
Closes #15367

Closes #15475
2016-12-08 18:11:34 +02:00
Peter Bacon Darwin 4e7f652b5f chore(package): update dist-tag for master/1.7 2016-12-08 13:56:34 +00:00
Georgios Kalpakas e922c38612 docs(ngMockE2E): correctly document the data arg of $httpBackend.when(...) 2016-12-08 14:53:47 +02:00
Peter Bacon Darwin 1b7ddd3491 chore(bower/npm): use npm (not yarn) to publish
yarn has an annoying behaviour in that it wants to do the version bumping
for you and requires an interactive terminal to tell it what version.
2016-12-08 12:21:57 +00:00
Peter Bacon Darwin 4c5afb5cc2 chore(jenkins): ensure deps are installed before trying to use them 2016-12-08 11:07:52 +00:00
Peter Bacon Darwin f0dc288824 chore(jenkins): fix working directory to make yarn work 2016-12-08 10:53:07 +00:00
Peter Bacon Darwin 70490ef717 docs(CHANGELOG): fix 1.6.0 release name 2016-12-08 10:21:48 +00:00
Peter Bacon Darwin dfef3bf2d4 chore(package): update dist-tag for 1.6.0 release 2016-12-08 10:18:07 +00:00
Peter Bacon Darwin f727adddeb docs(CHANGELOG): 1.6.0 release notes 2016-12-08 10:15:05 +00:00
Peter Bacon Darwin fc89a85406 chore(jenkins): fix yarn and grunt installation 2016-12-07 10:53:37 +00:00
Georgios Kalpakas b4f5377a2f docs(guide/migration): fix typo 2016-12-07 01:55:48 +02:00
Georgios Kalpakas 7a667c77e3 fix(select): do not throw when removing the element (e.g. via ngIf)
Fixes #15466

Closes #15468
2016-12-06 12:43:34 +02:00
Georgios Kalpakas 752b1e69b7 fix($resource): allow params in hostname (except for IPv6 addresses)
Support for IPv6 addresses (in b643f0d) was too aggressive and broke support for params in the
`hostname` part of a URL.
This commit restores support for params in the `hostname`, as long as it is not an IPv6 address.

Fixes #14542

Closes #14906
2016-12-03 09:56:18 +02:00
ojab 1102c84f59 docs(guide/templates): camelCase directive name for consistency
Closes #15465
2016-12-02 23:40:22 +02:00
Martin Staffa 245b27101a fix(ngOptions): don't add comment nodes as empty options
When the "empty option" element contains a transclusion directive, the result of the compilation always includes a comment node. Since we are adding / removing the "selected" attribute on the empty option, we need to make sure it's an actual element.

To solve this, we take advantage of the fact the each option element has an option directive that tries to register the option with the selectController. With ngOptions, this registerOption function is normally noop'd since it's not possible to add dynamic options. Now if the result of the empty option compilation is a comment, we re-define the function so that it catches empty options when they are actually linked / rendered.

Closes #15454
Closes #15459
2016-12-02 18:48:49 +01:00
Martin Staffa f5d2bf3d6e chore(doc-gen): render @example tag in ngdoc @method
Currently, ngdoc `@method` ignores `@example` tags and does not output them.
This is usually not a problem, as examples are mostly defined directly
in the `@description` via code blocks or `<example>`
elements. However, some methods still have `@example` tags (possibly
from a previous docs version).

While not absolutely necessary, having special markup for Examples
makes them a) easier to find visually in the docs, and b) easier
to link to as they will have a unique id.

Closes #14722
Closes #15448
2016-12-01 16:11:25 +01:00
Georgios Kalpakas 9c2d0b8af3 test($compile): work around Chrome issue with reported size for <foreignObject>
Since Chrome 53-57+, the reported size of `<foreignObject>` elements and their
descendants is affected by global display settings (e.g. font size) and browser
settings (e.g. default zoom level). This could cause tests incorrectly failing
due to such settings.

In order to avoid false negatives, we now compare against the size of the
equivalent, hand-written SVG instead of fixed widths/heights.

Fixes #15333

Closes #15458
2016-12-01 14:28:39 +02:00
Rob Wu 465d173455 feat(security): do not bootstrap from unknown schemes with a different origin 2016-12-01 11:29:22 +00:00
Martin Staffa f1db7d735b docs(ngModelOptions): fix broken layout because of code section 2016-11-29 23:51:13 +01:00
Peter Bacon Darwin b77defde81 docs(contribute): mention nvm-windows 2016-11-29 13:25:59 +00:00
Peter Bacon Darwin afafb7a8ab docs(FAQ) add link to security guide 2016-11-29 13:25:58 +00:00
Peter Bacon Darwin f04fcdfe9f chore(grunt): check node, yarn and grunt-cli versions
If global versions of node, yarn or grunt-cli don't match what we expect then blow up.
2016-11-29 13:25:58 +00:00
Peter Bacon Darwin 5dd3a35f47 chore(grunt): run gulp directly rather than through npm 2016-11-29 13:25:58 +00:00
Peter Bacon Darwin ca139dee8e chore(utils): install npm-run to simplify scripts 2016-11-29 13:25:58 +00:00
Peter Bacon Darwin 099083352a chore(travis): install grunt-cli globally to simplify scripts 2016-11-29 13:25:57 +00:00
Peter Bacon Darwin f54e9242fc chore(jenkins): remove path to grunt
grunt is installed globally on jenkins so we can just use it directly.
2016-11-29 13:25:57 +00:00
Peter Bacon Darwin d003ec1d41 docs(ComponentRouter): it is unlikely ever to appear on bower or CDN 2016-11-29 13:25:57 +00:00
Peter Bacon Darwin aadee894da chore(validate-commit): remove redundant scripts 2016-11-29 13:25:57 +00:00
Peter Bacon Darwin ad4e86a582 chore(saucelabs): update sauce-connect to 4.4.1 2016-11-29 13:25:57 +00:00
Peter Bacon Darwin e8f9cbfdce chore(bower): set clone depth to speed up releases
We already use `git clone ... --depth=1` for the `code.angularjs.org`
repository, which speeds up the cloning of the repository.
2016-11-29 13:25:57 +00:00
Peter Bacon Darwin d4863a82fa chore(npm-bundle-deps): remove unused script
This became reduntant as of 507ee2d9ba
2016-11-29 13:25:57 +00:00
Peter Bacon Darwin 736b6c7fed style(*): fix no-useless-escape eslint errors 2016-11-29 13:25:56 +00:00
Peter Bacon Darwin 1dedcdf2bc docs(*): switch from npm to yarn 2016-11-29 13:25:56 +00:00
Peter Bacon Darwin 05c3336f92 chore(dependencies): USE YARN (and node 6) 2016-11-29 13:24:50 +00:00
Martin Staffa d1e4f5728c chore(docs-app): improve deprecation box layout
Deprecated boxes for APIs appear right under the header and were missing
a bit of margin. Boxes for methods still look good even with the
additional margin.
2016-11-28 19:01:43 +01:00
Wesley Cho 9f61e74be3 docs($rootScope): add note about watching File objects
- Add note recommending against watching `File` objects with deep watchers

Closes #15440
2016-11-28 18:50:36 +01:00
Wesley Cho 4059600d20 docs(*): add deprecation notice for angular.lowercase/uppercase
Closes #15441
Closes #14316
2016-11-28 18:50:36 +01:00
Georgios Kalpakas c625b0d568 chore(docs): use correct script-URL for plnkr on snapshot
Fixes #15437

Closes #15438
2016-11-28 12:14:55 +02:00
Wesley Cho 04cbe1e74f refactor($q): replace occurrences of .when() with .resolve()
Related to #13709.

Closes #15442
2016-11-28 12:02:10 +02:00
Georgios Kalpakas 9399d68d98 docs(*): document the breaking change introduced in e1da4be (#15434)
Closes #15434
2016-11-25 11:38:50 +00:00
Peter Bacon Darwin 4a320ab9f0 docs(CHANGELOG): add missing feature to 1.6.0-rc.0 2016-11-25 09:59:14 +00:00
Georgios Kalpakas 44f9ae6126 docs(input[number]): fix typo 2016-11-25 10:44:39 +02:00
Peter Bacon Darwin cdb9e08f4e docs(CHANGELOG): add missing "closes" link 2016-11-24 21:34:31 +00:00
Peter Bacon Darwin dcfcf81893 docs(CHANGELOG): add release notes for 1.6.0-rc.2 2016-11-24 21:30:56 +00:00
Peter Bacon Darwin d7cc863105 docs(CHANGELOG): add release notes for 1.5.9 2016-11-24 20:16:03 +00:00
Martin Probst 6e91f9c25d style: fix CI failure (#15429) 2016-11-23 23:04:05 -08:00
Martin Probst 7f1b8bdfe1 feat(security): explicitly whitelist URL schemes for bootstrap. (#15427)
Many browsers have some extension URL scheme. It is unclear how many of
those have the security issue of allowing parser-inserted loads of
extension URLs.

To be conservative, this code whitelists the URL schemes that are known
to be subject to CSP, i.e. the ones that are expected and safe.
2016-11-23 15:44:43 -08:00
Michał Gołębiowski cc92da0d67 chore(*): cleanup msie handling; add support comments
1. The conditions checking the msie variable value have been simplified.
There is e.g. no point to check if `msie <= 11` since there IE 12 won't ever
exist.
2. Edge UA-sniffing has been added to tests (only!) where appropriate
3. Support comments for IE/Edge have been added.

Closes #15407
2016-11-23 14:42:04 +00:00
Packt c9bb5b9fa4 docs(external-resources): add new book link and alphabetize
Closes #15421
2016-11-23 14:39:06 +00:00
Michał Gołębiowski c54921008d chore(ngAnimate): cleanup vendor prefixes handling in tests
1. Change all transition/transform/animation-related ss.addRule to
   ss.addPossiblyPrefixedRule to account for the -webkit- prefix.
2. Remove manually added -webkit-prefixed rules in favor of automatically
   handling them in ss.addPossiblyPrefixedRule.

Closes #15406
2016-11-23 14:28:12 +01:00
Martin Staffa 69f59f2d01 docs($compile, guide/compiler): add "double compilation" known issue
Related #15278
Closes #15392
2016-11-23 13:52:48 +01:00
Martin Staffa f4fb6e0983 perf(*): don't trigger digests after enter/leave of structural directives
ngIf, ngInclude, ngSwitch, and ngView now use the `done` callback functions on animation runners returned
by leave/enter animations to do internal cleanup (and $anchorScroll for ngInclude and ngView).
Previously, they were using promise callbacks (`then`), which caused an unnessecary digest.

Background:

In https://github.com/angular/angular.js/commit/bf0f5502b1bbfddc5cdd2f138efd9188b8c652a9, animation
promises where introduced instead of animation callbacks. These promises were however not tied to
the digest cycle, so you had to manually call `$apply` inside them.

This was changed in https://github.com/angular/angular.js/commit/c8700f04fb6fb5dc21ac24de8665c0476d6db5ef,
so animation promise callbacks would always trigger a `$digest`. This meant that several built-in
directives would now trigger additional digests on leave (ngIf, ngSwitch) or enter/leave (ngInclude,
ngView). The `done` callback, which receives a single argument indicating success / failure was
introduced to allow digest-less responses, but wasn't applied to these directives.

Note that this applies to all calls to $animate.enter/leave, even if ngAnimate isn't included, and
no actual animations are running, because the animation runner code is in the core ng module.

Fixes #15322
Closes #15345
2016-11-23 13:30:41 +01:00
Martin Staffa a18be15137 style(ngIfSpec.js, ngIncludeSpec.js): add top level describe 2016-11-23 13:30:41 +01:00
Martin Staffa 05a9d3a73c docs(*): add more info deprecation versions 2016-11-23 00:10:54 +01:00
Georgios Kalpakas 60035f597c docs(guide/directive): minor wording and styling fixes 2016-11-22 14:49:26 +02:00
Georgios Kalpakas 0af21a48e5 docs(CHANGELOG.md): minor fixes/tweaks 2016-11-22 09:48:08 +02:00
Santi Albo 991a2b30e0 fix($sce): fix adjustMatcher to replace multiple '*' and '**'
`adjustMatcher` was only replacing the first occurrences of '*' and '**'
that were found in whitelisted and blacklisted url strings.

Closes ##7897
2016-11-21 14:51:48 +00:00
Peter Bacon Darwin fc4afd0c1b docs(CHANGELOG): add 1.6.0-rc.1 changes
Closes #15364
2016-11-21 13:27:47 +00:00
Peter Bacon Darwin d5109e26e4 docs(CHANGELOG): minor typos and fixes 2016-11-21 13:27:47 +00:00
Georgios Kalpakas cf3c736b61 docs(guide/migrate): fix typo in code (&amp; --> &) 2016-11-21 14:21:55 +02:00
Georgios Kalpakas b343e7a560 docs(error/ng:areq): fix typo 2016-11-21 12:55:11 +02:00
Karthikeyan 5ff5815f51 docs(error/ng:areq): mention common error cause
Closes #15414
2016-11-21 12:51:00 +02:00
Georgios Kalpakas a144c1c022 docs(guide/migration): add "Migrate 1.5 to 1.6" section
Closes #15399
2016-11-18 22:04:12 +00:00
Peter Bacon Darwin d79f9b3693 docs(*): fix up deprecation notices 2016-11-18 13:51:56 +00:00
Peter Bacon Darwin f56926a77d chore(docs): deprecation notices for methods and properties
Closes #15351
Closes #15394
2016-11-18 13:51:56 +00:00
Peter Bacon Darwin 17e98ace48 chore(docs): bring in all templates from dgeni-packages 2016-11-18 11:28:14 +00:00
Peter Bacon Darwin 752c989152 chore(package.json): update to latest dgeni-packages 2016-11-18 11:28:14 +00:00
Peter Bacon Darwin 789790feee fix(ngModelOptions): handle update triggers that are not in debounce list
Closes #15401
2016-11-17 23:38:24 +00:00
Peter Bacon Darwin fd1a93a4b0 refactor(ngModelOptions): internal variables do not start with a $ 2016-11-17 23:38:24 +00:00
Michal Bultrowicz 7d24af110a docs(CONTRIBUTING.md): expand test commit type, add info about closing issues
Expanded "test" to also mean test fixes.
Added a link to the help page about closing issues with commit
messages in the section about the footer.

Closes #15340
2016-11-17 22:17:42 +01:00
Arturo Romero ac7a2daf2e docs(guide/Forms): add labels to input elements
Closes #15403
2016-11-17 19:23:52 +01:00
Peter Bacon Darwin 296cfce40c feat(ngModelOptions): allow options to be inherited from ancestor ngModelOptions
Previously, you had to apply a complete set of `ngModelOptions` at many places in
the DOM where you might want to modify just one or two settings.

This change allows more general settings to be applied nearer to the root of the DOM
and then for more specific settings to inherit those general settings further down
in the DOM.

To prevent unwanted inheritance you must opt-in on a case by case basis:
* To inherit as single property you simply provide the special value `"$inherit"`.
* To inherit all properties not specified locally then include a property `"*": "$inherit"`.

Closes #10922
Closes #15389

BREAKING CHANGE:

The programmatic API for `ngModelOptions` has changed. You must now read options
via the `ngModelController.$options.getOption(name)` method, rather than accessing the
option directly as a property of the `ngModelContoller.$options` object. This does not
affect the usage in templates and only affects custom directives that might have been
reading options for their own purposes.

One benefit of these changes, though, is that the `ngModelControler.$options` property
is now guaranteed to be defined so there is no need to check before accessing.

So, previously:

```
var myOption = ngModelController.$options && ngModelController.$options['my-option'];
```

and now:

```
var myOption = ngModelController.$options.getOption('my-option');
```
2016-11-16 13:46:13 +00:00
Peter Bacon Darwin fb0225a36a revert: feat(ngModelOptions): allow options to be inherited from ancestor ngModelOptions
This reverts commit 87a2ff76af
2016-11-16 13:40:46 +00:00
Georgios Kalpakas 7dd42d31a7 docs(ngModel): fix typo and rephrase for simplicity 2016-11-16 12:35:54 +02:00
Georgios Kalpakas 7d9a791c6a fix(ngMock/$controller): respect $compileProvider.preAssignBindingsEnabled()
Fixes #15387

Closes #15395
2016-11-16 11:41:42 +02:00
Martin Staffa 17ddba873b docs($httpProvider): fix broken layout caused by unclosed `
Closes #15393
2016-11-15 18:52:33 +01:00
Peter Bacon Darwin ce49edc08b chore(docs): improve version picker
Closes #15385
2016-11-15 10:40:20 +00:00
Peter Bacon Darwin 0f45adebea chore(package.json): update to latest version of shelljs 2016-11-15 09:59:18 +00:00
Julio Borja Barra 5419201a3c docs(ngModel): fix example
For the example to work correctly, the initial model values have to be empty strings.

Closes #15272
2016-11-14 12:30:11 +02:00
kentwalters fcf182eb13 docs(guide/controller): change "hides" to "shadows"
"Shadows" should better convey the meaning of "overwriting the value of the property in the child
scope, while leaving the parent scope intact".
"Hides" could give the impression that it makes the property unavailable in the child scope and
leaving "overrides" only, could give the impression that the parent scope would be affected too,
especially to people not familiar with JavaScript's prototypal inheritance.

Closes #15375
2016-11-14 12:05:02 +02:00
Peter Bacon Darwin f582f9e57b chore(promises-tests): make timeout longer (correctly) 2016-11-11 12:34:25 +00:00
Peter Bacon Darwin c3a8b5d9f1 chore(promises-tests): make timeout longer 2016-11-10 22:59:37 +00:00
Thomas Grainger 6f072c8a41 docs(angular.isArray): Document that isArray is an alias
Closes #15383
2016-11-10 22:09:56 +00:00
Peter Bacon Darwin 4aa9534b0f fix($location): throw if the path starts with double (back)slashes
Previously `$location` was rewriting such paths to remove not only the
double slashes but also the first segment of the path, leading to an invalid
path.

In this change, we deem leading double (back)slashes an invalid path and
now throw a `$location:badpath` error if that occurs.

Closes #15365
2016-11-09 10:28:40 +00:00
Peter Bacon Darwin 627459b96d test(): remove redundant hashPrefix params 2016-11-09 10:28:40 +00:00
Tim Black 148cd26030 docs(ngRepeat): correct typo
Closes #15378
2016-11-08 23:17:14 +02:00
Martin Staffa 5ac7daea72 fix(input[radio]): use strict comparison when evaluating checked-ness
Closes #15283
Closes #15288

BREAKING CHANGE:

When using input[radio], the checked status is now determined by doing
a strict comparison between the value of the input and the ngModel.$viewValue.
Previously, this was a non-strict comparison (==).

This means in the following examples the radio is no longer checked:

```
  <!-- this.selected = 0 -->
  <input type="radio" ng-model="$ctrl.selected" value="0" >

  <!-- this.selected = 0; this.value = false; -->
  <input type="radio" ng-model="$ctrl.selected" ng-value="$ctrl.value" >
```

The migration strategy is to convert values that matched with non-strict
conversion so that they will match with strict conversion.
2016-11-08 16:42:39 +01:00
Kyle Wuolle b5a5623fc7 docs(filterFilter): mark the comparator parameter as optional
Mark the `comparator` parameter as optional and mention that it defaults to `false`.

Fixes #15312

Closes #15371
2016-11-07 14:55:09 +02:00
Georgios Kalpakas 3e87f54922 docs(ngRepeat): add warning about track by $index with one-time bindings 2016-11-07 12:50:27 +02:00
NoHomey 810a3e429a docs(CHANGELOG.md): add language ids to code blocks for syntax highlighting
Add missing language identifiers to code blocks used as examples, in order to
have proper syntax highlighting.

Fixes #15356

Closes #15357
2016-11-05 18:09:46 +02:00
sathify fc3e48980b chore(docs): apply consistent css property spacing 2016-11-05 14:29:12 +01:00
sathify a48f64162d chore(docs): use $document[0] 2016-11-05 14:29:12 +01:00
Martin Staffa b28f1fc3fb chore(docs-gen): create plnkr examples with the correct version
- docs for the snapshot will include the snapshot files from code.angularjs.org
- docs for tagged versions will include the files from the (Google) CDN
- docs for local / untagged versions will try to include the files from the (Google) CDN, which will fail. This gives immediate feedback that something is broken.

Closes #15267
Closes #15358
2016-11-05 13:18:48 +01:00
Peter Bacon Darwin 53cb1d7d40 chore(protractor): upgrade to latest 4.0.10
This fixes problems with testing against Chrome 54.
2016-11-05 11:33:14 +00:00
Martin Staffa d80cdeb3af docs($routeProvider): document that one of template or templateUrl is required
Closes #8604
2016-11-04 17:50:13 +01:00
Corey Cacic 6d3329479f docs($cookiesProvider): add example for overwriting defaults on provider
Add an example on how to set default values on `$cookiesProvider`. Many similar services support
overriding the `defaults` object with a new one, but this service only supports changing individual
properties.

Closes #15362
2016-11-04 15:12:12 +02:00
Tom Harvey d71788455d docs($resourceProvider): correct JS syntax error in code example
Closes #15360
2016-11-03 15:42:32 +01:00
Michał Gołębiowski bcd0d4d896 feat($compile): set preAssignBindingsEnabled to false by default
Fixes #15350
Closes #15352

BREAKING CHANGE: Previously, $compileProvider.preAssignBindingsEnabled was
set to true by default. This means bindings were pre-assigned in component
constructors. In Angular 1.5+ the place to put the initialization logic
relying on bindings being present is the controller $onInit method.

To migrate follow the example below:

Before:

```js
angular.module('myApp', [])
  .component('myComponent', {
    bindings: {value: '<'},
    controller: function() {
      this.doubleValue = this.value * 2;
    }
  });
```

After:
```js
angular.module('myApp', [])
  .component('myComponent', {
    bindings: {value: '<'},
    controller: function() {
      this.$onInit = function() {
        this.doubleValue = this.value * 2;
      };
    }
  });
```

If you don't have time to migrate the code at the moment, you can flip the
setting back to true:
```js
angular.module('myApp', [])
  .config(function($compileProvider) {
    $compileProvider.preAssignBindingsEnabled(false);
  })
  .component('myComponent', {
    bindings: {value: '<'},
    controller: function() {
      this.doubleValue = this.value * 2;
    }
  });
```
Don't do this if you're writing a library, though, as you shouldn't change
global configuration then.
2016-11-03 15:23:12 +01:00
Martin Probst 0ff10e1b56 fix(security): do not auto-bootstrap when loaded from an extension.
Extension URIs (`resource://...`) bypass Content-Security-Policy in Chrome and
Firefox and can always be loaded. Now if a site already has a XSS bug, and uses
CSP to protect itself, but the user has an extension installed that uses
Angular, an attacked can load Angular from the extension, and Angular's
auto-bootstrapping can be used to bypass the victim site's CSP protection.

Notes:
- `isAutoBootstrapAllowed` must be initialized on load, so that `currentScript`
  is set correctly.
- The tests are a bit indirect as reproducing the actual scenario is too
  complicated to reproduce (requires signing an extension etc). I have confirmed
  this to be working manually.

Closes #15346
2016-11-02 13:33:12 +00:00
Michał Gołębiowski a7076dc0bb chore(*): switch URLs from npmcdn.com to unpkg.com
The domain changed, the old one redirects to the new one.
2016-11-02 14:32:02 +01:00
Martin Staffa 433c8714f3 fix(docsApp): show correct version number in api index
Previously, the index would show the version of Angular that runs on
the page, not the version for which the docs are. This meant that in
that snapshot docs the stable version was displayed.

The `$scope.docsVersion` value was used in the plnkr opening code, but
has not been used since https://github.com/angular/angular.js/commit/bdec35cebc89e0d80a04eeffbd71ad999fc7e61a.

Closes #15265
2016-11-02 13:22:39 +01:00
Martin Staffa 01d8638114 chore: delete the gdocs.js file
This file was probably used for an early version of the docs, but hasn't been updated since 2011.

Closes #15325
2016-11-02 13:21:31 +01:00
Michał Gołębiowski 856e300046 chore(*): make some files non-executable
The repository contained JS/HTML/PNG files that had the executable bit enabled
for no real reason.

Closes #15339
2016-11-02 11:11:49 +01:00
Kyle Lieber 3b7f29ff63 perf(ngOptions): avoid calls to element.value
In some cases IE11/Edge calls to `element.value` are very slow when the
`element.value` has not been set. Normally, these calls are usualy 0-3 ms
but in these cases it can take 200-300 ms. This can easily add 3 or more
seconds to the load time on a view that has 10 or more select tags using
`ngOptions`.

The line this pull request is changing not only suffers from the performance
issue described above but it also appears to be broken. The code is checking
that `option.value` does not equal `element.value` but then sets `element.value`
to `option.selectValue`.

I don't believe `option.value` is actually defined anywhere and likely it
was always intended to be `option.selectValue`. This means that check would
always be true and since this code has been this way for quite a while and
is causing a performance issue I've just removed the check. This way a call
to `element.value` is never made prior to it's value being set.

Closes #15344
2016-11-01 10:40:58 +00:00
Josh Soref bdf960294a docs(CONTRIBUTING.md): add note about scope wildcard 2016-11-01 10:32:03 +00:00
Jason Bedard 79d2b9a5a6 refactor($parse): remove unused expression arguments
These are no longer required after the removal of the expression sandbox errors

Closes #15276
2016-10-31 10:31:23 +01:00
Martin Staffa e77f717ebf docs(guide/Conceptual Overview): fix external api example
In 1.6, urls accessed with jsonp must be whitelisted via sce. 
However, the yahoo finance api used in the example allows CORS
access via Access-Control-Allow-Origin:"*", so we can simply use
`$http.get` instead.

Closes #15336
2016-10-31 10:29:28 +01:00
Erick Delfin 872bdbd343 docs(README.md): mention "Pug" (Jade's new name)
Closes #15338
2016-10-30 21:28:46 +02:00
Jason Bedard f1e677895e refactor($compile): remove unnecessary assignment
Closes #15337
2016-10-30 13:13:54 +02:00
Martin Staffa 7ed0340488 style(ng/animate.js): remove a newline
Closes #15309
2016-10-29 18:52:03 +02:00
Josh Soref 5cce6e233e docs(*): fix typos
* a
* allows
* angularytics
* animate
* architecting
* asynchronously
* attribute
* back
* browser
* callback
* component
* delimited
* dependencies
* dynamically
* empty
* encoded
* explicitly
* expression
* fails
* guarantees
* hierarchy
* highlight
* identifiers
* immediately
* infinite
* initialized
* inputting
* instance
* interprets
* linking
* location
* misformed
* numerically
* occurring
* overridden
* overwritten
* parameters
* Pluralsight
* precedence
* primitive
* properly
* prototypically
* representation
* response
* separately
* separator
* should
* specifying
* supported
* template
* thrown
* transclude
* transclusion
* transitions
* trigger
* useful
2016-10-29 17:40:21 +02:00
Josh Soref 305e201b71 test(*): fix some inconsequential typos
* select
* synopsis
* params
* template
2016-10-29 17:40:21 +02:00
Erik Smith 47ba51eaf6 docs(guide/production): fix typo ("3rd part" --> "3rd party")
Closes #15328
2016-10-29 12:51:25 +03:00
Peter Bacon Darwin 1cf01d6fa7 chore(version-info): fix getTaggedVersion
The version being used was a "raw" version which included the "v" prefix.
2016-10-27 20:28:09 +01:00
Peter Bacon Darwin 74c19f096f chore(version-info): fix getTaggedVersion
The version being used was a `Semver` object instead of a string.
2016-10-27 17:48:28 +01:00
Peter Bacon Darwin 9e4d42cafb chore(version-info): use branchPattern to check tag
We have two fields in package.json for checking the current version:

* branchVersion
* branchPattern

The `branchVersion` field is used to work out what version to use in the
docs application, so we should not update this to the most recent version
until that version is on the Google CDN. Otherwise the docs app will break.

The `branchPattern` is used to determine what branch we are currently
working from and is generally used as a gate-keeper to prevent invalid
releases from the wrong branch.

The `getTaggedVersion()` method was using the `branchVersion` to check
that the tagged commit was valid but this fails when we are moving to a
new minor version with release candidates.

This fix avoids the problem by doing a custom comparison against the
`branchPattern` instead.
2016-10-27 09:19:55 +01:00
Peter Bacon Darwin ad3a1f9dea chore(package.json): bump for new minor version 2016-10-26 21:13:29 +01:00
Peter Bacon Darwin 3c88c62446 docs(CHANGELOG): add 1.6.0-rc.0 release notes 2016-10-26 17:50:04 +01:00
Peter Bacon Darwin 491d23ed57 chore(deps): add changez 2016-10-26 17:50:04 +01:00
Allan Watson 6a33749686 docs(orderBy): clarify behavior of default comparator wrt null
Document how `orderBy`'s default comparator handles `null` values.

Fixes #15293

Closes #15304
2016-10-26 00:04:14 +03:00
emed 21ac2c42ea docs(error/ueoe): add another possible cause
Mention unescaped quotes as another possible cause for this error.

Closes #15313
2016-10-25 23:34:34 +03:00
Peter Bacon Darwin eeb9ef09f9 chore(gruntfile): check the node version before starting
We specify the node version that is required to run the build in the `.nvmrc`
file. So let's check that the current node version satisfies this and report
a helpful message if it is not.
2016-10-21 12:37:15 +01:00
Georgios Kalpakas a6118dfda4 chore(ng-closure-runner): upgrade to version 0.2.4
Version 0.2.4's `minErr` implementation is up to date with the one in core.

Fixes #14971

Closes #15307
2016-10-21 13:26:42 +03:00
Jonathan Yates 586e2acb26 fix($compile): clean up @-binding observers when re-assigning bindings
Fixes #15268

Closes #15298
2016-10-20 19:26:01 +03:00
Jason Bedard 41034bb41b test($compile): ensure equal but different instance changes are detected in onChanges
Closes #15300
2016-10-20 19:08:43 +03:00
Jason Bedard 828f8a63b5 docs($controller): deprecate the use of $controllerProvider#allowGlobals
Closes #15230
2016-10-20 09:48:04 +03:00
laranhee f5f802c6e6 docs($rootScope): add missing round bracket
Closes #15299
2016-10-20 09:45:14 +03:00
Michał Gołębiowski 35482babd9 refactor($sniffer): remove $sniffer.vendorPrefix
Previously, Angular tried to detect the CSS prefix the browser supports and
then use the saved one. This strategy is not ideal as currently some browsers
are supporting more than one vendor prefix. The best example is Microsoft Edge
that added -webkit- prefixes to be more Web-compatible; Firefox is doing
a similar thing on mobile. Some of the -webkit--prefixed things are now even
getting into specs to sanction that they're now required for Web compatibility.

In some cases Edge even supports only the -webkit--prefixed property; one
example is -webkit-appearance.

$sniffer.vendorPrefix is no longer used in Angular core outside of $sniffer
itself; taking that and the above problems into account, it's better to just
remove it. The only remaining use case was an internal use in detection of
support for transitions/animations but we can directly check the webkit prefix
there manually; no other prefix matters for them anyway.

$sniffer is undocumented API so this removal is not a breaking change. However,
if you've previously been using it in your code, just paste the following
to get the same function:

    var vendorPrefix = (function() {
      var prefix, prop, match;
      var vendorRegex = /^(Moz|webkit|ms)(?=[A-Z])/;
      for (prop in document.createElement('div').style) {
        if ((match = vendorRegex.exec(prop))) {
          prefix = match[0];
          break;
        }
      }
      return prefix;
    })();

The vendorPrefix variable will contain what $sniffer.vendorPrefix used to.

Note that we advise to not check for vendor prefixes this way; if you have to
do it, it's better to check it separately for each CSS property used for the
reasons described at the beginning. If you use jQuery, you don't have to do
anything; it automatically adds vendor prefixes to CSS prefixes for you in
the .css() method.

Fixes #13690
Closes #15287
2016-10-19 23:10:52 +02:00
Georgios Kalpakas 7dacbcc991 test(input): fix typo (step="{{step}}"" --> step="{{step}}") 2016-10-19 15:27:54 +03:00
Georgios Kalpakas 081d06ffd1 fix(input): fix step validation for input[number]/input[range]
Related to 9a8b8aa and #15257. Fixes the issue discussed in
https://github.com/angular/angular.js/commit/9a8b8aa#commitcomment-19108436.

Fixes #15257

Closes #15264
2016-10-19 14:52:51 +03:00
Georgios Kalpakas d6c91ea175 refactor(input): avoid duplicating step/ngStep tests 2016-10-19 14:52:28 +03:00
Martin Staffa 00b60f2f03 docs(a): remove outdated practice
Using a tags as buttons is bad for accessibility and usability
2016-10-19 12:12:56 +02:00
Martin Staffa 18263f1c52 chore(docs-app): improve layout when loading partials
By setting the current partial content to hidden, the current height
of the window is maintained until the new content is loaded.
This prevents flickering caused by the scrollbar (dis)appearing and
the footer coming into view.
2016-10-19 11:55:53 +02:00
Martin Staffa daa47e33e3 Revert "chore(doc-gen, docs-app): create plnkr examples with correct Angular version"
This patch relies on a change in the dgeni example package, which has not been added to dgeni yet.

This reverts commit db02008fe2.
2016-10-17 23:16:41 +02:00
Martin Staffa 19973609f4 chore(docs-app): show loader when loading view / partial
Closes #14385
PR (#15280)
2016-10-17 19:32:15 +02:00
Martin Staffa db02008fe2 chore(doc-gen, docs-app): create plnkr examples with correct Angular version
When the docs are based on the snapshot, the plnkr examples must use the snapshot files
from code.angularjs.org

Closes #15267
PR (#15269)
2016-10-17 19:31:39 +02:00
Martin Staffa 705afcd160 fix($location): prevent infinite digest with IDN urls in Edge
Internationalized Domain Urls, for example urls with Umlaut (Ä, Ö, Ü)
cause infinite digest in Edge 38.14393.0.0 because lastIndexOf doesn't
work correctly in this version when the search string is the same as the haystack string.

The patch uses an implementation based on core.js: https://github.com/zloirock/core-js/blob/v2.4.1/modules/es6.string.starts-with.js#L16

Edge Bug: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9271625/

Fixes #15217
PR #15235
2016-10-17 12:21:29 +02:00
Georgios Kalpakas aa6a80618d chore(tutorial): make diagram images responsive
Fixes angular/angular-phonecat#376

Closes #15275
2016-10-17 12:38:40 +03:00
Venkat Ganesan b8c8262808 docs(input[checkbox]): mention ngChecked
Closes #14465
Closes #15277
2016-10-17 10:29:24 +03:00
Georgii Dolzhykov 406c1b094b docs($rootScope.Scope): grammar
Closes #15263
2016-10-15 01:15:12 +03:00
Martin Staffa c22615cbfb refactor(compileSpec): make tests consistent
PR (#15141)
2016-10-14 11:39:21 +02:00
Michał Gołębiowski fc0c11db84 fix(jqLite): camelCase keys in jqLite#data
This change aligns jqLite with jQuery 3.
The relevant bit of jQuery code is
https://github.com/jquery/jquery/blob/3.1.1/src/data/Data.js

Close #15126

BREAKING CHANGE: Previously, keys passed to the data method were left untouched.
Now they are internally camelCased similarly to how jQuery handles it, i.e.
only single (!) hyphens followed by a lowercase letter get converted to an
uppercase letter. This means keys `a-b` and `aB` represent the same data piece;
writing to one of them will also be reflected if you ask for the other one.

If you use Angular with jQuery, it already behaved in this way so no changes
are required on your part.

To migrate the code follow the examples below:

BEFORE:

/* 1 */
elem.data('my-key', 2);
elem.data('myKey', 3);

/* 2 */
elem.data('foo-bar', 42);
elem.data()['foo-bar']; // 42
elem.data()['fooBar']; // undefined

/* 3 */
elem.data()['foo-bar'] = 1;
elem.data()['fooBar'] = 2;
elem.data()['foo-bar']; // 1

AFTER:

/* 1 */
// Rename one of the keys as they would now map to the same data slot.
elem.data('my-key', 2);
elem.data('my-key2', 3);

/* 2 */
elem.data('foo-bar', 42);
elem.data()['foo-bar']; // undefined
elem.data()['fooBar']; // 42

/* 3 */
elem.data()['foo-bar'] = 1;
elem.data()['fooBar'] = 2;
elem.data()['foo-bar']; // 2
2016-10-13 07:47:16 +01:00
Michał Gołębiowski 73050cdda0 fix(jqLite): align jqLite camelCasing logic with JQuery
jqLite needs camelCase for it's css method; it should only convert one dash
followed by a lowercase letter to an uppercase one; it shouldn't touch
underscores, colons or collapse multiple dashes into one. This is behavior
of jQuery 3 as well.

Also, jqLite's css camelCasing logic was put in a separate function and
refactored: now the properties starting from an uppercase letter are used by
default (i.e. Webkit, not webkit) and the only exception is for the -ms- prefix
that is converted to ms, not Ms. This makes the logic clearer as we're just
always changing a dash followed by a lowercase letter by an uppercase one; this
is also how it works in jQuery.

The camelCasing for the $compile and $sce services retains the previous behaviour.

Ref #15126
Fix #7744

BREAKING CHANGE: before, when Angular was used without jQuery, the key passed
to the css method was more heavily camelCased; now only a single (!) hyphen
followed by a lowercase letter is getting transformed. This also affects APIs
that rely on the css method, like ngStyle.

If you use Angular with jQuery, it already behaved in this way so no changes
are needed on your part.

To migrate the code follow the example below:

Before:

HTML:

// All five versions used to be equivalent.
<div ng-style={background_color: 'blue'}></div>
<div ng-style={'background:color': 'blue'}></div>
<div ng-style={'background-color': 'blue'}></div>
<div ng-style={'background--color': 'blue'}></div>
<div ng-style={backgroundColor: 'blue'}></div>

JS:

// All five versions used to be equivalent.
elem.css('background_color', 'blue');
elem.css('background:color', 'blue');
elem.css('background-color', 'blue');
elem.css('background--color', 'blue');
elem.css('backgroundColor', 'blue');

// All five versions used to be equivalent.
var bgColor = elem.css('background_color');
var bgColor = elem.css('background:color');
var bgColor = elem.css('background-color');
var bgColor = elem.css('background--color');
var bgColor = elem.css('backgroundColor');

After:

HTML:

// Previous five versions are no longer equivalent but these two still are.
<div ng-style={'background-color': 'blue'}></div>
<div ng-style={backgroundColor: 'blue'}></div>

JS:

// Previous five versions are no longer equivalent but these two still are.
elem.css('background-color', 'blue');
elem.css('backgroundColor', 'blue');

// Previous five versions are no longer equivalent but these two still are.
var bgColor = elem.css('background-color');
var bgColor = elem.css('backgroundColor');
2016-10-13 07:47:15 +01:00
Michał Gołębiowski beab3baec3 chore(jqLite): remove the ready handlers instead of setting a flag
This change aligns jqLite with the jQuery implementation.

Closes #15237
2016-10-12 19:31:55 +02:00
Michał Gołębiowski e008df6c8c docs(jqLite): remove the removal plan info for bind/unbind
We're not going to remove the aliases before jQuery does.
2016-10-12 19:31:55 +02:00
Michał Gołębiowski 8e82bf51b1 refactor(jqLite): deprecate jqLite#ready
Use jqLite(fn) instead of jqLite(document).ready(fn).
2016-10-12 19:31:55 +02:00
Michał Gołębiowski 369fb7f4f7 feat(jqLite): implement jqLite(f) as alias to jqLite(document).ready(f)
jQuery has supported this form for a long time. As of jQuery 3.0 this form is
the preferred one and all others are deprecated so jqLite(f) is now also
supported.

All internal invocations of jqLite(document).ready(f) (& equivalent) have been
replaced by jqLite(f).

Tests for these methods have been added as jqLite#ready had no explicit tests
so far.
2016-10-12 19:31:55 +02:00
mohamed amr 4f44e01894 fix($parse): treat falsy values as defined in assignment expressions
Closes #14990
Closes #14994
2016-10-12 09:17:23 +02:00
Peter Bacon Darwin 606ea5d23e fix($compile): ensure that hidden input values are correct after history.back
Due to the nature of some browser's PageCache/BFCache, returning to an Angular
app sometimes causes `input[hidden]` elements to retain the last value
that was stored before the page was navigated away from previously.

This is particularly problematic if the input has an interpolated value.
E.g. `<input type="hidden" value="{{ 1 + 2 }}">` since when the browser
returns, instead of the original interpolation template, the HTML contains
the previous value `<input type="hidden" value="3">`.

This commit instructs the browser not to attempt to reinstate the previous
value when navigating back in history by setting `autocomplete="off"` on
the hidden input element element.
2016-10-11 13:33:53 +01:00
Peter Bacon Darwin ec83b04df1 revert:fix(input): ensure that hidden input values are correct after history.back
This reverts commit 298f8c4d13.
There was a regression in angular-material that relied upon the input directive
having `link.pre` property.
2016-10-11 13:28:56 +01:00
Peter Bacon Darwin 8d394de91f docs(CHANGELOG): add 1.2.31 and 1.4.13 release info 2016-10-10 23:07:52 +01:00
Peter Bacon Darwin 298f8c4d13 fix(input): ensure that hidden input values are correct after history.back
Due to the nature of some browser's PageCache/BFCache, returning to an Angular
app sometimes causes `input[hidden]` elements to retain the last value
that was stored before the page was navigated away from previously.

This is particularly problematic if the input has an interpolated value.
E.g. `<input type="hidden" value="{{ 1 + 2 }}">` since when the browser
returns, instead of the original interpolation template, the HTML contains
the previous value `<input type="hidden" value="3">`.

This commit instructs the browser not to attempt to reinstate the previous
value when navigating back in history by setting `autocomplete="off"` on
the hidden input element element.
2016-10-10 20:09:15 +01:00
Michał Gołębiowski 138fbf0d6c refactor(jqLite): wrap the jqueryVersion binding in a span
Protractor's by.binding selector selects the whole element in which the binding
is contained as otherwise it can't know which bit of text has been interpolated.

It's safer to wrap the binding in a span so that we're sure what the e2e tests
are exactly testing.
2016-10-10 06:28:02 +01:00
Jason Bedard a02c8863f9 fix($parse): validate assignment lval in parser phase
The parser always threw an error in the case of an invalid left-value
assignment but it was an unhelpful:

```
Cannot set property 'undefined' of undefined
```

This commit provides a more meaningful error message, so it is not a
breaking change.

Closes #15234
2016-10-10 05:56:56 +01:00
BobChao87 faf0c3e4c1 refactor(ngModelSpec): use valueFn over curry
Refactor ngModelSpec to use internal helper function `valueFn`.
Use instead of multiple-defining a function called `curry`.

PR (#15231)

Addresses a quick change mentioned in PR 15208 from Issue #14734
2016-10-09 20:07:08 +02:00
Frank Stepanski 39a3b58ed2 docs(README.md): expand the "Interconnection with HTML" section
Closes #15150
2016-10-08 21:41:34 +03:00
Martin Staffa f41bd7691d docs(changelog): add missing commit and remove empty lines 2016-10-07 21:01:46 +02:00
Georgios Kalpakas b3a3ed34b9 docs($http): display the actual default Accept header 2016-10-07 18:27:01 +03:00
Jason Bedard 34434cf528 refactor($q): separate Promise from Deferred
Closes #15064

BREAKING CHANGE:

Previously, the `Deferred` object returned by `$q.defer()` delegated the
`resolve()`, `reject()` and `notify()` methods to `Deferred.prototype`. Thus, it
was possible to modify `Deferred.prototype` and have the changes reflect to all
`Deferred` objects.

This commit removes that delegation, so modifying the above three methods on
`Deferred.prototype` will no longer have an effect on `Deferred` objects.
2016-10-07 12:02:25 +03:00
Vincent Gillot cdf3d5e054 docs(guide/component-router): fix typo ($routeOnReuse --> $routerOnReuse)
Closes #15224
2016-10-07 11:44:09 +03:00
Michał Gołębiowski 4e6c14dcae feat(jqLite): don't throw for elements with missing getAttribute
jQuery falls back to prop here but this feature is not very well tested
& documented so let's just skip it here.

Closes #15181
2016-10-06 12:15:39 +02:00
Michał Gołębiowski d5b7803064 refactor(jqLite): deprecate bind/unbind
The on/off aliases have been available since Angular 1.2. bind/unbind have
been deprecated in jQuery 3.0 so we're following suit in jqLite.
2016-10-06 12:15:39 +02:00
Michał Gołębiowski bb3cfd3d8f tests(jqLite): add basic tests for the bind/unbind aliases 2016-10-06 12:15:39 +02:00
Michał Gołębiowski 304c765359 perf(jqLite): move bind/unbind definitions out of the loop
The bind/unbind aliases to on/off were being assinged in every iteration
of the function assigning traversal methods to the prototype. Now it happens
only once.
2016-10-06 12:15:39 +02:00
Michał Gołębiowski 095cacb79b chore(jqLite): fix a typo in a test name 2016-10-06 12:15:39 +02:00
Michał Gołębiowski c8ba433f18 refactor(jqLite): refactor the attr method
The attr method was refactored to be divided into setter & getter parts
and to handle boolean attributes in each one of them separately instead of
dividing into boolean & non-boolean ones and then handling setter & getter
in both of them. This is because handling boolean & non-boolean attributes
has common parts; in particular handling of the `null` value or using
getAttribute to get the value in the getter.
2016-10-06 12:15:39 +02:00
Michał Gołębiowski 3faf450573 feat(jqLite): don't remove a boolean attribute for .attr(attrName, '')
This change aligns jqLite with jQuery.

Ref #15126

BREAKING CHANGE: Before, using the `attr` method with an empty string as a value
would remove the boolean attribute. Now it sets it to its lowercase name as
was happening for every non-empty string so far. The only two values that remove
the boolean attribute are now null & false, just like in jQuery.

To migrate the code follow the example below:

Before:

elem.attr(booleanAttrName, '');

After:

elem.attr(booleanAttrName, false);

or:

elem.attr(booleanAttrName, null);
2016-10-06 12:15:39 +02:00
Michał Gołębiowski 4e36245522 feat(jqLite): remove the attribute for .attr(attribute, null)
This change aligns jqLite with jQuery.

Also, the extra `2` second parameter to `setAttribute` has been removed;
it was only needed for IE<9 and latest jQuery doesn't pass it either.

Ref #15126

BREAKING CHANGE: Invoking `elem.attr(attributeName, null)` would set the
`attributeName` atribute value to a string `"null"`, now it removes the
attribute instead.

To migrate the code follow the example below:

Before:

elem.attr(attributeName, null);

After:

elem.attr(attributeName, "null");
2016-10-06 12:15:39 +02:00
Michał Gołębiowski 7ceb5f6fcc refactor(jqLite): Don't get/set props when getting/setting bool attrs
This is done automatically by browsers in cases where it's needed; the
workaround was only needed for IE<9. The new behavior means boolean attributes
will not be reflected on elements where browsers don't reflect them.

This change aligns jqLite with jQuery 3.

Fixes #14126

BREAKING CHANGE: Previously, all boolean attributes were reflected into
properties in a setter and from a property in a getter, even on elements that
don't treat those attributes in a special way. Now Angular doesn't do it
by itself but relies on browsers to know when to reflect the property. Note that
this browser-level conversions differs between browsers; if you need to change
dynamic state of an element you should modify the property, not the attribute.

See https://jquery.com/upgrade-guide/1.9/#attr-versus-prop- for a more detailed
description about a related change in jQuery 1.9.

To migrate the code follow the example below:

Before:

CSS:
input[checked="checked"] { ... }

JS:
elem1.attr('checked', 'checked');
elem2.attr('checked', false);

After:

CSS:
input:checked { ... }

JS:
elem1.prop('checked', true);
elem2.prop('checked', false);
2016-10-06 12:15:39 +02:00
Michał Gołębiowski 1f16c79396 docs(jqLite): Document that removeAttr doesn't support multiple attributes
jQuery supports removing multiple attributes in one go, jqLite doesn't.
This is now documented.
2016-10-06 12:15:39 +02:00
Peter Bacon Darwin 1ea3d889fa chore(doc-gen): improve version dropdown info 2016-10-06 10:07:00 +01:00
BobChao87 7bc71adc63 fix(ngModel): treat synchronous validators as boolean always
Change synchronous validators to convert the return to boolean value.
Prevent unexpected behavior when returning `undefined`.

Closes #14734
Closes #15208

BREAKING CHANGE: Previously, only a literal `false` return would resolve as the
synchronous validator failing. Now, all traditionally false JavaScript values
are treated as failing the validator, as one would naturally expect.

Specifically, the values `0` (the number zero), `null`, `NaN` and `''` (the
empty string) used to considered valid (passing) and they are now considered
invalid (failing). The value `undefined` was treated similarly to a pending
asynchronous validator, causing the validation to be pending. `undefined` is
also now considered invalid.

To migrate, make sure your synchronous validators are returning either a
literal `true` or a literal `false` value. For most code, we expect this to
already be the case. Only a very small subset of projects will be affected.

Namely, anyone using `undefined` or any falsy value as a return will now see
their validation failing, whereas previously falsy values other than `undefined`
would have been seen as passing and `undefined` would have been seen as pending.
2016-10-05 20:42:02 +01:00
Georgios Kalpakas e8aebb38ff test(*): introduce the toEqualMinErr() custom Jasmine matcher
Closes #15216
2016-10-05 19:11:45 +03:00
Georgios Kalpakas fbf30b28e0 refactor(*): use the toThrowMinErr() matcher when possible 2016-10-05 19:11:12 +03:00
Georgios Kalpakas b54a39e202 feat($http): remove deprecated callback methods: success()/error()
Closes #15157

BREAKING CHANGE:

`$http`'s deprecated custom callback methods - `success()` and `error()` - have been removed.
You can use the standard `then()`/`catch()` promise methods instead, but note that the method
signatures and return values are different.

`success(fn)` can be replaced with `then(fn)`, and `error(fn)` can be replaced with either
`then(null, fn)` or `catch(fn)`.

Before:

```js
$http(...).
  success(function onSuccess(data, status, headers, config) {
    // Handle success
    ...
  }).
  error(function onError(data, status, headers, config) {
    // Handle error
    ...
  });
```

After:

```js
$http(...).
  then(function onSuccess(response) {
    // Handle success
    var data = response.data;
    var status = response.status;
    var statusText = response.statusText;
    var headers = response.headers;
    var config = response.config;
    ...
  }, function onError(response) {
    // Handle error
    var data = response.data;
    var status = response.status;
    var statusText = response.statusText;
    var headers = response.headers;
    var config = response.config;
    ...
  });

// or

$http(...).
  then(function onSuccess(response) {
    // Handle success
    var data = response.data;
    var status = response.status;
    var statusText = response.statusText;
    var headers = response.headers;
    var config = response.config;
    ...
  }).
  catch(function onError(response) {
    // Handle error
    var data = response.data;
    var status = response.status;
    var statusText = response.statusText;
    var headers = response.headers;
    var config = response.config;
    ...
  });
```

**Note:**
There is a subtle difference between the variations showed above. When using
`$http(...).success(onSuccess).error(onError)` or `$http(...).then(onSuccess, onError)`, the
`onError()` callback will only handle errors/rejections produced by the `$http()` call. If the
`onSuccess()` callback produces an error/rejection, it won't be handled by `onError()` and might go
unnoticed. In contrast, when using `$http(...).then(onSuccess).catch(onError)`, `onError()` will
handle errors/rejections produced by both `$http()` _and_ `onSuccess()`.
2016-10-05 19:02:39 +03:00
Peter Bacon Darwin fb66341871 feat($http): JSONP callback must be specified by jsonpCallbackParam config
The query parameter that will be used to transmit the JSONP callback to the
server is now specified via the `jsonpCallbackParam` config value, instead of
using the `JSON_CALLBACK` placeholder.

* Any use of `JSON_CALLBACK` in a JSONP request URL will cause an error.
* Any request that provides a parameter with the same name as that given
by the `jsonpCallbackParam` config property will cause an error.

This is to prevent malicious attack via the response from an app inadvertently
allowing untrusted data to be used to generate the callback parameter.

Closes #15161
Closes #15143
Closes #11352
Closes #11328

BREAKING CHANGE

You can no longer use the `JSON_CALLBACK` placeholder in your JSONP requests.
Instead you must provide the name of the query parameter that will pass the
callback via the `jsonpCallbackParam` property of the config object, or app-wide via
the `$http.defaults.jsonpCallbackParam` property, which is `"callback"` by default.

Before this change:

```
$http.json('trusted/url?callback=JSON_CALLBACK');
$http.json('other/trusted/url', {params:cb:'JSON_CALLBACK'});
```

After this change:

```
$http.json('trusted/url');
$http.json('other/trusted/url', {callbackParam:'cb'});
```
2016-10-05 14:39:50 +01:00
Peter Bacon Darwin 6476af83cd feat($http): JSONP requests now require a trusted resource URL
The $http service will reject JSONP requests that are not trusted by
`$sce` as "ResourceUrl".
This change makes is easier for developers to see clearly where in their
code they are making JSONP calls that may be to untrusted endpoings and
forces them to think about how these URLs are generated.

Be aware that this commit does not put any constraint on the parameters
that will be appended to the URL. Developers should be mindful of what
parameters can be attached and how they are generated.

Closes #11352

BREAKING CHANGE

All JSONP requests now require the URL to be trusted as resource URLs.
There are two approaches to trust a URL:

**Whitelisting with the `$sceDelegateProvider.resourceUrlWhitelist()`
method.**

You configure this list in a module configuration block:

```
appModule.config(['$sceDelegateProvider', function($sceDelegateProvider) {
  $sceDelegateProvider.resourceUrlWhiteList([
    // Allow same origin resource loads.
    'self',
    // Allow JSONP calls that match this pattern
    'https://some.dataserver.com/**.jsonp?**`
  ]);
}]);
```

**Explicitly trusting the URL via the `$sce.trustAsResourceUrl(url)`
method**

You can pass a trusted object instead of a string as a URL to the `$http`
service:

```
var promise = $http.jsonp($sce.trustAsResourceUrl(url));
```
2016-10-05 14:19:55 +01:00
Peter Bacon Darwin 9d08b33a0d test($route): ensure mock $sce delegate is implemented correctly
The mock calls to `valueOf(v)` and `getTrustedResourceUrl(v)` were not dealing
with the case where `v` was null.
2016-10-05 13:05:49 +01:00
Georgios Kalpakas e13eeabd7e fix($q): treat thrown errors as regular rejections
Previously, errors thrown in a promise's `onFulfilled` or `onRejected` handlers were treated in a
slightly different manner than regular rejections:
They were passed to the `$exceptionHandler()` (in addition to being converted to rejections).

The reasoning for this behavior was that an uncaught error is different than a regular rejection, as
it can be caused by a programming error, for example. In practice, this turned out to be confusing
or undesirable for users, since neither native promises nor any other popular promise library
distinguishes thrown errors from regular rejections.
(Note: While this behavior does not go against the Promises/A+ spec, it is not prescribed either.)

This commit removes the distinction, by skipping the call to `$exceptionHandler()`, thus treating
thrown errors as regular rejections.

**Note:**
Unless explicitly turned off, possibly unhandled rejections will still be caught and passed to the
`$exceptionHandler()`, so errors thrown due to programming errors and not otherwise handled (with a
subsequent `onRejected` handler) will not go unnoticed.

Fixes #3174
Fixes #14745

Closes #15213

BREAKING CHANGE:

Previously, throwing an error from a promise's `onFulfilled` or `onRejection` handlers, would result
in passing the error to the `$exceptionHandler()` (in addition to rejecting the promise with the
error as reason).

Now, a thrown error is treated exactly the same as a regular rejection. This applies to all
services/controllers/filters etc that rely on `$q` (including built-in services, such as `$http` and
`$route`). For example, `$http`'s `transformRequest/Response` functions or a route's `redirectTo`
function as well as functions specified in a route's `resolve` object, will no longer result in a
call to `$exceptionHandler()` if they throw an error. Other than that, everything will continue to
behave in the same way; i.e. the promises will be rejected, route transition will be cancelled,
`$routeChangeError` events will be broadcasted etc.
2016-10-05 14:49:02 +03:00
Justas Brazauskas 823295fee0 docs(*): fix typos in comments and docs
Closes #15206
2016-10-03 13:16:08 +03:00
mrLarbi 9062bae05c feat($anchorScroll): convert numeric hash targets to string
This allows `$anchorScroll(7)` to scroll to `<div id="7">` (although technically, the target ID is a
string, not a number).

Fixes #14680

Closes #15182
2016-09-30 18:49:20 +03:00
Georgios Kalpakas 3253b55861 docs(ngCsp): fix "directive"'s restrict and hide comment from output 2016-09-30 13:43:33 +03:00
Georgios Kalpakas 2be5ac631b docs(ngAnimate): fix typo ("an the" --> "an")
Fixes #15194
2016-09-30 12:26:17 +03:00
tijwelch 26a6a9b624 docs($http): fix typo in headersGetter
Closes #15198
2016-09-30 10:16:44 +03:00
GregoryPorter 714b53ac6f docs(tutorial): fix typos
- **step_04:** `controllers is one file` --> `controllers in one file`
- **step_06:** `.components.js` --> `.component.js`

Closes #15197
2016-09-30 10:08:12 +03:00
Georgii Dolzhykov ddb4ef13a9 docs(angular.mock.inject): improve formatting
Without backticks, underscores are rendered as italics.

PR (#15186)
2016-09-26 15:55:06 +02:00
pharkare 723d64d370 docs(tutorial/index): fix spelling error for word 'standalone'
PR (#15187)
2016-09-26 15:54:02 +02:00
Georgios Kalpakas 3fe3da8794 fix($compile): set attribute value even if ngAttr* contains no interpolation
Previoulsy, when the value of an `ngAttrXyz` attribute did not contain any interpolation, then the
`xyz` attribute was never set.

BTW, this commit adds a negligible overhead (since we have to set up a one-time watcher for
example), but it is justifiable for someone that is using `ngAttrXyz` (instead of `xyz` directly).

(There is also some irrelevant refactoring to remove unnecessary dependencies from tests.)

Fixes #15133

Closes #15149
2016-09-25 17:30:49 +03:00
Elliot Cameron f60447072d docs(guide/filter): imrpove explanation of "pure function"
Improve the explanation of what a "pure function" is in simple words. The previous explanation
could be confusing, especially since the term "idempotent" (here used in it's broader
"Computer Science" meaning) is overloaded and has much stricter semantics in Mathematics or pure
Functional Programming.

Closes #15173
2016-09-25 16:15:18 +03:00
Adrian Bordinc 90f947b186 docs($compile): Fix a typo in the warning header
Closes #15184
2016-09-25 15:34:00 +03:00
Joao Dinis cf241c425b docs(guide/concepts): insert comma
Closes #15166
2016-09-21 15:13:15 +03:00
Georgios Kalpakas 8d4d3d527d refactor($resource): use route.defaults (already merged provider.defaults + options)
Closes #15160
2016-09-21 14:24:13 +03:00
Georgios Kalpakas bf61c1471d refactor($resource): use local references of Angular helpers 2016-09-21 14:23:28 +03:00
Georgios Kalpakas 6eb4ffc085 fix($resource): pass options when binding default params
`Resource.bind()`, which creates an new Resource class with the same propertiesexcept for the
additional bound default parameters, was not passing the original Resource class' `options`,
resulting in different behavior.
This commit fixes it by passing the `options` when creating the new Resource class.
2016-09-21 14:23:28 +03:00
davidcigital b59bc0b01d docs(ngCsp): update explanation of CSP rules and how they affect Angular
Update the description of CSP, mainly regarding `unsafe-eval` and `unsafe-inline`. The way it was
presented previously was slightly misleading as it indicated that these were rules forbidding
certain things, when in fact it's a keyword in the CSP that disables the very rule that was
described. The updated text clarifies this better.

Closes #15142
2016-09-19 19:18:46 +03:00
Matt Gilson f1cc58c7d2 docs(angular.toJson): add missing param type
Reference:
[JSON.stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify).

Closes #15156
2016-09-19 19:06:23 +03:00
Georgios Kalpakas e1e2fe1c08 docs($templateCache): fix typo (template --> templateCache) 2016-09-19 17:57:31 +03:00
Stepan Suvorov bb8e955a02 docs(cacheFactory): remove ng-include practice from docs
Generally we don't use `ngInclude` any more, so this commit updates the
example snippet to use component instead.

Closes #15153
2016-09-19 08:04:53 +01:00
thorn0 16dccea887 fix($compile): bindToController should work without controllerAs
Fixes #15088

Closes #15110
2016-09-16 19:10:12 +03:00
Georgios Kalpakas a1bdffa12f fix($compile): do not overwrite values set in $onInit() for <-bound literals
See #15118 for more details.

Fixes #15118

Closes #15123
2016-09-16 16:23:57 +03:00
Georgios Kalpakas 52bf2bd11e refactor(ngOptions): access copy() directly (angular.copy --> copy) 2016-09-16 16:23:47 +03:00
Peter Bacon Darwin 32aa7e7395 fix(ngTransclude): use fallback content if only whitespace is provided
If the transcluded content is only whitespace then we should use the
fallback content instead. This allows more flexibility in formatting
your HTML.

Closes #15077
Closes #15140

BREAKING CHANGE:

Previously whitespace only transclusion would be treated as the transclusion
being "not empty", which meant that fallback content was not used in that
case.

Now if you only provide whitespace as the transclusion content, it will be
assumed to be empty and the fallback content will be used instead.

If you really do want whitespace then you can force it to be used by adding
a comment to the whitespace.
2016-09-15 13:36:48 +01:00
Peter Bacon Darwin 1547c751aa refactor($parse): remove Angular expression sandbox
The angular expression parser (`$parse`) attempts to sandbox expressions
to prevent unrestricted access to the global context.

While the sandbox was not on the frontline of the security defense,
developers kept relying upon it as a security feature even though it was
always possible to access arbitrary JavaScript code if a malicious user
could control the content of Angular templates in applications.

This commit removes this sandbox, which has the following benefits:

* it sends a clear message to developers that they should not rely on
the sandbox to prevent XSS attacks; that they must prevent control of
expression and templates instead.
* it allows performance and size improvements in the core Angular 1
library.
* it simplifies maintenance and provides opportunities to make the
parser more capable.

Please see the [Sandbox Removal Blog Post](http://angularjs.blogspot.com/2016/09/angular-16-expression-sandbox-removal.html)
for more detail on what you should do to ensure that your application is
secure.

Closes #15094
2016-09-15 11:18:26 +01:00
Prashant Singh Pawar 76d3dafdea fix($compile): don't throw tplrt error when there is a whitespace around a top-level comment
Added new conditional for NODE_TYPE_TEXT inside removeComments method of $compile
Added corresponding unit tests.

Closes #15108
PR (#15132)
2016-09-15 12:10:27 +02:00
Jason Bedard 9e24e774a5 perf(form, ngModel): change controllers to use prototype methods
This makes the largetable-bp ng-model benchmarks 10-15% faster (down 90-100ms for me). The actual controller instantiation doesn't change too much but the overall numbers seem consistently faster, I assume all due to reducing memory usage / gc. Specifically on creation there is ~40% less memory GCed, on destruction there is about ~25% less.

PR (#13286)

BREAKING CHANGE:
The use of prototype methods instead of new methods per instance removes the ability to pass 
NgModelController and FormController methods without context.

For example

`$scope.$watch('something', myNgModelCtrl.$render)`

will no longer work because the `$render` method is passed without any context. 
This must now be replaced with

```
$scope.$watch('something', function() {
  myNgModelCtrl.$render();
})
```

or possibly by using `Function.prototype.bind` or `angular.bind`.
2016-09-14 22:21:09 +02:00
Jérome Freyre 21e4db9e07 docs(input[range]): fix erroneous examples
PR (#15135)
2016-09-14 13:56:45 +02:00
Martin Staffa 07849779ba chore(benchmarks): fix order-by benchmark 2016-09-12 18:24:29 +02:00
Georgios Kalpakas 912d5b9ad3 docs(ngView): remove obsolete known issue 2016-09-12 17:27:37 +03:00
Georgii Dolzhykov d14c7f3c31 docs($compile): remove obsolete sentence
Fixes #15109

Closes #15119
2016-09-10 20:30:14 +03:00
Jason Bedard 78e6a58368 refactor($q): remove unnecessary checks/helpers/wrappers
- Remove internal `makePromise()` helper.
- Remove unnecessary wrapper functions.
- Remove unnecessary check for promises resolving multiple times.
  (By following the Promises/A+ spec, we know this will never happen.)
- Switch from function expressions to (named) function declarations.

Closes #15065
2016-09-10 16:03:13 +03:00
Austin O'Neil 51c516e7d4 docs(ngOptions): correct links
remove redundant link to ngOptions and add link to ngRepeat

PR (#15117)
2016-09-09 23:34:29 +02:00
Mohsen Azimi 51a2eb7d6f docs($q): fix typo in race() test description (array --> object)
Closes #15111
2016-09-09 00:07:27 +03:00
Tyler Romeo 3f759b191d fix($sniffer): don't use history.pushState in sandboxed Chrome Packaged Apps
While sandboxed Chrome Packaged Apps (CPAs) have the same restrictions wrt
accessing `history.pushState` as "normal" CPAs, they can't be detected in the
same way, as they do not have access to the same APIs.
Previously, due to their differences from normal CPAs, `$sniffer` would fail to
detect sandboxed CPAs and incorrectly assume `history.pushState` is available
(which resulted in an error being thrown).
This commit fixes the detection of sandboxed CPAs in `$sniffer`.

See #11932 and #13945 for previous work.

Closes #15021
2016-09-08 23:52:39 +03:00
Georgios Kalpakas a83a209df6 docs(ngModelOptions): minor fixes/improvements 2016-09-08 23:39:00 +03:00
Martin Staffa cc8ea72f3a docs(ngSwitch): add separator example 2016-09-08 21:23:41 +02:00
Lucas Galfaso 0b22173000 feat(ngSwitch): allow multiple case matches via optional attribute ngSwitchWhenSeparator
Adds an optional attribute `ngSwitchWhenSeparator` that allows multiple tokens to match a given `ngSwitchWhen`.

Closes #3410
Closes #3516

Closes #10798
2016-09-08 21:10:14 +02:00
Martin Staffa 4941e047b7 docs($compile): link to sections from properties in example 2016-09-08 15:58:05 +02:00
Austin O'Neil c729554281 docs(guide/component): clarify when to use directives instead of components
Clarify that components cannot be used to perform actions in compile
and prelink functions.

Closes #15042
PR (#15100)
2016-09-08 15:21:10 +02:00
sethbattin 8ec3f4b518 docs($resourceProvider): include '$' in di in example
The injection argument is missing the '$' in the two examples.  The code fails as written.  This change corrects it.

(#15099)
2016-09-08 15:18:32 +02:00
Michał Gołębiowski d882fde2e5 feat(jqLite): return [] for .val() on <select multiple> with no selection
Fixes #14370

BREAKING CHANGE: For the jqLite element representing a select element in
the multiple variant with no options chosen the .val() getter used to return
null and now returns an empty array.

To migrate the code follow the example below:

Before:

HTML:

    <select multiple>
        <option>value 1</option>
        <option>value 2</option>
    </select>

JavaScript:

    var value = $element.val();
    if (value) {
        /* do something */
    }

After:

HTML:

    <select multiple>
        <option>value 1</option>
        <option>value 2</option>
    </select>

JavaScript:

    var value = $element.val();
    if (value.length > 0) {
        /* do something */
    }
2016-09-08 09:55:24 +02:00
Michał Gołębiowski 121f64936e refactor(jqLite): use the toEqualOneOf matcher in jqLite tests 2016-09-08 09:55:24 +02:00
Michał Gołębiowski dbb8483b4d refactor(matchers): add the toEqualOneOf matcher 2016-09-08 09:55:24 +02:00
Michał Gołębiowski 6341f4260a refactor(jqLite): run more tests on jQuery 2.2, add version detection helpers 2016-09-08 09:55:24 +02:00
Georgios Kalpakas 704123a81b docs($compile): be more explicit about linking not having taken place inside cloneAttachFn
Fixes #15093
2016-09-07 19:10:23 +03:00
Georgios Kalpakas c0cbe54bc6 test($compile): extend $onChanges() test to account for one more case
Discussed in https://github.com/angular/angular.js/pull/15098/files#r77770755.
2016-09-07 15:03:45 +03:00
Georgios Kalpakas 7d7efbf545 fix($compile): avoid calling $onChanges() twice for NaN initial values
Closes #15098
2016-09-07 12:19:27 +01:00
Peter Bacon Darwin 3cb5bad15d test($compile): add tests for provider settings
See https://github.com/angular/angular.js/pull/15095#issuecomment-244970426
2016-09-07 08:52:00 +01:00
Peter Bacon Darwin dfb8cf6402 feat($compile): add preAssignBindingsEnabled option
A new option to enable/disable whether directive controllers are assigned bindings before
calling the controller's constructor.

If enabled (true), the compiler assigns the value of each of the bindings to the
properties of the controller object before the constructor of this object is called.

If disabled (false), the compiler calls the constructor first before assigning bindings.

The default value is enabled (true) in Angular 1.5.x but will switch to false in Angular 1.6.x.

See #14580
Closes #15095
2016-09-07 08:51:59 +01:00
Martin Staffa de1ede7f44 docs(error/noident): add missing comma
Closes #15086
2016-09-05 22:57:59 +02:00
BobChao87 45129cfd06 fix($sanitize): reduce stack height in IE <= 11
Update Internet Explorer-only helper function stripCustomNsAttrs to be less
recursive. Reduce stack height of function causing out of stack space error.

Closes #14928
Closes #15030
2016-09-05 22:53:07 +02:00
gdi2290 aa306c14cb refactor(*): introduce isNumberNaN
window.isNaN(‘lol’); //=> true
Number.isNaN(‘lol’); //=> false

isNaN converts it’s arguments into a Number before checking if it’s NaN.
In various places in the code base, we are checking if a variable is a Number and
NaN (or not), so this can be simplified with this new method (which is not exported on the
global Angular object).

Closes #11242
2016-09-05 22:22:48 +02:00
Martin Staffa 9fbad3c7c2 chore(*): use binaries from node_modules/.bin
Closes #15071
2016-09-05 22:04:36 +02:00
John-David Dalton 6100f10fa9 chore(npm): use require.resolve when possible to avoid hard coded module paths 2016-09-05 22:04:36 +02:00
Peter Bacon Darwin 87a2ff76af feat(ngModelOptions): allow options to be inherited from ancestor ngModelOptions
Previously, you had to apply the complete set of ngModelOptions at every point where
you might want to modify just one or two settings.

This change allows more general settings to be applied nearer to the top of the DOM
and then for more specific settings to override those general settings further down
in the DOM.

Furher there is now a new service `$modelOptions` that acts as the top level options
that are inherited by all ngModelOptions directives that do not already have an
ngModelOptions ancestor directive.

Closes #10922

BREAKING CHANGE:

Previously, if a setting was not applied on ngModelOptions, then it would default
to undefined. Now the setting will be inherited from the nearest ngModelOptions
ancestor.

It is possible that an ngModelOptions directive that does not set a property,
has an ancestor ngModelOptions that does set this property to a value other than
undefined. This would cause the ngModel and input controls below this ngModelOptions
directive to display different behaviour. This is fixed by explictly setting the
property in the ngModelOptions to prevent it from inheriting from the ancestor.

For example if you had the following HTML:

```
<form ng-model-options="{updateOn: 'blur'}">
  <input ng-model="...">
</form>
```

Then before this change the input would update on the default event not blur.
After this change the input will inherit the option to update on blur.
If you want the original behaviour then you will need to specify the option
on the input as well:

```
<form ng-model-options="{updateOn: 'blur'}">
  <input ng-model="..." ng-model-options="{updateOn: 'default'}">
</form>
```

The programmatic API for `ngModelOptions` has changed. You must now read options
via the `getOption` method, rather than accessing the option directly as a property
of the options object. This does not affect the usage in templates and only
affects custom directives that might have been reading options for their own purposes.
2016-09-02 20:40:12 +01:00
Brian Glick 5be6f993aa docs(currency): add missing line break
Insert missing line break between currency examples

PR  (#15083)
2016-09-01 20:08:52 +02:00
Packt 81d52dfe39 docs(guide/External Resources): add a paid-online course
Closes #15075
2016-09-01 11:40:26 +01:00
Jason Bedard 11f2731f72 perf($compile): validate directive.restrict property on directive init
This allows the removal of try/catch from addDirective to avoid V8 deopt.

Previously the directive.restrict property was not validated. This would
potentially cause exceptions on each compilation of the directive
requiring a try/catch and potentially causing repeated errors.

New validation when directive.restrict is specified:
* must be a string
* must contain at least one valid character (E, A, C, M)

Cases which previously silently failed (now throw an error):
* values with an indexOf method (such as strings, arrays) which returned
 returned -1 for all valid restrict characters

Cases which previously worked unintentionally (now throw an error):
* arrays with single-character strings of valid restrict characters

PR (#13263)
2016-08-30 22:48:46 +02:00
Jason Bedard 1e1fbc75f5 fix($compile): disallow linking the same element more then once
Previously the following would invoke the element link function multiple
times, causing unknown and potentially buggy results:

    var link = $compile(html);
    link(scope);
    link(scope);

This was always unsupported. Now this throws a multilink error.

PR (#13422)
2016-08-30 22:45:32 +02:00
Martin Staffa 53a3bf6634 feat($compile): throw error when directive name or factory fn is invalid
Closes: #15056
PR (#15057)
2016-08-28 16:53:08 +02:00
Georgios Kalpakas e3a378e7a3 feat($resource): pass status/statusText to success callbacks
Fixes #8341
Closes #8841
PR (#14836)
2016-08-26 18:36:22 +02:00
Martin Staffa c75698df55 fix(select): add/remove selected attribute for selected/unselected options 2016-08-26 14:16:59 +02:00
Martin Staffa 2785ad7259 fix(select, ngOptions): make the handling of unknown / empty options consistent
- when the model does not match any option, the select generates an unknown option with the value
'? hashedModelVal ?' (select) or simply '?' (ngOptions) and inserts it into the select. This
option is then auto-selected by the browser. Once the user selects an option / the application sets
a matching model, the unknown option is removed from the select. It is therefore not user-selectable.

Alternatively, the application can provide an option with the value='', the so-called empty option.
The empty option takes over the role of the unknown option, in that it is selected when there's no
matching model, but it is not removed when a option and model match, and it can also be selected by
the user. The empty option has the value='' and sets the model to  if selected.

Previously, these concepts where a bit mushy, especially in ngOptions.

This fix now delegates the bulk of the work to the selectCtrl, as the concept of unknown and empty
option are the same for both directives. Only the generation of the empty option is different.

The commit also adjusts a test for an officially unsupported use-case: multiple empty options.
The new behavior is that the empty option that is registered last is used. The other one is still
present. Otherwise, this behavior is unspecified, and the docs are clear that only a single empty
option is allowed. We support dynamically generated empty options, but not multiple ones. I've left
the test to highlight that this might be someone's use case, and the we are aware of it.
2016-08-26 14:16:59 +02:00
Raphael Jamet ad9a99d689 fix($compile): lower the $sce context for src on video, audio, and track.
Previously, video, audio, and track sources were $sce.RESOURCE_URL. This is not justified as
no attacks are possible through these attributes as far as I can tell. This change is not
breaking, and uses of $sce.trustAsResourceUrl before assigning to src or ng-src attributes
will just be silently ignored.
2016-08-26 09:58:02 +02:00
Martin Staffa 7fb81ecf12 Revert "fix($compile): lower the $sce context for src on video, audio, source, and track"
This reverts commit 485320129d, because I did not author most of
this commit. I merged via Github and for some reason it used the last commit in a series of commits
to establish the author.
2016-08-26 09:55:16 +02:00
Martin Staffa 485320129d fix($compile): lower the $sce context for src on video, audio, source, and track
Previously, video, audio, source, and track sources were $sce.RESOURCE_URL. This is not justified as
no attacks (script execution) are possible through these attributes as far as we can tell. Angular2 also uses the same categorization.

This change is not breaking, and uses of $sce.trustAsResourceUrl before assigning to src or ng-src attributes will just be silently ignored.

This has also been given a LGTM by @mprobst via email.

PR (#15039)
Closes #14019
2016-08-26 09:52:11 +02:00
Georgios Kalpakas 13c2522baf fix($compile): correctly merge consecutive text nodes on IE11
As explained in #11781 and #14924, IE11 can (under certain circumstances) break up a text node into
multiple consecutive ones, breaking interpolated expressions (e.g. `{{'foo'}}` would become
`{{` + `'foo'}}`). To work-around this IE11 bug, #11796 introduced extra logic to merge consecutive
text nodes (on IE11 only), which relies on the text nodes' having the same `parentNode`.

This approach works fine in the common case, where `compileNodes` is called with a live NodeList
object, because removing a text node from its parent will automatically update the latter's
`.childNodes` NodeList. It falls short though, when calling `compileNodes` with either a
jqLite/jQuery collection or an Array. In fails in two ways:

1. If the text nodes do not have a parent at the moment of compiling, there will be no merging.
   (This happens for example on directives with `transclude: {...}`.)
2. If the text nodes do have a parent, just removing a text node from its parent does **not** remove
   it from the collection/array, which means that the merged text nodes will still get compiled and
   linked (and possibly be displayed in the view). E.g. `['{{text1}}', '{{text2}}', '{{text3}}']`
   will become `['{{text1}}{{text2}}{{text3}}', '{{text2}}', '{{text3}}']`.

--
This commit works around the above problems by:

1. Merging consecutive text nodes in the provided list, even if they have no parent.
2. When merging a text node, explicitly remove it from the list (unless it is a live, auto-updating
   list).

This can nonetheless have undesirable (albeit rare) side effects by overzealously merging text
nodes that are not meant to be merged (see the "BREAKING CHANGE" section below).

Fixes #14924

Closes #15025

BREAKING CHANGE:

**Note:** Everything described below affects **IE11 only**.

Previously, consecutive text nodes would not get merged if they had no parent. They will now, which
might have unexpectd side effects in the following cases:

1. Passing an array or jqLite/jQuery collection of parent-less text nodes to `$compile` directly:

    ```js
    // Assuming:
    var textNodes = [
      document.createTextNode('{{'),
      document.createTextNode('"foo"'),
      document.createTextNode('}}')
    ];
    var compiledNodes = $compile(textNodes)($rootScope);

    // Before:
    console.log(compiledNodes.length);   // 3
    console.log(compiledNodes.text());   // {{'foo'}}

    // After:
    console.log(compiledNodes.length);   // 1
    console.log(compiledNodes.text());   // foo

    // To get the old behavior, compile each node separately:
    var textNodes = [
      document.createTextNode('{{'),
      document.createTextNode('"foo"'),
      document.createTextNode('}}')
    ];
    var compiledNodes = angular.element(textNodes.map(function (node) {
      return $compile(node)($rootScope)[0];
    }));
    ```

2. Using multi-slot transclusion with non-consecutive, default-content text nodes (that form
   interpolated expressions when merged):

   ```js
   // Assuming the following component:
   .compoent('someThing', {
     template: '<ng-transclude><!-- Default content goes here --></ng-transclude>'
     transclude: {
       ignored: 'veryImportantContent'
     }
   })
   ```

   ```html
   <!-- And assuming the following view: -->
   <some-thing>
     {{
     <very-important-content>Nooot</very-important-content>
     'foo'}}
   </some-thing>

   <!-- Before: -->
   <some-thing>
     <ng-transclude>
       {{       <-- Two separate
       'foo'}}  <-- text nodes
     </ng-transclude>
   </some-thing>

   <!-- After: -->
   <some-thing>
     <ng-transclude>
       foo  <-- The text nodes were merged into `{{'foo'}}`, which was then interpolated
     </ng-transclude>
   </some-thing>

   <!-- To (visually) get the old behavior, wrap top-level text nodes on -->
   <!-- multi-slot transclusion directives into `<span>` elements; e.g.: -->
   <some-thing>
     <span>{{</span>
     <very-important-content>Nooot</very-important-content>
     <span>'foo'}}</span>
   </some-thing>

   <!-- Result: -->
   <some-thing>
     <ng-transclude>
       <span>{{</span>       <-- Two separate
       <span>'foo'}}</span>  <-- nodes
     </ng-transclude>
   </some-thing>
   ```
2016-08-25 19:15:10 +03:00
Georgios Kalpakas cb31067c2a docs(tutorial/step_03): improve explanation of camel-/kebab-casing
Related to #15051.
2016-08-25 18:36:20 +03:00
Wei Wang 3d686a988d feat($location): add support for selectively rewriting links based on attribute
In HTML5 mode, links can now be selectively rewritten, by setting `mode.rewriteLinks` to a string
(denoting an attribute name). Anchor elements that have the specified attribute will be rewritten,
while other links will remain untouched.

This can be useful in situations where it is desirable to use HTML5 mode without a `<base>` tag, but
still support rewriting specific links only. See #14959 for more details on a possible usecase.

Closes #14976
2016-08-22 17:39:55 +03:00
Benjamin Blackwood 8df43677e2 docs($resource): add status param to transformResponse signature
Add `status` param to `transformResponse` signature to keep inline with 1b74097.

Closes #15041
2016-08-18 15:50:30 +03:00
Martin Staffa e50e91c7a8 docs($componentController): add more info
Closes #15038
2016-08-17 22:09:49 +02:00
Duly Bonheur c54f7a93e0 docs(ngRepeat): improve example description
The example seems to also be filtering by age. It threw me off a bit because I was getting results when I entered numbers in the input field.

PR (#15037)
2016-08-17 21:48:47 +02:00
Martin Staffa e1da4bed8e feat(input[number]): support step
input[number] will now set the step error if the input value
(ngModel $viewValue) does not fit the step constraint set in the step / ngStep attribute.

Fixes #10597
2016-08-17 21:22:01 +02:00
Martin Staffa 9a8b8aaa96 feat(input[range]): support step
Step support works like min / max, but with the following caveat.
Currently, only Firefox fully implements the spec. Other browsers
(Chrome, Safari, Edge) have issues when the step value changes
after the input has been changed. They do not adjust the input value
to a valid value, but instead set the stepMismatch validity state.

Angular will take this validity state, and forward it as the ngModel
"step" error. Adjusting the error ourselves would add too much code,
as the logic is quite involved.
2016-08-17 21:22:01 +02:00
Georgios Kalpakas 88f3517db2 docs(guide/concepts): improve wording 2016-08-17 17:28:00 +03:00
Martin Staffa a272a3c0bd fix(input[range]): correctly handle min/max; remove ngMin/ngMax support
This commit fixes the handling of min/max, and removes support for ngMin/ngMax:

min/max:
Previously, interpolated min/max values on input range were not set when the first $render happens,
because the interpolation directive only sets the actual element attribute value after
a digest passes. That means that the browser would not adjust
the input value according to min/max and the range input and model would
not be initialzed as expected. 
With this change, input range will set the actual element attribute value during its own
linking phase, as it is already available on the attrs argument passed to the link fn.

ngMin/ngMax
Since ng prefixed attributes do not set their corresponding element attribute, the range input would always have min = 0, and max = 100 (in supported browsers), regardless of the value
in ngMin/ngMax. This is confusing and not very useful, so it's better to not support these attributes at all.

The commit also fixes a test which used an interpolation inside an attribute that expects an expression.

Fixes #14982 
PR (#14996)
2016-08-12 19:58:08 +02:00
Martin Staffa eacfe4148e feat($controller): throw when requested controller is not registered
Previously, it would throw the ng:areq error, which is less
specific and just informs that the requested controller is not defined. 
Given how commonly controllers are used
in Angular, it makes sense to have a specific error.

The ng:areq error is still thrown when the registered controller
is not a function.

Closes #14980
PR (#15015)
2016-08-12 19:12:12 +02:00
Georgios Kalpakas 6304cde2fc chore(build): fix version placeholder matching
During the `build` task, the version placeholders will be replaced with the actual values using a
RegExp, which expects the placeholders to be surrounded by double quotes. By replacing the quotes
from double to single in #15011, the RegExp was not able to match the placeholders.

(For reference, the RegExps that match and replace the version placeholders are in
[lib/grunt/utils.js][1].)

[1]: https://github.com/angular/angular.js/blob/859348c7f61ff5f93b9f81eb7f46842bd018d8e3/lib/grunt/utils.js#L125-L130

Closes #15016
2016-08-12 18:18:30 +03:00
Michał Gołębiowski 859348c7f6 chore(*): change remaining /* @this */ to /** @this */
Ref ec565ddd9c
2016-08-11 01:16:40 +02:00
Michał Gołębiowski 9360aa2d27 chore(eslint): enable quotes: ["error", "single"]
The quotes rule had to be disabled for e2e tests generated from ngdoc
because dgeni templates use double quotes as string delimiters.

Since we can't have guarantees that dgeni template wrappers will follow
the same JS code style the Angular 1 repo uses, we should find a way
to enforce our ESLint setup only for the parts in this repo, perhaps
via prepending a generated `/* eslint-enable OUR_RULES */` pragma.

Closes #15011
2016-08-10 21:52:38 +02:00
Georgios Kalpakas 42a00611f8 docs(CONTRIBUTING.md): minor improvements
Closes #15008
2016-08-10 20:45:21 +03:00
Martin Staffa b6340d1654 docs(ngValue): improve use case description 2016-08-09 22:08:20 +02:00
mohamed amr e6afca00c9 fix(ngValue): set the element's value property in addition to the value attribute
Input elements use the value attribute as their default value if the value property is not set.
Once the value property has been set (by adding input), it will not react to changes to
the value attribute anymore. Setting both attribute and property fixes this behavior, and
makes it possible to use ngValue as a one-way bind.

Closes #14031
Closes #13984

POSSIBLE BREAKING CHANGE:

`ngValue` now also sets the value *property* of its element. Previously, it would only set the
value *attribute*. This allows `ngValue` to be used as a one-way binding mechanism on `input[text]`
and `textarea` elements without `ngModel`. Previously, these input types would not update correctly
when only the value attribute was changed.
This change should not affect any applications, as `ngValue` is mainly used on `input[radio]` and
`option` elements, both of which are unaffected by this change.
2016-08-09 22:08:20 +02:00
Benjamin Dopplinger c7010bef6e docs(contributing.md): fix indentation for proper Markdown syntax
PR (#15007)
2016-08-09 10:30:36 +02:00
Georgios Kalpakas b62f33f29a docs(ngMock/$httpBackend): improve description of .flush() 2016-08-09 00:25:08 +03:00
sarychev 72b663219e feat(ngMock/$httpBackend): flush requests in any order
Previously, requests were flushed in the order in which they were made.
With this change, it is possible to flush requests in any order. This is useful for simulating more
realistic scenarios, where parallel requests may be completed in any order.

Partially addresses #13717.

Closes #14967
2016-08-08 21:52:30 +03:00
Georgios Kalpakas fdf8e0f988 fix($httpBackend): complete the request on timeout
When using the [timeout attribute](https://xhr.spec.whatwg.org/#the-timeout-attribute) and an XHR
request times out, browsers trigger the `timeout` event (and execute the XHR's `ontimeout`
callback). Additionally, Safari 9 handles timed-out requests in the same way, even if no `timeout`
has been explicitly set on the XHR.
In the above cases, `$httpBackend` would fail to capture the XHR's completing (with an error), so
the corresponding `$http` promise would never get fulfilled.

Note that using `$http`'s `timeout` configuration option does **not** rely on the XHR's `timeout`
property (or its `ontimeout` callback).

Fixes #14969
Closes #14972
2016-08-08 19:12:17 +03:00
Georgios Kalpakas ec565ddd9c chore(package): fix some warnings/errors
Related to #14952. Fixed the following warnings/errors:

1. **Warning**: Closure Compiler complained about `/* @this */` (annotations in non-JSDoc comments).
   Fixed by changing `/* @this */` to `/** @this */`.

2. **Warning**: Dgeni complained about `/** @this */` (invalid tags found).
   Fixed by adding an empty `this` tag definition in `docs/config/tag-defs/`.

3. **Error**: ESLint complained about CRLF linebreaks in `build/docs/examples/`. These are generated
   by dgeni and (apparently) use the system's default linebreak (e.g. CRLF on Windows).
   Fixed by disabling the `linebreak-style` rule for `build/docs/examples/`.

Closes #14997
2016-08-08 18:40:29 +03:00
Georgios Kalpakas 975a6170ef fix(aria/ngModel): do not overwrite the default $isEmpty() method for checkboxes
Previously, `ngAria` would overwrite the default `ngModelController.$isEmpty()` method for custom
`checkbox`-shaped controls (e.g. `role="checkbox"` or `role="menuitemcheckbox"`), using the same
implementation as `input[checkbox]` (i.e. `value === false`). While this makes sense for
`input[checkbox]` which also defines a custom parser, it doesn't make sense for a custom `checkbox`
out-of-the-box. For example, an unintialized value (`undefined`) would make the checkbox appear as
"checked".

If the user wants to provide a custom parser (e.g. setting falsy values to `false`), then they
should also provide a custom `$isEmpty()` method.

As a side effect, this commit solves issue #14621. (We could have solved it in different ways.)

Fixes #14621
Closes #14625

BREAKING CHANGE:

Custom `checkbox`-shaped controls (e.g. checkboxes, menuitemcheckboxes), no longer have a custom
`$isEmpty()` method on their `NgModelController` that checks for `value === false`. Unless
overwritten, the default `$isEmpty()` method will be used, which treats `undefined`, `null`, `NaN`
and `''` as "empty".

**Note:** The `$isEmpty()` method is used to determine if the checkbox is checked ("not empty" means
          "checked") and thus it can indirectly affect other things, such as the control's validity
          with respect to the `required` validator (e.g. "empty" + "required" --> "invalid").

Before:

```js
var template = '<my-checkbox role="checkbox" ng-model="value"></my-checkbox>';
var customCheckbox = $compile(template)(scope);
var ctrl = customCheckbox.controller('ngModel');

scope.$apply('value = false');
console.log(ctrl.$isEmpty());   //--> true

scope.$apply('value = true');
console.log(ctrl.$isEmpty());   //--> false

scope.$apply('value = undefined'/* or null or NaN or '' */);
console.log(ctrl.$isEmpty());   //--> false
```

After:

```js
var template = '<my-checkbox role="checkbox" ng-model="value"></my-checkbox>';
var customCheckbox = $compile(template)(scope);
var ctrl = customCheckbox.controller('ngModel');

scope.$apply('value = false');
console.log(ctrl.$isEmpty());   //--> false

scope.$apply('value = true');
console.log(ctrl.$isEmpty());   //--> false

scope.$apply('value = undefined'/* or null or NaN or '' */);
console.log(ctrl.$isEmpty());   //--> true
```

--
If you want to have a custom `$isEmpty()` method, you need to overwrite the default. For example:

```js
.directive('myCheckbox', function myCheckboxDirective() {
  return {
    require: 'ngModel',
    link: function myCheckboxPostLink(scope, elem, attrs, ngModelCtrl) {
      ngModelCtrl.$isEmpty = function myCheckboxIsEmpty(value) {
        return !value;   // Any falsy value means "empty"

        // Or to restore the previous behavior:
        // return value === false;
      };
    }
  };
})
```
2016-08-08 17:28:52 +03:00
Georgios Kalpakas e8d7496b62 perf($parse): improve performance of assignment expressions
There was a ~5% improvement in the added `parsed-expressions-bp/assignment` benchmark (which only
contains assignment expressions). In real-world applications, the time spent in assignment
expressions will be a tiny fragment of the overall processing time, though.

Closes #14957
2016-08-08 15:48:52 +03:00
Michał Gołębiowski 49f077736d chore(*): minor code style tweaks
This is a followup to the migration to ESLint.

Ref #14952

Closes #15006
2016-08-08 15:01:12 +03:00
Kevin Visscher 3393aac049 docs(error/reqslot): fix typo
Closes #15003
2016-08-08 14:31:41 +03:00
Martin Staffa 4fe0987966 style(benchmarks): fix eslint errors 2016-08-08 11:33:37 +02:00
dherman b58a7f8a12 chore(styleDirective): remove an unneccessary directive definition
Since the style directive is defined as a non-terminal element directive
with no behavior on link, we may as well not define anything at all.
PR (#14983)
2016-08-08 11:08:48 +02:00
Roshan Jossey 38a49641fd docs(guide/external-resources): add links to Atom and Vim packages
Add links to packages for Atom and Vim editors under editor support
subsection under tools section.
PR (#15000)
2016-08-08 11:02:47 +02:00
David Rodenas 4c2964d01b perf($compile): add provider option to turn off compilation of css class and comment directives
When the functions `cssClassDirectivesEnabled()` / `commentDirectivesEnabled()` on the `$compileProvider` are called with `false`, then the compiler won't look for directives on css classes / comment elements.

This can result in a compilation speed-up of around 10%.

PR (#14850)
2016-08-08 11:01:08 +02:00
Michał Gołębiowski 5fc993361f fix(jenkins): Fix the format for passing parameters to Grunt tasks
The Jenkins build.sh script has to be updated as the previous way of
specifying parameters to the code run in Grunt tasks stopped working
with the newest Grunt. This has been previously fixed for the Travis
build.sh but wasn't done for the Jenkins one.

Also, the contribute docs were updated to account for the new format.
2016-08-06 01:02:21 +02:00
Michał Gołębiowski c3220325a0 chore(*): switch from JSHint/JSCS to ESLint
Thanks to @narretz for help in fixing style violations and to @gkalpak
for a very extensive review.

Closes #14952
2016-08-05 22:18:32 +02:00
Michał Gołębiowski 517b9bd6ed chore(package.json): Remove the deprecated licenses field
The "licenses" field is deprecated in favor of the "license" field... which
we already have specified.
2016-08-05 20:24:58 +02:00
Michał Gołębiowski 8c00386e0d chore(package.json): update Karma & BrowserStack-related packages 2016-08-05 20:24:42 +02:00
Michał Gołębiowski 6f737293ee chore(package.json): remove the engineStrict field
The engineStrict field is deprecated in npm 2 and removed in npm 3.
2016-08-05 19:42:53 +02:00
Michał Gołębiowski b1c665095c chore(*): Add .nvmrc
If one uses nvm to manage Node.js versions, the .nvmrc file makes `nvm use`
switch to the version specified in .nvmrc. There are scripts that invoke
it automatically when cd'ing to directories containing .nvmrc so that you
never run build commands using a wrong Node version, see:
https://github.com/creationix/nvm/blob/v0.31.2/README.markdown#zsh
2016-08-05 19:42:42 +02:00
Michał Gołębiowski bdb794ebcf chore(bower): change the name in bower.json
This avoids warnings with newer versions of Bower.
2016-08-05 19:42:37 +02:00
Michał Gołębiowski 0606b15384 chore(package.json): upgrade Protractor
The previous version depended on a vulnerable request version.

Ref gh-14961
2016-08-05 19:42:28 +02:00
Michał Gołębiowski 3134e78fc0 chore(package.json): add grunt-cli to devDependencies, update grunt-* packages
The Travis build.sh script has to be updated as the previous way of
specifying parameters to the code run in Grunt tasks stopped working
with the newest Grunt.
2016-08-05 19:37:02 +02:00
Martin Staffa 1660ddd89e docs($resource): clarify overwriting a default action
Closes #14821
2016-08-03 11:10:37 +02:00
Gordon Zhu 494d12fd40 docs(guide/External Resources): remove stale resources
This commit removes two resources  (Firebase Foundations and Angular Course) that I authored but no longer maintain.
PR (#14973)
2016-08-01 09:58:37 +02:00
Georgios Kalpakas 7bef522042 docs($filter): improve description formatting 2016-07-31 10:46:19 +03:00
Georgios Kalpakas 4ef2169168 docs(textarea): add known issue about interpolation in placeholder in IE
Closes #5025

Closes #14965
2016-07-31 07:59:03 +03:00
Vitaly P 31f20b6db1 docs($filter): add link to built-in filters page 2016-07-30 16:57:19 +02:00
Martin Staffa 9130166767 feat(input): add support for binding to input[type=range] (#14870)
Thanks to @cironunes for the initial implementation in https://github.com/angular/angular.js/pull/9715

Adds support for binding to input[range] with the following behavior / features:

- Like input[number], it requires the model to be a Number, and will set the model to a Number
- it supports setting the min/max values via the min/max and ngMin/ngMax attributes
- it follows the browser behavior of never allowing an invalid value. That means, when the browser
converts an invalid value (empty: null, undefined, false ..., out of bounds: greater than max, less than min)
to a valid value, the input will in turn set the model to this new valid value via $setViewValue.
-- this means a range input will never be required and never have a non-Number model value, once the
ngModel directive is initialized.
-- this behavior is supported when the model changes and when the min/max attributes change in a way
that prompts the browser to update the input value.
-- ngMin / ngMax do not prompt the browser to update the values, as they don't set the attribute values.
Instead, they will set the min / max errors when appropriate
- browsers that do not support input[range] (IE9) handle the input like a number input (with validation etc.)

Closes #5892
Closes #9715
Close #14870
2016-07-29 14:29:09 +02:00
Georgios Kalpakas cd2f6d9d3b test(e2e): fix e2e tests in Firefox 2016-07-29 11:43:36 +03:00
Peter Bacon Darwin 13b7bf0bb5 docs(examples): give all examples a name
Closes #14958
2016-07-28 10:58:58 +01:00
Chung-Min Cheng 9ac9fb1565 docs(guide/animations): clean up example
Remove unnecessary inline styles, merge styles for identical selectors and clean up.

Closes #14960
2016-07-28 12:34:54 +03:00
Georgios Kalpakas c0795c97a5 docs(ngModel/numfmt): remove redundant argument 2016-07-27 12:04:03 +03:00
Georgios Kalpakas 4fa214ce32 fix($parse): block assigning to fields of a constructor prototype
This commit also adds the missing `isecaf` error page and more tests for assignment to constructors.

Fixes #14939

Closes #14951
2016-07-27 10:58:02 +03:00
Georgios Kalpakas 8ddfa2a491 fix($parse): correctly escape unsafe identifier characters
This commit also adds a couple of tests for `$parseProvider.setIdentifierFns()`.

Closes #14942
2016-07-26 10:18:09 +03:00
Georgios Kalpakas d6423804a9 test($parse): test custom literals with CSP both enabled and disabled
(This commit also includes a minor clean-up.)
2016-07-26 10:17:24 +03:00
Georgios Kalpakas 10a6e1a663 chore(travis): update sauce-connect
Closes #14936
2016-07-25 18:50:10 +03:00
Giuseppe Scoppino 544df1879b docs(guide/component): document $doCheck in the component guide
The docs for `$compile` were updated in e235f20 to include information about the recently
implemented `$doCheck` lifecycle hook for component controllers. The lifecycle hook documentation is
mirrored in the Component guide, and this change mirrors the update made to the `$compile` docs, to
the component guide docs.

Closes #14946
2016-07-25 18:17:28 +03:00
Martin Staffa b4769c371e fix(ngOptions): remove selected attribute from unselected options
When the select model changes, we add the "selected" attribute to the selected option, so that
screen readers know which option is selected.

Previously, we failed to remove the attribute from the selected / empty option when the model changed
to match a different option, or the unknown / empty option.

When using "track by", the behavior would also show when a user selected an option, and then the
model was changed, because track by watches the tracked expression, and calls the $render function
on change.

This fix reads the current select value, finds the matching option and removes the "selected"
attribute.

IE9 had to be special cased, as it will report option.hasAttribute('selected') === true even
if the option's property and attribute have been unset (even the dev tools show not selected attribute).

I've added a custom matcher that accounts for this behavior. In all other browsers, property and
attribute should always be in the same state. Since few people will use screen readers with IE9, I
hope this is a satisfactory solution to the problem.

Fixes #14892
Fixes #14419
Related #12731
PR (#14894)
2016-07-23 17:20:16 +02:00
Martin Staffa ca812b0aeb chore(travis): use Chrome 51 and FF 47 in unit tests
PR (#14943)
2016-07-23 16:07:02 +02:00
Martin Staffa 5fd42b6cb8 docs(form): clarify what $setPristine does 2016-07-22 21:33:33 +02:00
Martin Staffa ce3571280d docs(guide/External Resources): move it after the introduction 2016-07-22 21:30:43 +02:00
Martin Staffa 1d4216a8bc chore(travis): use Firefox 47
This commit also adds a new capability to the protractor configs that
ensures that all angularjs.org tests run correctly on Firefox. See
https://github.com/SeleniumHQ/selenium/issues/1202
2016-07-22 21:28:59 +02:00
Martin Staffa 95660555aa chore(npm): update protractor to 4.0.0
4.0.0 is the first version with Selenium 2.53.x, and we need that as lower versions have problems
with current Firefox versions.
See https://github.com/SeleniumHQ/selenium/issues/1202 and https://github.com/SeleniumHQ/selenium/issues/2110.

We are currently running tests on FF28.

As part of the update the deprecated webdriver fn getInnerHtml has been replaced with getAttribute('innerHTML')
2016-07-22 21:28:59 +02:00
Peter Bacon Darwin 228754fe96 docs(CHANGELOG.md): add release notes for v1.5.8 2016-07-22 16:04:08 +01:00
Georgios Kalpakas 83bc247967 docs(CHANGELOG.md): add release notes for v1.2.30 2016-07-21 12:37:47 +03:00
Georgios Kalpakas 482a3ae9f9 test($anchorScroll): add e2e tests
Fixes #9535
Closes #9583

Closes #14932
2016-07-20 11:37:43 +03:00
Brad ce40d5cbda docs($httpParamSerializer): fix typo (remove superfluous quote)
Closes #14934
2016-07-20 10:47:49 +03:00
Georgios Kalpakas 5dfb328c94 refactor(test/e2e): make file/directory names consistent 2016-07-19 21:42:24 +03:00
Georgios Kalpakas 5f6949fdae fix($resource): fulfill promise with the correct value on error
This fixes a regression introduced with 71cf28c. See #14837 for more info.

Fixes #14837
Closes #14839
2016-07-18 14:55:14 +01:00
Georgios Kalpakas 4487cffb13 test($resource): add some tests wrt handling response errors
The test currently fail on master, but should pass on 1.5.x.
A subsequent commit will fix the regressions on master.

(This commit should be backportable to 1.5.x.)

Related to #14837.
2016-07-18 14:53:22 +01:00
Georgios Kalpakas c13c666728 feat(ngRoute): allow ngView to be included in an asynchronously loaded template
During its linking phase, `ngView` relies on the info provided in `$route.current` for
instantiating the initial view. `$route.current` is set in the callback of a listener to
`$locationChangeSuccess`, which is registered during the instantiation of the `$route` service.

Thus, it is crucial that the `$route` service is instantiated _before_ the initial
`$locationChangeSuccess` event is fired. Since `ngView` declares `$route` as a dependency, the
service is instantiated in time, if `ngView` is present during the initial load of the page.

Yet, in cases where `ngView` is included in a template that is loaded asynchronously (e.g. in
another directive's template), the directive factory might not be called soon enough for `$route`
to be instantiated before the initial `$locationChangeSuccess` event is fired.

This commit fixes it, by enabling eager instantiation of `$route` (during the initialization phase).
Eager instantiation can be disabled (restoring the old behavior), but is on by default.

Fixes #1213
Closes #14893

BREAKING CHANGE:

In cases where `ngView` was loaded asynchronously, `$route` (and its dependencies; e.g. `$location`)
might also have been instantiated asynchronously. After this change, `$route` (and its dependencies)
will - by default - be instantiated early on.

Although this is not expected to have unwanted side-effects in normal application bebavior, it may
affect your unit tests: When testing a module that (directly or indirectly) depends on `ngRoute`, a
request will be made for the default route's template. If not properly "trained", `$httpBackend`
will complain about this unexpected request.

You can restore the previous behavior (and avoid unexpected requests in tests), by using
`$routeProvider.eagerInstantiationEnabled(false)`.
2016-07-18 13:12:28 +03:00
Georgios Kalpakas 47583d9800 fix($http): avoid Possibly Unhandled Rejection error when the request fails
Calling `promise.finally(...)` creates a new promise. If we don't return this promise, the user
won't be able to attach an error handler to it and thus won't be able to prevent a potential PUR
error.

This commit also improves the test coverage for the increment/decrement `outstandingRequestCount`
fix.

Closes #13869
Closes #14921
2016-07-18 10:09:52 +01:00
Georgios Kalpakas dc7f625f48 refactor($http): clean up code
Closes #14921
2016-07-18 10:09:45 +01:00
Georgios Kalpakas 5db625723b refactor($http): move functions together and order alphabetically
Closes #14921
2016-07-18 10:09:37 +01:00
William Bagayoko 4f6f2bce4a fix($http): properly increment/decrement $browser.outstandingRequestCount
Calling `$http` will not increment `$browser.outstandingRequestCount` until after all (potentially)
asynchronous request interceptors have been processed and will decrement it before any (potentially)
asynchronous response interceptors have been processed.
This can lead to `$browser.notifyWhenNoOutstandingRequests` firing
prematurely, which can be problematic in end-to-end tests.

This commit fixes this, by synchronizing the increment/decrement
operations with `$http`'s internal interceptor promise chain.

Fixes #13782
Closes #13862
Closes #14921

BREAKING CHANGE:

HTTP requests now update the outstanding request count synchronously.
Previously the request count would not have been updated until the
request to the server is actually in flight. Now the request count is
updated before the async interceptor is called.

The new behaviour is correct but it may change the expected behaviour in
a small number of e2e test cases where an async request interceptor is
being used.
2016-07-18 10:09:29 +01:00
Georgios Kalpakas 56d456360b chore(protractor): use directConnect locally to speed up tests
Closes #14919
2016-07-18 09:44:03 +01:00
Georgios Kalpakas 26acedde7c refactor(test/e2e): remove explicit call to waitForAngular()
Protractor automatically calls `waitForAngular()`, before every WebDriver action.

Closes #14920
2016-07-18 09:44:03 +01:00
Georgios Kalpakas fa81df4779 refactor(test/e2e): restore consistency across tests (just because) 2016-07-18 09:39:00 +01:00
John (J5) Palmieri 26dac5784a doc(guide/Animations): point to $animate.pin() to enable animation for elements outside an Angular app
Add a section inside of the ngAnimate documentation to point to $animate.pin().
It was not clear in the documentation why animations were being disabled inside of
modals and popup menus. This documentation explains in what situations elements may
be dynamically placed outside of the application DOM and points to the API documentation
on how to enable animations for these types of elements.

Related #14907
Closes #14918
2016-07-15 18:06:06 +02:00
Martin Staffa cd06cccc7f docs(ngSelected): note that it doesn't interact with ngModel
Closes #14916
Related #14876
2016-07-15 17:49:57 +02:00
Georgios Kalpakas aea62af5b8 docs(guide): fix links to tutorial steps 2016-07-15 10:49:23 +03:00
Peter Bacon Darwin c8a64817d2 style(ngViewSpec): fix missing end of file newline 2016-07-14 21:47:01 +01:00
Peter Bacon Darwin d808631d3a style(ngViewSpec): ensure only one top level describe block 2016-07-14 11:34:28 +01:00
Kate Miháliková 267ee9c892 fix(ngMock): trigger digest in $httpBackend.verifyNoOutstandingRequest()
Firing a digest at the beginning of the verification process, ensures that requests fired
asynchronously - e.g. in the `resolve` handler of a promise as happens with `$http` - will get
detected as well.
Previously, in order to reliably verify that there was no outstanding request, users needed to
manually trigger a digest, before calling `verifyNoOutstandingRequest()`. Failing to do so, could
prevent `verifyNoOutstandingRequest()` from detecting pending requests and cover bugs in application
code.
This is no longer the case, since a digest will always be fired autommatically as part of a call to
`verifyNoOutstandingRequest()`.

Fixes #13506
Closes #13513

BREAKING CHANGE:

Calling `$httpBackend.verifyNoOutstandingRequest()` will trigger a digest. This will ensure that
requests fired asynchronously will also be detected (without the need to manually trigger a digest).
This is not expected to affect the majority of test-suites. Most of the time, a digest is (directly
or indirectly) triggered anyway, before calling `verifyNoOutstandingRequest()`.
In the unlikely case that a test needs to verify the timing of a request with respect to the digest
cycle, you should rely on other means, such as mocking and/or spying.
2016-07-13 21:46:02 +03:00
Michał Gołębiowski 859b1e300c test(jQuery): Run tests with jQuery 3
Closes #14874
2016-07-13 10:08:48 +02:00
Georgios Kalpakas 489224ba85 refactor($animate): avoid unnecessary lookup
Closes #14902
2016-07-12 22:32:07 +03:00
Ronan Connolly 76ca4f4c20 docs(guide/unit-testing): add missing heading
Closes #14901
2016-07-12 18:30:35 +03:00
Steve Berube c253b8e577 docs(guide/animations): use the arguments of enabled() in correct order
Closes #14900
2016-07-12 17:49:32 +03:00
Lioman 914b5c87ff docs(FAQ): fix heading
Add whitespace to H1

PR: (#14896)
2016-07-11 18:22:57 +02:00
Georgios Kalpakas 5fe823948f chore(Jenkins): fix e2e tests on Jenkins
Follow-up to c72e13f and a82a8a5.

Closes #14889
2016-07-11 13:36:14 +03:00
Georgios Kalpakas f8a3faf5c9 docs(guide/module): remove newline in the middle of sentence 2016-07-10 11:46:36 +03:00
Oliver Salzburg c0f0d136f0 docs($http): fix default $http cache name
The name of the cache is the string "$http", not the symbol itself.

Closes #14885
2016-07-09 10:22:36 +03:00
Martin Staffa a82a8a5210 chore(protractor): use jasmine2 as framework 2016-07-07 15:29:25 +02:00
Martin Staffa c72e13fdb6 chore(package.json): update jasmine-reporters to 2.2.0 2016-07-07 15:29:06 +02:00
Martin Staffa e8c2e11975 fix(select): don't register options when select has no ngModel
When option elements use ngValue, value or interpolated text to set
the option value, i.e. when the parent select doesn't have an ngModel,
there is no necessity in registering the options with the select controller.

The registration was usually not a problem, as the ngModelController is set to a noop controller,
so that all further interactions are aborted ($render etc)

However, since f02b707 ngValue sets a hashed value inside the option value
(to support arbitrary value types). This can cause issues with tests that expect unhashed values.
The issue was found in angular-material, which uses select + ngValue to populate mdSelect.

POSSIBLE BREAKING CHANGE:

Option elements will no longer set their value attribute from their text value when their select
element has no ngModel associated. Setting the value is only needed for the select directive to
match model values and options. If no ngModel is present, the select directive doesn't need it.

This should not affect many applications as the behavior was undocumented and not part of a public
API. It also has no effect on the usual HTML5 behavior that sets the select value to the option text
if the option does not provide a value attribute.

PR (#14864)
2016-07-06 15:04:20 +02:00
Lee Adcock ad41baa1fd fix(ngAria): bind to keydown instead of keypress in ngClick
Previously, `ngAria` would provide keyboard support for non-native buttons (via `ngClick`), by
binding the `ngClick` handler to the `keypress` event. In an attempt to better emulate the behavior
of native buttons, `ngAria` will now bind to the `keydown` event (instead of `keypress`).

The configuration flag for this feature has been renamed from `bindKeypress` to `bindKeydown`, to
closer describe the underlying behavior.

Fixes #14063
Closes #14065

BREAKING CHANGE:

If you were explicitly setting the value of the `bindKeypress` flag, you need to change your code to
use `bindKeydown` instead.

Before: `$ariaProvider.config({bindKeypress: xyz})`
After: `$ariaProvider.config({bindKeydown: xyz})`

**Note:**
If the element already has any of the `ngKeydown`/`ngKeyup`/`ngKeypress` directives, `ngAria` will
_not_ bind to the `keydown` event, since it assumes that the developer has already taken care of
keyboard interaction for that element.

Although it is not expected to affect many applications, it might be desirable to keep the previous
behavior of binding to the `keypress` event instead of the `keydown`. In that case, you need to
manually use the `ngKeypress` directive (in addition to `ngClick`).

Before:

```html
<div ng-click="onClick()">
  I respond to `click` and `keypress` (not `keydown`)
</div>
```

After:

```html
<div ng-click="onClick()" ng-keypress="onClick()">
  I respond to `click` and `keypress` (not `keydown`)
</div>
<!-- OR -->
<div ng-click="onClick()">
  I respond to `click` and `keydown` (not `keypress`)
</div>
```

Finally, it is possible that this change affects your unit or end-to-end tests. If you are currently
expecting your custom buttons to automatically respond to the `keypress` event (due to `ngAria`),
you need to change the tests to trigger `keydown` events instead.
2016-07-06 15:54:49 +03:00
Georgios Kalpakas 30436957ed docs(guide/component): improve tests
Fixes #14739
2016-07-06 13:39:31 +03:00
Georgios Kalpakas acb545ec3e fix($resource): pass all extra, owned properties as params
Previously, a property would not be passed as query param, if `Object.prototype` had a property with
the same name.

Fixes #14866
Closes #14867

BREAKING CHANGE:

All owned properties of the `params` object that are not used to replace URL params, will be passed
to `$http` as `config.params` (to be used as query parameters in the URL), even if
`Object.prototype` has a property with same name. E.g.:

Before:

```js
var Foo = $resource('/foo/:id');
Foo.get({id: 42, bar: 'baz', toString: 'hmm'});
    // URL: /foo/42?bar=baz
    // Note that `toString` is _not_ included in the query,
    // because `Object.prototype.toString` is defined :(
```

After:

```js
var Foo = $resource('/foo/:id');
Foo.get({id: 42, bar: 'baz', toString: 'hmm'});
    // URL: /foo/42?bar=baz&toString=hmm
    // Note that `toString` _is_ included in the query, as expected :)
```
2016-07-06 13:00:35 +03:00
Jack c4da2f0193 docs(guide/directive): remove confusing best practice
Prior to this point, the docs do not mention returning a postLink function, and all the examples use
the definition object form. So, this message is confusing to new readers who may misinterpret
"returning a function" as returning the factory function mentioned in the previous section.

Since this page is only a "gentle introduction" to directives, and using the definition object is a
best practice, it is best to just remove the message altogether.

Closes #14871
2016-07-06 12:06:36 +03:00
Georgios Kalpakas b928043c3b docs(tutorial): fix typo in images (phoneList --> phoneDetail)
Fixes #14858

Closes #14868
2016-07-05 21:49:18 +03:00
Georgios Kalpakas a2c1675ff9 docs(guide/interpolation): add known issue (do not change the content of interpolated strings)
Closes #12813

Closes #14825
2016-07-05 00:08:56 +03:00
Peter Bacon Darwin 951acb1287 chore(package.json): update dgeni-packages dependency to 0.14.0 2016-07-04 21:31:07 +01:00
Igor Zhukov 6280ec89e3 fix(copy): fix handling of typed subarrays
Previously, it would return a copy of the whole original typed array, not its slice.
Now, the `byteOffset` and `length` are also preserved.

Fixes #14842

Closes #14845
2016-07-04 23:21:22 +03:00
franciscovelez 6a219ad8db docs(guide/Expressions): link to English MDN
It is better to link to the English version of MDN rather than German version

PR (#14863)
2016-07-04 15:36:41 +02:00
Georgios Kalpakas 14519f84f5 docs(copy): mention ignoring non-enumerable properties
This also improves the example a bit:
- better code formatting
- initialization of `form` to an empty object
- avoid using `email`, which doesn't get coppied when invalid (and might confuse users)

Fixes #14853
2016-07-04 10:08:44 +03:00
David Rodenas Pico 3aedb1a70d perf($compile): wrap try/catch of collect comment directives into a function to avoid V8 deopt
Closes #14848
2016-07-04 08:55:00 +03:00
jfisher446 dcf8aab85d docs(tutorial/step_04): fix syntactic error (add missing 'a')
Closes #14860
2016-07-04 08:41:07 +03:00
Peter Bacon Darwin 7b50f498eb chore(benchpress): add benchmarks for select with ngValue 2016-07-01 13:00:56 +02:00
Martin Staffa ba36bde673 perf(select): don't prepend unknown option if already prepended 2016-07-01 13:00:56 +02:00
Martin Staffa 47c15fbcc1 fix(select): handle model updates when options are manipulated
These rules follow ngOptions behavior:

- when an option that is currently selected, is removed or its value changes, the model
is set to null.
- when an an option is added or its value changes to match the currently selected model,
this option is selected.
- when an option is disabled, the model is set to null.
- when the model value changes to a value that matches a disabled option,
this option is selected (analogue to ngOptions)
2016-07-01 13:00:56 +02:00
Martin Staffa f02b707b5e feat(select): support values of any type added with ngValue
select elements with ngModel will now set ngModel to option values added by ngValue.
This allows setting values of any type (not only strings) without the use of ngOptions.

Interpolations inside attributes can only be strings, but the ngValue directive uses attrs.$set,
which does not have any type restriction. Any $observe on the value attribute will therefore receive
the original value (result of ngValue expression). However, when a user selects an option, the browser
sets the select value to the actual option's value attribute, which is still always a string.
For that reason, when options are added by ngValue, we set the hashed value of the original value in
the value attribute and store the actual value in an extra map. When the select value changes, we
read access the actual value via the hashed select value.

Since we only use a hashed value for ngValue, we will have extra checks for the hashed values:
- when options are read, for both single and multiple select
- when options are written, for multiple select

I don't expect this to have a performance impact, but it should be kept in mind.

Closes #9842
Closes #6297

BREAKING CHANGE:

`<option>` elements added to `<select ng-model>` via `ngValue` now add their values in hash form, i.e.
`<option ng-value="myString">` becomes `<option ng-value="myString" value="string:myString">`.

This is done to support binding options with values of any type to selects.

This should rarely affect applications, as the values of options are usually not relevant to the
application logic, but it's possible that option values are checked in tests.
2016-07-01 13:00:56 +02:00
mmuppa 47fbbabe0b docs(misc/Develop): using https:// works more widely than git@
Closes #14838
2016-07-01 11:17:50 +01:00
Peter Bacon Darwin 20051e5c59 docs(guide): tweaks to the index and external resources guides
Closes #14843
2016-07-01 11:06:18 +01:00
Martin Staffa 708e3d97f3 docs(guide): create new page for external resources
The official and external resources  have been split into two different guide sections. Official stays at the index, external gets its own page.

The external resources have also been reorganized and updated, but
I haven't checked if all material is still relevant.
2016-07-01 09:24:59 +01:00
Jeff Andrews f7405e3b98 fix(ngMocks): allow ErrorAddingDeclarationLocationStack to be recognized as an Error
Change `ErrorAddingDeclarationLocationStack`'s prototype so test frameworks (such as Jasmine 2.x)
are able to recognize it as `Error`.

Fixes #13821

Closes #14344
2016-06-29 13:41:57 +03:00
Martin Staffa 7ce7e09c51 test(input): ensure Date objects work for min/max in date input types
Tests that
- interpolated Date objects work for min/max
- Date objects work for ng-min/ng-max
2016-06-28 11:10:18 +02:00
Martin Staffa fa80a61a05 fix(ngBind): use same string representation as $interpolate
Fixes #11716

BREAKING CHANGE:

`ngBind` now uses the same logic as $interpolate (i.e. {{myString}}) when
binding, which means values other than strings are now transformed as following:
- null / undefined become empty string
- with an object's custom toString() function, except if the object is a Date, Array, or Number
- otherwise with JSON.stringify

Previously, ngBind would use always use toString().

The following examples show the different output:
```js
$scope.myPlainObject = {a: 1, b: 2};
$scope.myCustomObject = {a: 1, b: 2, toString: function() {return 'a+b';}};
```

Plain Object:
```html
<!-- Before: -->
<span ng-bind="myPlainObject">[object Object]</span>

<!-- After: -->
<span ng-bind="myPlainObject">{"a":1,"b":2}</span>
```

Object with custom toString():

```html
<!-- Before: -->
<span ng-bind="myCustomObject">[object Object]</span>

<!-- After: -->
<span ng-bind="myCustomObject">a+b</span>
```

If you want the output of `toString()`, you can use it directly on the value in ngBind:

```html
<span ng-bind="myObject.toString()">[object Object]</span>
```
2016-06-28 11:10:17 +02:00
Martin Staffa a5fd2e4c03 feat($interpolate): use custom toString() function if present
Except on Numbers, Dates and Arrays.

Thanks to @danielkrainas for the initial implementation of this feature.

This behavior is consistent with implementations found in other languages such as Ruby, Python,
and CoffeeScript.
http://rubymonk.com/learning/books/1-ruby-primer/chapters/5-strings/lessons/31-string-basics
https://docs.python.org/2/library/stdtypes.html#string-formatting-operations
http://coffeescriptcookbook.com/chapters/strings/interpolation

The commit also exposes a private $$stringify method on the angular global, so that ngMessageFormat
can use the same logic without duplicating it.

Fixes #7317
Closes #8350
Fixes #11406

BREAKING CHANGE:

When converting values to strings, interpolation now uses a custom toString() function on objects
that are not Number, Array or Date (custom means that the `toString` function is not the same as
`Object.prototype.toString`). Otherwise, interpolation uses JSON.stringify() as usual.

Should you have a custom toString() function but still want the output of JSON.stringify(),
migrate as shown in the following examples:

Before:

```html
<span>{{myObject}}</span>
```

After - use the `json` filter to stringify the object:

```html
<span>{{myObject | json}}</span>
```
2016-06-28 11:08:47 +02:00
atenhar 3cda897283 docs(tutorial/step_03): fix grammar and typos
Closes #14834
2016-06-28 09:38:35 +03:00
Nicholas Serra 2456ab63a6 fix($resource): add semicolon to whitelist of delimiters to unencode in URL params
The unencoding happens in methods `encodeUriQuery`/`encodeUriSegment`. Both core and `ngResource`
used to have identical implementations of these methods. Due to this duplication, the
implementations got out-of-sync.

Specifically, the semicolon has been added to the whitelist of unencoded characters in core since
`v1.3.0-beta.18`. See 3625803 for more info.

This commit fixes the problem and the underlying cause by reusing core's methods in `ngResource`.
(The methods are exposed as private helpers on `window.angular`.)

Closes #14309
2016-06-27 17:42:42 +03:00
Georgios Kalpakas 7a191eb400 fix($jsonpCallbacks): do not overwrite callbacks added by other apps
Closes #14824
2016-06-27 14:46:17 +03:00
Georgios Kalpakas c855c3fb9f fix($injector): fix class detection RegExp
Mentioned in https://github.com/angular/angular.js/pull/14531#discussion_r61410683.

Closes #14533
2016-06-27 13:28:32 +03:00
Georgios Kalpakas f6c3b35745 test($resource): make test for function as param more explicit
Related to aa8d783.

Closes #14820
2016-06-27 11:50:59 +03:00
Georgios Kalpakas 6050f0be30 fix($animate): do not get affected by custom, enumerable properties on Object.prototype
Fixes #14804

Closes #14830
2016-06-27 11:44:37 +03:00
Liran Tal 56a9eab849 docs(guide/filter): add link to list of built-in filters
Closes #14828
2016-06-26 20:26:43 +03:00
Deplay 2e0e77ee80 refactor(jqLite): remove unused code in jqLiteBuildFragment()
Closes #14822
2016-06-25 22:08:05 +03:00
GARCIA Guillaume fb3bbc9a00 docs(*): correct bower version separator (@ --> #)
Closes #14819
2016-06-25 21:54:34 +03:00
Martin Staffa c434bde109 docs(ngReadonly): note input type restrictions
Closes #14816
2016-06-23 12:00:54 +02:00
Chirayu Krishnappa aa8d783cff feat($resource): pass the resource to a dynamic param functions
Closes #4899
2016-06-22 12:11:14 +01:00
Martin Staffa 22ec93be8f fix(ngAnimate): allow removal of class that is scheduled to be added with requestAnimationFrame
Also affects the reverse case, adding a class that is scheduled to be removed with rAF.

The following case can happen when ngClass updates an element's classes in very quick order in the following way:

- First animation adds class "a"
- A digest passes, but "a" is not yet added to the element
- Second animation adds class "b"
- No digest passes, and "a" is still not added to the element,
  because requestAnimationFrame hasn't been flushed yet
- Third animation removes class "a"
- the third animation gets merged into the second animation

Before this change:

- Because the element doesn't have class "a" yet, ngAnimate
resolves that it cannot remove class "a". However,
the first animation is still running, and finally adds "a"

After this change:

- ngAnimate reacts to the temporary class "add-a", which indicates
that "a" is about to be added and decides that "a" can be removed
after all.

This is a very rare case where setting the element's class
is not fast enough, and subsequent animations operate on incorrect assumptions.

"In the wild", this is caused by rapidly updating ngClass,
which uses inidvidual addClass and removeClass calls when both operations happen in a single digest.

Fixes #14582
PR  (#14760)
2016-06-22 12:35:24 +02:00
Peter Bacon Darwin 99223a0278 docs($http): fix a dangling link 2016-06-22 11:18:35 +01:00
Peter Bacon Darwin b94626cb9b docs($compile): reorganize the life-cycle hooks docs
Closes #14811
2016-06-22 11:18:35 +01:00
Peter Bacon Darwin e62e59f281 docs($compile): add additional runnable examples for the $doCheck hook
Closes #14811
2016-06-22 11:18:28 +01:00
Peter Bacon Darwin 4c662e17a1 fix($compile): ensure $doCheck hooks can be defined in the controller constructor
Closes #14811
2016-06-22 11:18:16 +01:00
Zach Bjornson e235f20cc1 feat($compile): backport $doCheck
Backuport ngDoCheck from Angular 2.

Closes #14656
2016-06-22 11:17:48 +01:00
Peter Bacon Darwin 78e1ba1ef9 refact($http): use the $jsonpCallbacks service
Use the built-in service to handling callbacks to `$http.jsonp` requests.

Closes #3073
Closes #14795
2016-06-21 19:06:15 +01:00
Peter Bacon Darwin 83b5ddb941 feat($jsonpCallbacks): new service to abstract how JSONP callbacks are handled
You can now override this service if you have specific requirements about
the behaviour and formatting of the JSON_CALLBACK that is sent to the server
for `$http.jsonp` requests.

Closes #14795
2016-06-21 19:06:15 +01:00
Georgios Kalpakas d406a15e8c fix(modules): allow modules to be loaded in any order when using angular-loader
Some modules used to assume that the angular helpers would always be available when their script was
executed. This could be a problem when using `angular-loader` and the module file happened to get
loaded before the core `angular.js` file.
This commit fixes the issue by delaying the access to angular helpers, until they are guaranteed to
be available.

Affected modules:
- `ngAnimate`
- `ngMessageFormat`
- `ngMessages`
- `ngRoute`
- `ngSanitize`

Fixes #9140

Closes #14794
2016-06-17 23:56:14 +03:00
Georgios Kalpakas 4585b939ea docs(misc/downloading): mention ngMessageFormat 2016-06-17 20:44:12 +03:00
Peter Bacon Darwin 41f3269bfb fix(ngTransclude): ensure that fallback content is compiled and linked correctly
Closes #14787
2016-06-17 10:26:16 +01:00
Yihang Ho 0ba14e1853 feat($q): implement $q.race
Implement $q.race. $q.race takes in an array or hash of promises and
returns a promise that resolves or rejects as soon as one of those promises
resolves or rejects, with the value or reason from that promise.

Closes #12929
Closes #14757
2016-06-17 10:20:44 +01:00
Abdulkader d9b42ddbbd feat($swipe): add pointer support
Add pointer events to $swipe to support IE11 on touch devices

Closes #14061
Closes #14791
2016-06-17 09:51:09 +01:00
Georgios Kalpakas 7ab00f4c62 docs($resource): clarify how a @-prefix param is used 2016-06-17 00:44:11 +03:00
Georgios Kalpakas 02aef572a5 docs(angular.mock.dump): remove incorrect statement
Fixes #14790
2016-06-17 00:25:50 +03:00
Roman Rodych 56b9b209ca refactor(input[number]): remove redandant second argument to parseFloat()
Closes #14793
2016-06-16 22:15:33 +03:00
Iain Apreotesei ab526d5a52 style(indexPage.template.html): change bad punctuation in documentation footer
PR  (#14792)
2016-06-16 16:52:54 +02:00
Martin Staffa fd6dc0b7d4 chore(changelog.js): don't add empty breaking change section 2016-06-16 14:38:27 +02:00
Georgios Kalpakas 2b182eb020 feat(filterFilter): allow overwriting the special $ property name
Previously, the special property name that would match against any
property was hard-coded to `$`.
With this commit, the user can specify an arbitrary property name,
by passing a 4th argument to `filterFilter()`. E.g.:

```js
var items = [{foo: 'bar'}, {baz: 'qux'}];
var expr  =  {'%': 'bar'};

console.log(filterFilter(items, expr, null, '%'));   // [{foo: 'bar'}]
```

Fixes #13313
PR (#13356)
2016-06-16 14:09:49 +02:00
Georgios Kalpakas ff5f645b00 docs($interpolate): fix heading 2016-06-15 21:43:38 +03:00
Martin Staffa 6bc81ae6ef fix(ngOptions): don't duplicate groups with falsy values
Previously, ngOptions would fail to remove optgroups with falsy values when the options were changed / removed.

Related #14781 
PR (#14784)
2016-06-15 19:39:16 +02:00
Georgios Kalpakas bb4cd4a5ce docs(CHANGELOG.md): move entry from "Features" to "Bugs" 2016-06-15 20:06:03 +03:00
Georgios Kalpakas 458ac0b44c docs(CHANGELOG.md): add release notes for v1.5.7 2016-06-15 19:14:27 +03:00
Georgios Kalpakas d16b60e0d3 docs(CHANGELOG.md): add release notes for v1.4.12 2016-06-15 19:14:16 +03:00
Martin Staffa 40b657b619 docs(guide/filters): clarify when filters are executed
Closes #14590
PR  (#14758)
2016-06-15 16:55:22 +02:00
Martin Staffa 356e6b18d6 docs($compile): add link to transcludeFn description
Closes #14764
2016-06-15 15:39:35 +02:00
Martin Staffa 915e7a109c chore(version-info): make online build compatible with Windows
Since we cannot write to dev/null on Windows, don't write to a file at all, but simply use stdout and extract the output from --write-out from the process response. Credit to @petebacondarwin for the idea.

The commit also avoids a premature error when no cdnVersion could be found online, and improves the log wrt the origin of the versions.

PR (#14780)
2016-06-15 15:12:30 +02:00
Daniel Herman 2adaff083f fix(ngTransclude): only compile fallback content if necessary
If the instance of the directive does provide transcluded content, then the fallback
content should not be compiled and linked as it will never be used.

If the instance of the directive does not provide transcluded content, then the
transcluded scope that was created for this non-existent content is never used,
so it should be destroy in order to clean up unwanted memory use and digests.

Fixes #14768
Fixes #14765
Closes #14775
2016-06-15 12:20:18 +01:00
Peter Bacon Darwin 857d78d17d chore(version-info): add offline-build support
Previously it was slow and problematic to run builds if you were not connected
to the internet because the build scripts make requests to github and the
Google CDN to find out version information.

You can now disable these requests by setting the NG1_BUILD_NO_REMOTE_VERSION_REQUESTS
environment variable to a non-empty value

Closes #14769
2016-06-15 10:30:52 +01:00
Peter Bacon Darwin 16d915c045 chore(app.scenario): test docs app against production libraries
We have had issues where the docs application has gone down because
our build included invalid URLs to the production angular libraries.

This change runs a subset of the docs e2e tests directly against these
production libraries to ensure that they are accessible. If not then these
tests will fail and the CI build will abort, preventing the docs app from
being updated.

Closes #14769
2016-06-15 10:30:52 +01:00
Peter Bacon Darwin 29f19f91fb chore(Gruntfile): kill the build if the CDN version was not found
Closes #14769
2016-06-15 10:30:52 +01:00
Martin Staffa 02eaabc1c7 docs(changelog.md): add 1.5.0-beta.0 entry
This was a preparation release for the 1.5.x branch,
which only contains one fix over the previous 1.4.6
release.
2016-06-15 11:18:14 +02:00
Peter Bacon Darwin 8cd984866b docs(ngMessageFormat): fix e2e test in example 2016-06-14 19:19:31 +01:00
Peter Bacon Darwin b7f786e8a2 style(ngMessageFormat): fix jscs whitespace error 2016-06-14 18:51:36 +01:00
Martin Staffa 9575667946 chore(docsApp): don't display module components if none exist
Some modules (ngMessageFormat, ngParseExt) don't have their own api surface
because they integrate with core services ($interpolate and $parse respectively).

Closes #14770
2016-06-14 18:32:48 +01:00
Martin Staffa 9a7431c71b docs(ngMessageFormat): move docs for $$messageFormat to module namespace.
This is a private service that should not be documented.
The docs have been moved to the ngMessageFormat module namespace.

Closes #14770
2016-06-14 18:32:36 +01:00
Martin Staffa a82a62e5a6 docs(ngMessageFormat): add more examples
Closes #14770
2016-06-14 18:32:25 +01:00
Georgios Kalpakas 9686f3a241 revert: "chore(version-info): disable remote requests when offline"
This reverts commit 6a134605f1.
The connectivity status is not always detected correctly. Skipping version info related tasks, broke
the deployment of the API docs.

Related #https://github.com/angular/angularjs.org/issues/202
2016-06-13 20:44:51 +03:00
Wesley Cho 4d350de038 docs($q): add note about optional arguments for promise.then()
- Add note about optional arguments in the promise.then api

Closes #8562
PR (#14754)
2016-06-13 17:19:39 +02:00
Wesley Cho 116e1d7d17 docs(guide): add notes about using ngAttr for IE
- Add note about using the value attribute for the progress tag with IE in the IE compat / interpolation guide
- Add note about placeholder attribute in textarea to the ie compat guide

Closes #7218
PR (#14753)
2016-06-13 17:18:35 +02:00
Pete Bacon Darwin 6a134605f1 chore(version-info): disable remote requests when offline
When the internet is not accessible build scripts are unnecessarily slow
because of failed attempts to download git tag and CDN version information
from remote servers.

This commit does a synchronous check of internet connectivity before attempting
any remote requests.

Closes #14759
2016-06-13 15:57:53 +01:00
Geoffrey Bauduin 3ddf2f6f6f docs($exceptionHandler): add missing end bracket in example
PR  (#14756)
2016-06-13 11:37:47 +02:00
Wesley Cho 9f68b0e29d docs(ngOpen): add note about browser compatibility
- Add note about browser compatibility and recommend ng-show/ng-hide

Closes ##7337
PR (#14752)
2016-06-13 11:21:03 +02:00
Peter Bacon Darwin 7551b8975a fix(ngMock/$httpBackend): fail if a url is provided but is undefined
While the `url` parameter is optional for `$httpBackend.when`,
`$httpBackend.expect` and related shortcut methods, it should not have the
value of `undefined` if it has been provided.

This change ensures that an error is thrown in those cases.

Closes #8442
Closes #8462
Closes #10934
Closes #12777

BREAKING CHANGE

It is no longer valid to explicitly pass `undefined` as the `url` argument
to any of the `$httpBackend.when...()` and `$httpBackend.expect...()`
methods.

While this argument is optional, it must have a defined value if it is
provided.

Previously passing an explicit `undefined` value was ignored but this
lead to invalid tests passing unexpectedly.
2016-06-12 20:23:38 +01:00
Wesley Cho f467dc3dd5 feat(limitTo): add support for array-like objects
Fixes #14657

Closes #14694
2016-06-10 21:13:04 +03:00
Martin Staffa 3360b44be6 fix(ngMessages): create new scope for ngMessage, clean it up correctly
Previously, ngMessage elements used the same scope as ngMessages. When ngMessage
has interpolation in the textContent, then removing the message would not remove
the watcher from the scope - it would only be removed when the whole ngMessages
element was removed.

This commit changes the ngMessage transclude function to create a new child scope
instead, which can be destroyed safely when the message element is removed and
the message is detached

Fixes #14307
PR (#14308)
2016-06-10 14:45:36 +02:00
Georgios Kalpakas e9865654b3 feat($route): implement resolveRedirectTo
`resolveRedirectTo` can be set to a function that will (eventually) return the new URL to redirect
to. The function supports dependency injection and should return the new URL either as a string or
as a promise that will be resolved to a string.

If the `resolveRedirectTo` function returns `undefined` or returns a promise that gets resolved to
`undefined`, no redirection will take place and the current route will be processed normally.

If the `resolveRedirectTo` function throws an error or the returned promise gets rejected, no
further processing will take place (e.g. no template fetched, no `resolve` functions run, no
controller instantiated) and a `$routeChangeError` will be broadcasted.

`redirectTo` takes precedence over `resolveRedirectTo`, so specifying both on the same route
definition, will cause the latter to be ignored.

Fixes #5150

Closes #14695

BREAKING CHANGE:

Previously, if `redirectTo` was a function that threw an Error, execution was aborted without firing
a `$routeChangeError` event.
Now, if a `redirectTo` function throws an Error, a `$routeChangeError` event will be fired.
2016-06-10 15:10:50 +03:00
CarlosMiguelDesarrollo a84e3e7270 chore(ngAnimate): delete an unused conditional statement
Delete a conditional statement that appears to have only been for debugging.
It is marked with a TODO tag to be deleted.

Closes #14282
2016-06-10 12:27:07 +01:00
Georgios Kalpakas 53ab8bcde1 fix($routeProvider): do not deep-copy route definition objects
Deep-copying route definition objects can break specific custom implementations of `$sce` (used to
trust a `templateUrl` as RESOURCE_URL). The purpose of copying route definition objects was to guard
against the user's modifying the route definition object after route registration, while still
capturing inherited properties.
As suggested by @IgorMinar in https://github.com/angular/angular.js/pull/14699#discussion_r66480539,
we can achieve both _and_ support custom `$sce` implementations, by shallow-copying instead.

This is an alternative implementation for #14699, which avoids the breaking change.

Fixes #14478
Closes #14699

Closes #14750
2016-06-10 14:02:59 +03:00
Raphael Jamet 04cad41d26 fix($compile): secure link[href] as a RESOURCE_URLs in $sce.
User-controlled imports or stylesheets can run script in your origin,
which warrants that we require that they are safe `RESOURCE_URL`s.

Closes #14687

BREAKING CHANGE

`link[href]` attributes are now protected via `$sce`, which prevents interpolated
values that fail the `RESOURCE_URL` context tests from being used in interpolation.

For example if the application is running at `https://docs.angularjs.org` then the
following will fail:

```
<link href="{{ 'http://mydomain.org/unsafe.css' }}" rel="stylesheet">
```

By default, `RESOURCE_URL` safe URLs are only allowed from the same domain and protocol
as the application document.

To use URLs from other domains and/or protocols, you may either whitelist them or
wrap it into a trusted value by calling `$sce.trustAsResourceUrl(url)`.
2016-06-10 11:14:14 +01:00
Martin Staffa 3b4bfa1771 refactor(ngMock): extract browserTrigger from ngScenario
`ngScenario` is deprecated, and we expect to remove it from the project in 1.6,
but we use the `browserTrigger` helper throughout our unit tests.

So in preparation for removing `ngScenario` we are relocating `browserTrigger`
to the `ngMock` folder.

Although many people are using browserTrigger in their own application testing
we are still not yet ready to make this a public API; so developers use
this helper at their own risk.

Closes #14718

BREAKING CHANGE

Although it is not a public API, many developers are using `browserTrigger`
in their own application testing. We have now moved this helper from
`ngScenario/browserTrigger.js` to `ngMock/browserTrigger.js`.
2016-06-10 10:52:37 +01:00
mirabilos f3f5cf72ee fix(input[email]): improve email address validation
**Limit size of local-part and total path size in eMail addresses**

RFC 5321 §4.5.3.1.1 ⇒ local-part can have up to 64 octets
RFC 5321 §4.5.3.1.3 ⇒ path “including the punctuation and
element separators” can have up to 256 octets
RFC 5321 §4.1.2 specifies path as ‘<’ + mailbox¹ + ‘>’ in
the best case, leaving us 254 octets

The limitation of the total path size to 254 octets leaves
at most 252 octets (one local-part, one ‘@’) for the domain,
which means we don’t need to explicitly check the domain
size any more (removing the assertion after the ‘@’).

① RFC 821/5321 “mailbox” is the same as RFC 822 “addr-spec”

**Optimise eMail address regex for speed**

There is no need to make it case-insensitive; the local-part
already catches the entire range, and the host part is easily
done. Furthermore, this makes the regex locale-independent,
avoiding issues with e.g. turkish case conversions.

cf. http://www.mirbsd.org/cvs.cgi/contrib/hosted/tg/mailfrom.php?rev=HEAD

**Limit eMail address total host part length**

RFC 1035 §2.3.4 imposes a maximum length for any DNS object;
RFC 5321 §2.3.5 references this (and requires FQDNs, but there
have been cases where a TLD had an MX RR and thus eMail addresses
like “localpart@tld” are valid).

Credits: Natureshadow <d.george@tarent.de>

**Limit eMail address individual host part length**

A “label” (each of the things between the dots (‘.’) after the ‘@’ in
the eMail address) MUST NOT be longer than 63 characters.

cf. http://www.mirbsd.org/cvs.cgi/contrib/hosted/tg/mailfrom.php?rev=HEAD
and RFC 1035 §2.3.4

**Fix eMail address local-part validation**

A period (‘.’) may not begin or end a local-part

cf. http://www.mirbsd.org/cvs.cgi/contrib/hosted/tg/mailfrom.php?rev=HEAD
and RFC 822 / 5321

Closes #14719
2016-06-10 10:45:54 +01:00
Georgios Kalpakas 2274dc7bb7 docs(misc/downloading): update content - include missing modules
Closes #14746
2016-06-10 10:41:09 +01:00
Martin Staffa f82e135aa0 refactor(ngList): access ngList attribute directly
The original way is not necessary since $compile doesn't remove
white-space anymore
2016-06-09 22:59:59 +02:00
Lucas Galfaso 47724baffe feat(input[radio]): allow ng-trim to work for input[type=radio]
Allow input[type=radio] elements to specify ng-trim.

Closes: #12091
Fixes: #11859
2016-06-09 22:59:58 +02:00
Martin Staffa 305ba1a3fb fix($compile): don't add leading white-space in attributes for a specific merge case
If the replaced element had an attribute with an empty ("") value, merging the attribute from
the template would result in a leading white-space.
2016-06-09 22:59:56 +02:00
Siddique Hameed 97bbf86a19 fix($compile): don't trim white-space in attributes
This allows developers to use white-space in their attributes, for example as value for
input[type=radio], as a separator in ngList, or as a value in any custom directive binding.
It's also consistent with the HTML spec, which allows white-space in attributes, and consistent
with Angular2, which also allows white-space in attributes.

Fixes #5513
Fixes #14539
Closes #5597

BREAKING CHANGE:

White-space in attributes is no longer trimmed automatically. This includes leading and trailing
white-space, and attributes that are purely white-space.

To migrate, attributes that require trimming must now be trimmed manually.

A common cases where stray white-space can cause problems is when
attribute values are compared, for example in an $observer:

Before:
```
$attrs.$observe('myAttr', function(newVal) {
  if (newVal === 'false') ...
});
```

To migrate, the attribute value should be trimmed manually:
```
$attrs.$observe('myAttr', function(newVal) {
  if (newVal.trim() === 'false') ...
});
```

Note that `$parse` trims expressions automatically, so attributes with expressions (e.g. directive
bindings) are unlikely to be affected by stray white-space.
2016-06-09 22:56:31 +02:00
Martin Staffa 3ba29c464d fix($compile): don't add merged attributes twice to $attrs
In replace directives, attribute values from the template are added twice
to the replaced element when both the replaced element and the template
element have the attribute. This does not affect the DOM, as it normalizes
duplicate values. The values are however duplicated in the $attrs object
that is available to directive link functions.

Fixes #8159
Closes #14737
2016-06-09 16:19:34 +01:00
J. Roberto Vidal 78a23ccea2 docs($resource): document Resource#toJSON
Document the `toJSON` method of `Resource` instances as part of its public API.

See #14637
Closes #14725
2016-06-09 16:00:41 +01:00
Stepan Suvorov 186bd0df0e docs(misc/downloading): update Angular version in example
Closes #14741
2016-06-09 11:06:11 +03:00
Stepan Suvorov 38242e99f1 updated version of angular for script src 2016-06-09 11:05:34 +03:00
Georgios Kalpakas f3377da6a7 feat(ngMessagesInclude): don't break on empty (or whitespace-only) templates
Fixes #12941

Closes #14726
2016-06-07 23:14:51 +03:00
Georgios Kalpakas 8fcf5f9aa1 style(ngMessages): fix indentation 2016-06-07 23:14:51 +03:00
mirabilos 4969548e1d docs(guide/Security): warn about $http.jsonp()
Warn users about security issues with JSONP that are *not* mitigated by AngularJS

Closes #14727
2016-06-07 18:34:11 +01:00
Stephen Fluin 418fb9ccd1 docs(guide/Component Router): improving comms 2016-06-07 16:31:55 +01:00
Martin Staffa 2f618459b2 docs(changelog, guide/migration): mention rare BC for ngInclude
See https://github.com/angular/angular.js/issues/13555#issuecomment-165118890
for detailed explanation.

Closes #13555
2016-06-07 10:43:21 +02:00
Georgios Kalpakas 297a7914ab style(ngMocks): remove unnecessary jsHint comment 2016-06-07 11:17:20 +03:00
Georgios Kalpakas 96266b9d9e fix(ngMock#$controller): properly assign bindings to all types of controllers (e.g. class-based)
The decorated version of `$controller` is able to assign bindings to a controller instance prior to
instantiation, emulating the behavior of `$compile` with directive controllers.

There are cases, that the actual controller instance is different than the pre-populated one (e.g.
when the controller constructor function returns a value or when the controller is an ES2015 Class).
While `$compile` accounts for such situation, by re-asigning the bindings after the controller has
been instantiated, `ngMock`'s `$controller` didn't.

This commit fixes it, by re-applying the bindings if the actual controller instance is different
than the original one (similar to how `$compile` would do it).

Fixes #14437

Closes #14439
2016-06-07 11:03:58 +03:00
Georgios Kalpakas 48c8b230cb feat(orderBy): add support for custom comparators
Add an optional, 4th argument (`comparator`) for specifying a custom comparator function, used to
compare the values returned by the predicates. Omitting the argument, falls back to the default,
built-in comparator. The 3rd argument (`reverse`) can still be used for controlling the sorting
order (i.e. ascending/descending).

Additionally, the documentation has been expanded to cover the algorithm used by the built-in
comparator and a few more unit and e2e tests (unrelated to the change) have been added.

Helps with #12572 (maybe this is as close as we want to get).

Fixes #13238
Fixes #14455

Closes #5123
Closes #8112
Closes #10368

Closes #14468
2016-06-06 22:20:37 +03:00
Peter Bacon Darwin 743bfcfe08 test($resource): check we do not throw if response.data is the resource object
Closes #4508
2016-06-06 18:13:09 +01:00
Peter Bacon Darwin 362d11b519 fix($parse): allow arguments to contain filter chains
Thanks to @esarbanis for the original PR that got out-dated due to the
big $parse overhaul.

Closes #4175
Closes #4168
Closes #14720
2016-06-06 15:20:31 +01:00
Guillaume Salles b9ac3362ee fix($location) : initialize $$absUrl to empty string
Initialize `$$absUrl` to an empty string, in order to avoid exception, when base href
and current location have different domains.

Fixes #11091
Fixes #13565

Closes #14488
2016-06-06 15:50:05 +03:00
Peter Bacon Darwin 4ee5717a96 docs(tutorial/step-9): fix typo 2016-06-06 13:35:37 +01:00
Martin Staffa 86aff733fc docs(ngComponentRouter): add deprecation notice and better install notes
Yes, that contradicts itself.

Closes #14655
Closes #14717
2016-06-06 13:29:57 +01:00
Peter Bacon Darwin 6ec775e0cd test(browserTrigger): fix typo in eventData property 2016-06-06 13:27:43 +01:00
Peter Bacon Darwin c8bfbfc5d7 test(browserTrigger): allow event bubbling
In some browsers, events don't bubble when they are dispatched on node inside
a detached tree. When this is the case, the bubbling is made manually.
This may be convenient when unit testing directives, for example.

Closes #5178
2016-06-06 11:45:15 +01:00
Peter Bacon Darwin 3ba8bb7109 test(browserTrigger): support key events
Support for key events like keypress, keyup or keydown.

Closes #8688
2016-06-06 11:45:08 +01:00
Andrew Schmadel ff0395f111 fix(ngMockE2E): allow $httpBackend.passThrough() to work when ngMock is loaded
Allow $httpBackend.passThrough() to work normally when ngMock is loaded
concurrently with ngMockE2E, as is typically the case when writing tests with
angular.mock.module()

Fixes #1434
Closes #13124
2016-06-06 11:14:41 +01:00
Martin Staffa cd3673e514 docs(angular.element): note restrictions of addClass and removeClass
Closes #12851
Closes #12793
2016-06-03 21:50:32 +02:00
Georgios Kalpakas f82eba814b docs($exceptionHandler): include better example
The previous example overwrote the `$exceptionHandler` in order to re-throw the error. This is not
recommended, since it would leave the application in an inconsistent state and prevent proper
clean-up.
The new example simulates logging the error both to the backend and the console.

Fixes #14704
2016-06-03 20:55:27 +03:00
Georgios Kalpakas 96e34e3c44 refactor($resource): explicitly set $resourceProvider.defaults.cancellable to false
Previously, it was just `undefined` and had the same behavior (since we only check for falsy-ness).
Just making it explicit, that this property is also available on `defaults` and is "not true" by
default.

Closes #14711
2016-06-03 16:58:35 +03:00
Georgios Kalpakas 618e3f2558 docs($resourceProvider): improve wording and formatting
Closes #11910
2016-06-03 16:58:35 +03:00
Yiling Lu 140820f4c5 docs($resourceProvider): provide info and example for configuring $resourceProvider 2016-06-03 16:58:35 +03:00
Wesley Cho 146dad7365 docs($animate): detail options object
- Document options object used in various $animate methods

Fixes #12645
PR: #14700
2016-06-03 13:28:18 +02:00
Martin Staffa 8e55b784de fix(ngSanitize): call attribute setter in linky for all links
Fixes #14707 
PR: #14710
2016-06-03 13:21:38 +02:00
Martin Staffa 87eff27e97 fix(select): remove workaround for Chrome bug
In the Chrome issue (https://bugs.chromium.org/p/chromium/issues/detail?id=381459)
I noticed that the bug can't be reproduced in Chrome 45 and the issue was
closed subsequently. I've also tested again with Chrome 51 and it still works.

Additionally, the Chrome hack was kept in the select code, but wasn't ported to
the ngOptions code when the two split in 7fda214c4f,
and no regression happened.

Nevertheless, a test has been added to guard against a future regression.

Related: #6828
PR: #14705
2016-06-03 13:21:05 +02:00
ZachLamb a478f69783 docs(tutorial/step_04): fix type (JacaScript --> JavaScript)
Closes #14661
2016-06-01 11:07:30 +03:00
Lucas Mirelmann cfc8b41771 refactor($location): Simplify expression. 2016-05-28 14:57:43 +02:00
Peter Bacon Darwin f58d4fb748 docs(CHANGELOG): fix typo 2016-05-27 22:34:36 +01:00
Martin Staffa 794e99e69f docs(changelog): update with changes for 1.5.6 2016-05-27 17:59:59 +02:00
Lucas Galfasó d23c1453cd fix($timeout): make $flush handle new $timeouts added in $timeout callbacks
If a $timeout handler calls $timeout itself, this new $timeout should be
added to the mock deferred queue with a "now" time based on when the original
handler was triggered.

Previously it was being added with a now time of when the `$timeout.flush`
method was originally called.

Closes #5420
Closes #14686
2016-05-27 16:17:10 +01:00
Peter Bacon Darwin de544807c2 fix($compile): cope with $onChanges hooks throwing
Previously, if one of these hooks threw an error, then the compilation
was terminated unceremoniously. In particular any other `$onChanges`
hooks that had been scheduled were not executed, nor was the queue cleaned
up properly.

Closes #14444
Closes #14463
2016-05-27 16:12:03 +01:00
Martin Staffa 55b7f7d80e docs(changelog): update with changes for 1.4.11 2016-05-27 12:42:04 +02:00
Victor Oliveira da Silva 85db30a3be docs(ngRepeat): fix typo
Closes #14681
2016-05-26 21:55:33 +03:00
Georgii Dolzhykov 5e7c4abb18 chore(package.json): remove unused grunt-jasmine-node
Closes #14363
2016-05-26 00:55:56 +03:00
Martin Staffa 4a5723f83b chore(angularFiles): add missing files
ngMessageFormat test files were missing from angularTest
ngMessages and ngAnimate were missing from karmaModules.

This change highlighted a number of problems in the tests and code,
which are now fixed.

Closes #14314
Closes #14669
2016-05-25 17:38:28 +01:00
Peter Bacon Darwin bf59aa5564 docs(tutorial/step-9): fix typo in inline link 2016-05-25 16:59:46 +01:00
Hadrien Tulipe 7875652298 docs(ngAnimateMock): document how to require mocked service in tests
Closes #14668
Closes #14670
2016-05-25 16:56:21 +01:00
Robin Böhm 4d5f5ffc78 refactor(ngMock): use exactly equal in browserTrigger
Closes #6763
2016-05-25 15:32:26 +02:00
David Goldberg 36b149332a style(src/Angular.js): make comment formatting consistent
Corrected formatting errors on lines 258, 695, 696, 1096, 1219, 1451, and 1536
by adding periods at the end of single line comments that were missing them
in order to be consistent with the formatting found in the file.

Capitalized the first letter in the first word of the comments on lines 695, 696, 1096,
to be consistent with the formatting of the rest of the file.

Added a space after the // in the comment on line 1536 to be
consistent with the formatting of the file.

Closes #11832
2016-05-25 15:17:40 +02:00
Martin Staffa d803354d7c docs(angular.element): note restriction in toggleClass 2016-05-25 14:58:05 +02:00
Kamron Batman 6ce34dd45c style(docs/gulpfile.js) make spacing consistent
Updated gulpfile.js in Docs so that spacing is consistency.
2016-05-25 14:53:45 +02:00
thorn0 cb2f8c0d75 perf($rootScope): make queues more efficient
By using a pointer to the current start of the queue and only clearing
up the queue storage later, we save lots of time that was spent manipulating
arrays with `slice`

Closes #14545
2016-05-25 13:21:49 +01:00
Ajay 9e28b64352 docs($provide): document decorator method
Closes #14562
2016-05-25 12:56:33 +01:00
Peter Briers 74eb569238 docs(ngAnimate): remove unnecessary transition prefixes
We can remove the vendor-prefixing from our docs, since all major browsers
support these properties, without prefixes.

Closes #14586
2016-05-25 12:38:19 +01:00
Jacob Reid 66af3d5729 docs(tutorial): fix typos
Closes #14662
Closes #14663
Closes #14664
2016-05-25 12:17:41 +01:00
Peter Bacon Darwin a4e4feed90 refactor(*): faster check for a string starting with a substring
Thanks to @spamdaemon for the original PR to make this improvement.

In naive tests on Chrome I got the following results:

```
             Matches   Misses
indexOf      33ms      1494ms
lastIndexOf  11ms      11ms
```

Closes #3711
2016-05-24 19:09:23 +01:00
Jeff Ardilio 7f4b356c2b fix($route): don't process route change controllers and templates for redirectTo routes
If a route defines a `redirectTo` value, the current route should stop processing the route
and instead wait to process the route of the redirect.

Currently, what is happening is that Angular detects a redirectTo value and updates $location,
but then continues processing the route that was intended to be redirected.
Templates are loaded, resolves are processed, ng-view then updates the view with a new template
and instantiates the controller all for a route that should have been redirected.

A common use case for assigning a function to the redirectTo is to validation authentication,
permission check, or some other logic to determine if the route should continue or redirect
else where. In the end, this happens, but in between, unexpected results may occur by updating
the view and instantiating controllers for logic that wasn't expected to be executed.

http://plnkr.co/edit/8QlA0ouuePH3p35Ntmjy?p=preview

This commit checks for a url change after a potential redirect, it the url changed, and is
not `null` nor `undefined`, exit out and don't process current route change.

Closes #3332
Closes #14658

BREAKING CHANGE

The $route service no longer instantiates controllers nor calls resolves or template functions
for routes that have a `redirectTo` unless the `redirectTo` is a function that returns
`undefined`.
2016-05-24 19:01:16 +01:00
Peter Bacon Darwin 4c95ad8d89 refactor($route): consolidate route locals processing into a single handler 2016-05-24 19:01:16 +01:00
Peter Bacon Darwin c39936ee26 refactor($route): move resolving locals into its own function 2016-05-24 19:01:16 +01:00
Peter Bacon Darwin 4adc9a9117 refactor($route): move getting the template into its own function 2016-05-24 19:01:15 +01:00
Martin Staffa b226f3028e Revert: revert changes to contribute.ngdoc
Reverts d9d20e6 and febda8f which sneaked in by accident
2016-05-24 18:16:46 +02:00
Martin Staffa d0af0ca76e style(loader): make jshint happy 2016-05-24 18:12:12 +02:00
Sibu Stephen d9d20e6968 Update contribute.ngdoc
Closes #12875
2016-05-24 17:54:23 +02:00
Sibu Stephen febda8f7bf Essential note when cloning into Angular repository
1) First change - Whenever cloning into directory there are chances of some users using "sudo" without knowing what it does exactly and what's the purpose of using sudo, leading them into a confusion and this lead to changes in git config and permission issues of which users may not be able to figure out at one spot.
2)  Second Change- There are chances of version unstability  issues in node which at times causes npm error and warnings while installing packages, I too had undergone some issues with node version conflicts at times, users who are not aware of this will be benefited with a Note prior.
2016-05-24 17:54:21 +02:00
Martin Staffa 00cdc945ba docs(guide/Decorators): update info about the order of decorator application 2016-05-24 17:44:28 +02:00
Martin Staffa 01abe6ae58 test(loader): add tests for order of decorations 2016-05-24 17:44:28 +02:00
robertmirro 6a2ebdba5d fix(loader): module.decorator order of operations is now irrelevant
`module.decorator` is now processed via the configBlocks order of operations and:
  1. no longer throws error if declared before the provider being decorated.
  2. guarantees the correct provider will be decorated when multiple, same-name
  providers are defined.

(1) Prior to this fix, declaring `module.decorator` before the provider that it
decorates results in throwing an error:

```js
angular
  .module('theApp', [])
  .decorator('theFactory', moduleDecoratorFn)
  .factory('theFactory', theFactoryFn);

// Error: [$injector:modulerr] Failed to instantiate module theApp due to:
// Error: [$injector:unpr] Unknown provider: theFactoryProvider
```

The result of this fix now allows for the declaration order above.

(2) Prior to this fix, declaring `module.decorator` before the final, same-named
provider results in that provider **not** being decorated as expected:

**NOTE:** Angular does not use provider name spacing, so the final declared
provider is selected if multiple, same-named providers are declared.

```js
angular
  .module('theApp', [])
  .factory('theFactory', theFactoryFn)
  .decorator('theFactory', moduleDecoratorFn)
  .factory('theFactory', theOtherFactoryFn);
```

`theOtherFactoryFn` is selected as 'theFactory' provider, but prior to this fix it is **not**
decorated via `moduleDecoratorFn`. This fix ensures that `theOtherFactoryFn` will be decorated as
expected when using the declaration order above.

Closes #12382
Closes #14348

BREAKING CHANGE:

`module.decorator` declarations are now processed as part of the `module.config`
queue and may result in providers being decorated in a different order if
`module.config` blocks are also used to decorate providers via
`$provide.decorator`.

For example, consider the following declaration order in which 'theFactory' is
decorated by both a `module.decorator` and a `$provide.decorator`:

```js
angular
  .module('theApp', [])
  .factory('theFactory', theFactoryFn)
  .config(function($provide) {
    $provide.decorator('theFactory', provideDecoratorFn);
  })
  .decorator('theFactory', moduleDecoratorFn);
```

Prior to this fix, 'theFactory' provider would be decorated in the following
order:
  1. moduleDecoratorFn
  2. provideDecoratorFn

The result of this fix changes the order in which 'theFactory' is decorated
because now `module.decorator` declarations are processed in the same order as
`module.config` declarations:
  1. provideDecoratorFn
  2. moduleDecoratorFn
2016-05-24 17:44:28 +02:00
Georgios Kalpakas c2033d7ff0 docs(tutorial): update to use v1.5.x and best practices
This is a major re-structuring of the tutorial app's codebase, aiming at applying established best
practices (in terms of file naming/layout and code organization) and utilizing several new features
and enhancements (most notably components) introduced in recent versions of Angular (especially
v1.5).

Apart from the overall changes, two new chapters were introduced: one on components and one on code
organization.

--
In the process, several other things were (incidentally) taken care of, including:

* Dependencies were upgraded to latest versions.
* Animations were polished.
* Outdated links were updated.
* The app's base URL was changed to `/` (instead of `/app/`).

BTW, this has been tested with the following versions of Node (on Windows 10) and everything worked
fine:

* 0.11.16
* 4.2.6
* 4.4.2
* 5.10.0
* 6.2.0

--
This was inspired by (and loosely based on) #13834.
Again, mad props to @teropa for leading the way :)

--
**Note:**
The old version of the tutorial, that is compatible with Angular version 1.4 or older, has been
saved on the `pre-v1.5.0-snapshot` branch of
[angular-phonecat](https://github.com/angular/angular-phonecat). The `v1.4.x` version of the
tutorial should be pointed to that branch instead of `master`.

--
Related to angular/angular-phonecat#326.
Related to angular/angular-seed#341.

Closes #14416
2016-05-24 14:07:08 +03:00
marija 4ae4cc9d46 perf(ngClass): improve even-odd checking
This now uses the same technique as ngRepeat.
2016-05-23 23:33:04 +02:00
marija 4fed5d873c refactor($sniffer): avoid unnecessary call to substring 2016-05-23 23:33:04 +02:00
Alireza Mirian f37568499e docs(guide/Conceptual Overview): clarify service instantiation sentence
Change a sentence which describes how currencyConverter service is instantiated.

Closes #12924
2016-05-23 23:33:04 +02:00
Martin Staffa e1f4b35031 docs(input[text]): remove deprecated tt tag
Closes #14547
2016-05-23 23:33:04 +02:00
Peter Bacon Darwin ad59781f7d chore(docs): add horizontal rules between known issues 2016-05-23 22:18:02 +01:00
Peter Bacon Darwin 2ca6db5374 chore(docs): fix api.template.html to display git links 2016-05-23 21:59:53 +01:00
Xavier Haniquaut c5cdadb601 docs(error/$compile): add reqslot error description
Explains what could generate a `reqslot` error.

Closes #14618
2016-05-23 14:20:44 +01:00
Peter Bacon Darwin 3bcbd63e47 chore(docs): add horizontal rules between known issues 2016-05-23 14:02:42 +01:00
Peter Bacon Darwin c8e09c8a40 docs($interpolate): add known issue about custom interpolation symbols
Closes #14610
Closes #6493
2016-05-23 13:52:25 +01:00
Jukka ab247d6203 fix(ngMessagesInclude): do not compile template if scope is destroyed
Messages imported with `ngMessagesInclude` are loaded asynchronously and
they can arrive after the ngMessages element has already been removed from DOM.

Previously we tried to compile these messages and that caused a `$compile:ctreq`
error. Now they are silently ignored if `ngMessagesInclude`'s scope has already
been destroyed.

Closes #12695
Closes #14640
2016-05-23 12:56:56 +01:00
Wesley Cho e67c3f8ab6 docs(contributing): fix the styleguide link
Update the link to Google's JavaScript style guide to the updated version

Closes #14652
2016-05-23 12:48:56 +01:00
Georgios Kalpakas 3f8efe73fc fix($animate): don't break on anchored animations without duration
If the `from` element of an animation does not actually have an animation
then there will be no animation runner on that element. This is possible
if the element has the `ng-animate-ref` attribute but does not have any
CSS animations or transitions defined.

In this case, it is not necessary to try to update the host of the
non-existent runner.

Fixes #14641
Closes #14645
2016-05-22 19:02:26 +01:00
Bijay Deo 1581827a51 fix(ngMock): match HTTP request regardless of the order of query params
Closes #12762
2016-05-21 10:43:54 +01:00
Peter Bacon Darwin eaa1119d42 docs(toJson): documented the Safari RangeError known issue
Closes #14221
Closes #13415
2016-05-21 10:15:31 +01:00
Georgios Kalpakas efa72a8401 docs(ngMock/$exceptionHandler): fix formatting
Too much indentation, made text get formatted as code block.
2016-05-20 21:22:14 +03:00
Adrian Moos 51cfb61e46 fix($brower): set the url even if the browser transforms it
While $location expects that $browser stores the URL unchanged, "some browsers" transform the URL
when setting or defer the acutal update. To work around this, $browser.url() kept the unchanged
URL in pendingLocation.

However, it failed to update pendingLocation in all code paths, causing
$browser.url() to sometimes incorrectly report previous URLs, which horribly confused $location.

This fix ensures that pendingLocation is always updated if set, causing url() to report the
current url.

Fixes #14427
Closes #14499
2016-05-20 15:20:06 +01:00
Peter Bacon Darwin 9355aea2e2 docs(misc/contribute): specify node version 2016-05-18 16:46:04 +01:00
Peter Bacon Darwin cf862b5eb5 docs(ngMock): final installation description fix 2016-05-18 08:41:52 +01:00
Georgios Kalpakas 24705824d3 fix($compile): properly bind context to linking functions for directives with templateUrl
Also, fix some styling issues.
2016-05-17 22:17:33 +03:00
Paulo Cesar 7d0fe19734 fix($compile): always use the DDO as this in pre-/post-linking functions
Closes #9306
2016-05-17 20:43:08 +03:00
Peter Bacon Darwin 921f80e1ea docs(ngMock): fix installation instructions 2016-05-17 18:24:55 +01:00
Thomas Kowalski ce9f67b08d docs(guide/component-router): remove unused code
Closes #14613
2016-05-17 11:59:31 +03:00
Peter Bacon Darwin 05d2703b4e docs(ngMock): fix installation formatting
The `@installation` section should be formatted with markdown, not
nunjucks template directives.

Closes #14604
2016-05-16 22:46:31 +01:00
Lucas Mirelmann 3b5751dce8 fix($parse): call once stable bind-once expressions with filter
When an expression has the following:
- Bind-once
- A stateless filter at the end
- Optionally an expression interceptor

Then call the filter once.

Closes: #14583
Closes: #14589
2016-05-16 13:03:24 +02:00
Sander Boom 5d1e15cb1b docs(guide/$location): fix typo
Closes #14607
2016-05-14 01:51:15 +03:00
Mark Pieszak bfaf773ae2 docs(readme): remove "(beta)" from Angular 2 link
Closes #14599
2016-05-13 23:16:03 +03:00
Georgios Kalpakas f6d8be8ad3 docs(ngComponentRouter): specify correct version of npm package
The latest npm package does not contain the angular 1 version of the router.

Related to 824ce30.
2016-05-13 19:09:56 +03:00
Peter Bacon Darwin eebbca0a8b chore(package.json): update to use dgeni-packages@0.13.0 2016-05-12 11:04:51 +01:00
Peter Bacon Darwin 6b92ff08cd chore(npm/check-node-modules): cope with no npm-shrinkwrap file 2016-05-12 10:25:34 +01:00
Pete Bacon Darwin f1f892d6c0 fix($compile): don't run unnecessary update to one-way bindings
The watch handler was triggering on its first invocation, even though
its change had already been dealt with when setting up the binding.

Closes #14546 
Closes #14580
2016-05-10 22:30:54 +01:00
Anthony Trimble 3b714740fd docs($httpBackend): fix a typo
Fix comment typo
(#14576)
2016-05-10 03:15:35 -07:00
Peter Bacon Darwin 824ce30041 docs(guide/component-router): specify correct version of npm package
The latest npm package does not contain the angular 1 version of the router.

Closes #14564
Closes #14560
2016-05-07 21:39:14 +01:00
Maksim Ryzhikov 5b053b18d0 fix(ngAnimate): properly handle empty jqLite collections
Previously `stripCommentsFromElement()` would return an empty Array (instead of a jqLite collection)
which would cause an exception to be thrown: "element.parent not a function".
This commit fixes it, by ensuring that the returned value is always a jqLite collection.

Closes #14558

Closes #14559
2016-05-06 08:13:01 -06:00
Sreenivasan K 81bf7ed73e fix(ngAnimate) : make svg elements work with classNameFilter
(#14529)

Closes #14508
2016-05-06 07:07:01 -07:00
dmandelin d7274f066e docs($sanitizeProvider): fix param comment for enableSvg
Change the text of the doc comment for the parameter of enableSvg to match the type of the comment and the behavior of the code (#14543).
2016-05-06 06:35:28 -07:00
FGasper 0bd2efb994 docs($location): clarify return value for path method
docs for return of path() inaccurately describe the function’s return when a value is passed in.

Closes #14544
2016-05-06 06:17:21 -07:00
Stephen Barker 938bd45626 docs(guide/decorators): add decorator guide
+ explain decorators and how they are implemented in angular
+ explain how different types of services can be selected
+ explain `$delegate` objects and how they differ between services
+ warn of the risks/caveats of `$delegate` modification
+ note the exposure of `decorator` through the module api
+ show an example of decorating a core service
+ show an example of decorating a core directive
+ show an example of decorating a core filter

Closes #12163
Closes #14372
2016-05-06 05:51:22 -07:00
Martin Staffa 996b1e4378 style(validators.js): remove trailing whitespace 2016-05-06 14:26:52 +02:00
Michael Warner 4978a06ad2 docs(ngRequired): add 'restrict' info
The Angular Docs do not show the restrictions

Closes #14541
2016-05-06 04:52:48 -07:00
Ivo Mirra aaa069a65a fix($compile): removing unnecessary white space in element-transclusion comments
Fixes #14549

Closes #14550
2016-05-05 18:49:54 -06:00
Martin Probst 707664a3c4 fix(ng-bind-html): watch the unwrapped value using $sce.valueOf() (instead of toString())
Custom `$sce` implementations might not provide a `toString()` method on the wrapped object, or it
might be compiled away in non-debug mode. Watching the unwrapped value (retrieved using
`$sce.valueOf()`) fixes the problem.

The performance of this should be equivalent - `toString()` on objects usually touches all fields,
plus we will also avoid the (potentially big) string allocation.

Fixes #14526
Closes #14527
2016-04-28 20:18:57 +03:00
Mark Pieszak 06e96407a9 docs(README.md): add link to Angular 2 repo
Might be helpful for those completely new to Angular in general, that intended to view the upcoming
2.0 version.

Closes #14532
2016-04-28 19:45:35 +03:00
Georgios Kalpakas afcedff34c fix($injector): add workaround for class stringification in Chrome v50/51
Partially fixes #14240.

Closes #14531
2016-04-28 14:21:38 +03:00
Petr Mikota 3dcc01646a docs(guide/component-router): add missing backticks
Closes #14530
2016-04-28 11:38:04 +03:00
Weijing Jay Lin b67d145bf3 docs(identity): add example
Closes #14528
2016-04-28 11:05:45 +03:00
Georgios Kalpakas 8dc1f8e00e fix($injector): add workaround for fat-arrow stringification in Chrome v50/51
Closes #14487

Closes #14495
2016-04-28 10:55:17 +03:00
Georgios Kalpakas 0780666e41 feat($compile): support omitting required controller name if same as the local name
Basically, making `require: {someDir: '?^someDir'}` equivalent to `require: {someDir: '?^'}`.

Closes #14513
2016-04-28 10:41:17 +03:00
Fabricio Ronchi 6d2e0718d2 docs(ngAria): remove redundant table column
Closes #14518
2016-04-28 10:37:06 +03:00
Martin Staffa d71dc2f5af perf($animate): listen for document visibility changes
perf(ngAnimate): listen for document visibility changes

Accessing the document for the hidden state is costly for
platforms like Electron. Instead, listen for visibilitychange
and store the state.

(#14071)
Closes #14066
2016-04-26 14:01:09 -07:00
Michael de Wit b9d76bfa55 docs(guide/component): several unit-test fixes and remove obsolete testcase
Fixes #14426

Closes #14443
2016-04-26 20:23:12 +03:00
Perry Hooker 2310e1090a fix($compile): properly handle setting srcset to undefined
Previously, calling `Attributes#$set('srcset', value)` on an `<img>` element would throw if `value`
were undefined, as it assumed `value` is always a string.
This commit fixes the issue, by skipping the unnecessary string manipulation when `value` is not
defined.

Closes #14470

Closes #14493
2016-04-26 09:06:26 +03:00
andrea 92752e5b42 docs(guide/index): fixed formatting with subtitles
The "Books" and "Videos" subtitles had no space between text and the '#' so it didn't render as a
subtitle.

Closes #14514
2016-04-26 08:32:13 +03:00
Tim van Dalen 4ad95607eb docs($anchorScroll): fix link to HTML5 spec
Closes #14364
2016-04-26 00:22:24 +03:00
Raphael Jamet 8576baf751 fix($templateRequest): trust empty templates in $templateCache as well
Implicitly trust empty templates added to `$templateCache` as is the case for all other templates.

Fixes #14479

Closes #14496
2016-04-25 20:19:53 +03:00
Sam 8d1ee0c3b9 docs(guide/Unit Testing): covert 'focussed' to AE spelling
We prefer American English spelling.
(#14503)
2016-04-24 07:46:41 -07:00
Georgios Kalpakas c95a3d8088 docs($interpolate): add known issue about end-symbol in expression
This has been discussed in #8642.

Closes #14494
2016-04-22 14:40:50 +03:00
Georgios Kalpakas 25a7aefc12 fix(filters): always call splice() with 2 arguments or more
When calling `.splice()` without a 2nd argument (`deleteCount`), most browsers will splice to the
end of the array. As it turns out, this is the behavior specified in [ES2015][es6]. In [ES5][es5],
the spec seems to imply that nothing should happen.

To avoid inconsistent behavior among browsers implementing different versions of the EcmaScript
standart or when ES5 shims are included (e.g. https://github.com/es-shims/es5-shim/), this commit
ensures that all calls to `.splice()` provide at least two arguments.

[es5]: http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.12
[es6]: http://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.splice

Fixes #14467

Closes #14489
2016-04-22 12:39:41 +03:00
Abhishek Garg 0727bfc141 docs($http): add better explanation for error status codes
Add explanation for error status codes in `$http` and mention negative codes normalization.
This alleviates confusion about which status codes will trigger the error callback and what values
to expect in such callbacks.

Fixes #11945

Closes #14459
2016-04-22 12:19:35 +03:00
andreyjkee 253cb8d4e9 fix(ngMocks): pass eventHandlers to $httpBackend if passThrough is active
Closes #14471
2016-04-21 23:08:39 +02:00
Martin Staffa d2ec9d7184 docs(guide/Expressions): mention absence of bitwise operators
Closes #14485
2016-04-21 16:26:47 +02:00
Abhishek Garg 1676b8477f docs(changelog): make labels and list style consistent
Remove 'Breaking Changes' label where there are no breaking changes.

Only for '1.4.0-rc.2', breaking changes have different styling (bold without bulleted list). Change to be consistent with others

(#14482)
2016-04-21 07:23:30 -07:00
Amy c414ece5cf docs($sce): add missing article
...teeny letter missing.  Just a grammar change.
(#14480)
2016-04-21 07:18:15 -07:00
jody tate 186c8cb9e4 docs(ngAria): fix markdown heading syntax
(#14477)
2016-04-21 07:16:45 -07:00
Martin Staffa b5983e4b21 docs(ngMock): add custom installation instructions
ngMock should be used in a test runner context, not directly in the application

Closes #14248
2016-04-21 15:56:16 +02:00
Martin Staffa f30b0ed849 docs: reorganize module overview page template 2016-04-21 15:56:16 +02:00
Michał Gołębiowski d985944652 chore(jQuery): bump jQuery version from 2.2.1 to 2.2.3 2016-04-20 13:36:39 +02:00
Ken Powers e14b486e07 docs(guide/Components): snake -> kebab
The example given is not in snake_case, it is in kebab-case.

Closes #14464
2016-04-19 11:31:19 -07:00
Lucas Mirelmann eb9f7d484d chore(i18n): Update locales to version 29
Closes: #14450
2016-04-18 22:15:40 +02:00
Lucas Mirelmann b5a0c8d2ea feat($parse): Add support for ES6 object initializers
- Add support for computed property names
- Add support for short notation in properties definitions

Eg. The expressions `{x}` and `{[x + 'foo']: 1}` are now valid.
2016-04-18 22:01:30 +02:00
Lucas Mirelmann c1eaf3480b fix($parse): Handle sign of -undefined consistently
When csp is disabled, evaluating `-undefined` is `-0` and when csp is enabled
the evaluation is `0`. In most cases this is not an issue as `0 === -0`, but
there is an edge case as `1/0 === Infinity` and `1/-0 === -Infinity`

Close: #14451
2016-04-18 16:29:10 +02:00
Martin Staffa 997f482b38 docs(ngMockE2E): add $httpBackend mock example 2016-04-18 14:08:10 +02:00
Peter Bacon Darwin 0cb94ed3a3 chore(CHANGELOG): fix version number for 1.5.5 2016-04-18 12:31:31 +01:00
Peter Bacon Darwin c3de164b83 chore(CHANGELOG): add 1.5.5 release notes 2016-04-18 12:29:22 +01:00
Martin Staffa 165a862a0b chore(gitignore): exclude .log and .stackdump files 2016-04-17 13:34:55 -07:00
Jeremy 7148627eae docs(guide/Component Router): fix a typo in npm install instructions
Related #14452
2016-04-17 13:33:35 -07:00
Peter Bacon Darwin 0d7f1ed428 docs(CHANGELOG): remove changes from 1.5.4
1.5.4 was only partially released.
These changes will be included in the 1.5.5 release
2016-04-16 09:29:03 +01:00
z.ky 5656eb3c0b docs($http): fix typo
Fix a typo in the $http API Reference
2016-04-15 10:23:03 -07:00
Georgios Kalpakas ddac3b3348 fix($http): pass event object to eventHandlers/uploadEventHandlers
Fixes #14436
2016-04-15 14:10:25 +01:00
Peter Bacon Darwin 0d55298b56 revert: refactor($compile): move setting of controller data to single location
Reverted from commit 83a6b15020 since it caused
the Angular Material tabs directives to break.
2016-04-15 14:07:28 +01:00
Jannick Fahlbusch 56861c0ae9 chore(docsApp): open plnkr.co with HTTPS
Plnkr should be opened via HTTPS instead of HTTP to supress warnings about an insecure connection

Closes #14445
2016-04-15 14:37:50 +02:00
cloverharvest b4c7df3713 docs($http): fix a typo (his --> this)
Closes #14430
2016-04-15 01:24:14 +03:00
Adam Demuri 1f05b96022 docs(component): document 'require' in angular.component
Closes #14429
2016-04-15 01:09:31 +03:00
Peter Bacon Darwin c4fb0eca92 docs(CHANGELOG): add release notes for 1.5.4 2016-04-14 09:16:39 +01:00
Pete Bacon Darwin 2840aec8f1 feat($componentController): provide isolated scope if none is passed (#14425)
Closes #14425
2016-04-13 18:11:20 +01:00
Martin Staffa 97b3e003bc perf(ngOptions): use documentFragment to populate select
This changes the way option elements are generated when the ngOption collection changes.
Previously, we would re-use option elements when possible (updating their text and
label). Now, we first remove all currently displayed options and the create new options for the
collection. The new options are first appended to a documentFragment, which is in the end appended
to the selectElement.

Using documentFragment improves render performance in IE with large option collections
(> 100 elements) considerably.

Creating new options from scratch fixes issues in IE where the select would become unresponsive
to user input.

Fixes #13607
Fixes #13239
Fixes #12076
2016-04-13 18:40:03 +02:00
Georgios Kalpakas f785c0c98d docs(ngView): add known issue about asynchronously loaded ngView
Closes #14424
2016-04-13 18:25:46 +03:00
Georgios Kalpakas 75bf80700e revert: "fix(ngRoute): allow ngView to be included in an asynchronously loaded template"
This reverts commit 5e37b2a7fd.
Eagerly loading `$route`, could break tests, because it might request the root or default route
template (something `$httpBackend` would know nothing about).

It will be re-applied for `v1.6.x`, with a breaking change notice and possibly a way to disable
the feature is tests.

Fixes #14337
2016-04-13 18:23:59 +03:00
Jason Bedard fe1127a322 perf($compile): use createMap() for directive bindings to allow fast forEach
Closes #12529
2016-04-13 11:49:40 +03:00
Peter Bacon Darwin 709dc1cf0e docs(images): add svg and visio versions of the graffle image 2016-04-12 14:19:55 +01:00
Peter Bacon Darwin 3207b51e83 docs(guide): add svg and visio versions of the graffle images 2016-04-12 14:16:43 +01:00
Peter Bacon Darwin e818d4a959 docs(tutorial): add svg and visio versions of the graffle images 2016-04-12 14:13:33 +01:00
Georgii Dolzhykov 1c62d632a5 docs(Module): fix parameter names for .decorator()
Closes #14413
2016-04-12 14:50:46 +03:00
aortyl 761c70c7b9 docs(guide/scope): add comma for readability
Closes #14411
2016-04-11 22:21:29 +03:00
Jason Bedard 83a6b15020 refactor($compile): move setting of controller data to single location
Closes #13421
2016-04-11 18:54:20 +01:00
Georgios Kalpakas 9264cef03f fix($compile): do not use noop() as controller for multiple components
Currently, custom annotations are copied from the CDO onto the controller constructor.
Using `noop()` when no controller has been specified, pollutes it with custom annotations and
makes one component's annotations available to all other components that have `noop()` as their
controller.

Fixes #14391
Closes #14402
2016-04-11 18:42:48 +01:00
a510 a0b5e1a858 fix($injector): ensure functions with overridden toString() are annotated properly
Closes #14361
2016-04-11 12:58:50 +03:00
David Rodenas Pico 74eb4684dc fix(ngClass): fix watching of an array expression containing an object
Closes #14405
2016-04-11 12:38:45 +03:00
Georgios Kalpakas d088fbeae3 refactor($compile): remove unnecessary call to isDefined()
(As discussed in https://github.com/angular/angular.js/pull/14406/files#r59131398.)
2016-04-11 12:31:45 +03:00
Gene McCulley ee8d8e12fb docs(numberFilter): fix the description of the returned value
Closes #14408
2016-04-11 12:26:56 +03:00
Peter Bacon Darwin 4a0bd6ce69 fix($compile): still trigger $onChanges even if the inner value already matches the new value
Closes #14406
2016-04-10 20:30:35 +01:00
Rouven Weßling 5d695e5566 chore(IE8): remove more special code for IE8
Closes #9478
2016-04-09 22:38:16 +02:00
Jurko Gospodnetić 92c3b753d4 fix(ngMock): fix collecting stack trace in inject() on IE10+, PhantomJS
Add support for collecting current stack trace information in browsers
(e.g. IE10+, PhantomJS) that do not automatically store the current stack trace
information in a newly created `Error` object's `stack` property, but
only add it there once the `Error` gets thrown.

The original implementation works fine in Firefox & Chrome, but fails on IE10+
and PhantomJS where it, for example, breaks Karma's error reporting in cases
when an exception is thrown in a test like the following:

```
it('the holy crusade', inject(function() {
  var x = {};
  x.holyGrail();
}));
```

In this case, the ngMock `inject()` implementation would incorrectly add the
word `undefined` at the end of the collected error stack trace information,
thus causing the main error description to be reported back to Karma as
`undefined`.

The added test makes sure this functionality:

- works as expected in browsers supporting JavaScript stack trace
  collection, e.g. Chrome, Firefox, IE10+, Opera & PhantomJS
- does not add any bogus stack track information in browsers that do
  not support JavaScript stack trace collection, e.g. IE9

Fixes #13591
Closes #13592

Closes #13593
2016-04-09 20:49:10 +03:00
Georgios Kalpakas a084030afa test(helpers): fix error message generation for toHaveBeenCalledOnce[With] matchers
Jasmine 2.4 (maybe earlier) does not support returning an array containing both the "normal" and the
negative error messages. It will always concatenate them.

Closes #14275
2016-04-09 17:01:45 +03:00
Jan Niehusmann 1cb8d529a6 fix($compile): handle boolean attributes in @ bindings
Commit db5e0ff handles initial values of boolean attributes. The same
change needs to be applied inside the attrs.$observe() call.

Closes #14070
2016-04-09 16:52:33 +03:00
Peter Bacon Darwin 0348347841 chore(package.json): update dgeni-packages to 0.12.0
This gives us `@knownissues` tags
2016-04-08 20:58:19 +01:00
Peter Bacon Darwin d405dfd5ed docs(jqlite): add known issue
Closes #14251
2016-04-08 19:33:43 +01:00
Peter Bacon Darwin d497822266 feat($http): support handling additional XHR events
Closes #14367
Closes #11547
Closes #1934
2016-04-08 19:15:30 +01:00
Chris Chua 50cdedef36 feat($http): support handling additional XHR events
Closes #11547
Closes #1934
2016-04-08 19:15:30 +01:00
Martin Staffa 8dc08fb1d7 docs(CONTRIBUTING): clarify guidelines for ngLocale changes 2016-04-08 19:29:19 +02:00
Martin Staffa 7477fbec61 docs(README): fix typo 2016-04-08 19:00:31 +02:00
Martin Staffa a479e6543e docs(guide/accessibility): make jshint happy 2016-04-08 18:55:06 +02:00
Jason Bedard b89c2181a9 fix($compile): move check for interpolation of on-event attributes to compile time
This makes the two interpolation errors consistent and avoids checking the same thing per link
(which previously would log the same error per link).
The test changes are not necessary but do make them stricter and more like the selmulti error tests.

Closes #13267

BREAKING CHANGE:

Using interpolation in any on* event attributes (e.g. `<button onclick="{{myVar}}">`) will now throw
the "nodomevents" error at compile time.
Previously the nodomevents was thrown at link time. The new behavior makes it consistent with
the "selmulti" error.
The breaking change should be rare, as it relates to incorrect API use that should not make it to
production apps in the first place.
2016-04-08 18:38:14 +02:00
Pablo Iván G. Soto 6b57198cb4 docs(README): add https links, improve style 2016-04-08 18:21:35 +02:00
mohamed amr 9978de11b7 fix(ngAria): don't add roles to native control elements
prevent ngAria from attaching roles to textarea, button, select, summary, details, a, and input

Closes  #14076
Closes #14145

BREAKING CHANGE:

ngAria will no longer add the "role" attribute to native control elements
(textarea, button, select, summary, details, a, and input). Previously, "role" was not added to
input, but all others in the list.

This should not affect accessibility, because native inputs are accessible by default, but it might
affect applications that relied on the "role" attribute being present (e.g. for styling or as
directive attributes).
2016-04-08 17:41:58 +02:00
Martin Staffa d449ec83a6 docs(guide/Accessibility): fix markdown errors, tweak layout 2016-04-08 17:29:26 +02:00
mohamed amr ae0a716000 feat(ngAria): add support for aria-readonly based on ngReadonly
Closes #14140
Closes #14077
2016-04-08 17:28:24 +02:00
Martin Staffa eee2ef6e9d docs(ngComponentRouter): add note about shims needed for IE 2016-04-08 15:55:59 +02:00
Josh 0cbe7fbfc4 docs(ngComponentRouter): fix typo
Simple typo fix from `betweent he` to `between the`

Closes #14396
2016-04-08 15:45:33 +02:00
Martin Staffa f8e6a4bcba fix(ngAnimate): remove event listeners only after all listeners have been called
The fix for removing the event callbacks on destroy introduced in
ce7f400011 removed the events too early, so that the event callbacks
for the "close" phase in "leave" animations were not called.

This commit fixes the behavior so that the event callbacks are only removed during on('$destroy')
when no animation is currently active on the element. When an animation is active, the event callbacks
will be removed after all callbacks have run, and if the element has no parent (has been removed from
the DOM).

Closes #14321
2016-04-08 15:03:11 +02:00
Martin Staffa ea4120bf35 feat(ngAnimate): let $animate.off() remove all listeners for an element 2016-04-08 15:03:10 +02:00
Andrew c75fb80333 docs(guide/Components): fix small single letter typo
line 136: 'not' should be 'note'

Closes #14390
2016-04-08 01:31:26 +02:00
Martin Staffa 2b327f01be fix(ngAnimate): fire callbacks when document is hidden
Since commit a3a7afd3aa, animations are not run
when the document is hidden (only their structural or class change effects are executed).
However, some libraries rely on the $animate.on() callbacks to be called even when no actual animation
runs.
This commit restores the behavior for the ngAnimate.$animate functions.
Note that callbacks still won't be called if animations are disabled, because this would be be a potential
breaking change, as some applications might rely on this implementation.

Fixes #14120
2016-04-08 01:08:58 +02:00
Martin Staffa 19eca35c72 test(ngAnimate): test calling callbacks for various constellations 2016-04-08 01:08:56 +02:00
Martin Staffa eb2126a388 fix(ngAnimate): fire callbacks in the correct order for certain skipped animations 2016-04-08 01:08:51 +02:00
SHAHRUKH-KHAN 796c11116d docs(angular.equals): add example
This Pull requests improves the doc by adding a example to `angular.equals` function.

Closes #14232
2016-04-07 15:13:24 +02:00
glenr4 6df103591e docs(ngAnimate): fix toggle button in example
The toggle button code on line 153 only sets bool to true, rather than toggling it.
The proposed change fixes this.

Closes #14387
2016-04-07 14:10:58 +02:00
andykuszyk 441be9a102 docs(misc/Getting Started): fix markdown for headings
Closes #14353
2016-04-07 14:10:58 +02:00
Maciej Kołodziejczak 2d414fbaee docs(ngComponentRouter): fix a typo
Closes #14357
2016-04-07 14:10:58 +02:00
Andrew f056f5d1c5 docs(guide/Components): clarify output events with extra example and note
Add additional line from example which demonstrates using the snake cased attribute binding in
parent component template.
Add note clarifying camelCase to snake-case requirement to use the Output binding callback feature.

Closes #14365
2016-04-07 14:10:58 +02:00
Artur d076a9b217 docs(guide/Components): fix typo, improve style
Closes #14384
2016-04-07 14:10:58 +02:00
Robin Janssens fd0b1ebfc7 docs($httpBackend): update response data types
Updated docs to reflect that response data can either be an array, object _or_ a string
Technically, response data can be anything that can be handled by angular.copy,
but since string and JSON data is most commonly mocked, the main types are sufficient.

Closes #14346
2016-04-07 14:10:58 +02:00
Michał Gołębiowski 038d990bc1 fix(travis): Don't run e2e tests with jQuery twice
The e2e tests were set up to be run twice; once with the latest supported
jQuery and once with jQuery 2.1. However, the latest jQuery was used in both
cases. The initial plan was to just run integration tests with the latest
jQuery and leave regression testing for jQuery 2.1 to unit tests as they're
way faster. This commit removes the jQuery 2.1 e2e tests entry.
2016-04-06 20:58:03 +02:00
Michał Gołębiowski ddad26402b refactor(jshint): don't assume browser-only globals
Fixes #13442
Closes #14345
2016-04-06 20:35:49 +02:00
Peter Bacon Darwin fad6c7c661 docs(componentRouter): add custom installation instructions 2016-04-05 21:07:50 +01:00
Peter Bacon Darwin 4b2bc60e43 feat($compile): put custom annotations on DDO
Closes #14369
Closes #14279
Closes #14284
2016-04-04 20:05:28 +01:00
Peter Bacon Darwin d27954575f fix($compile): don't throw if controller is named 2016-04-04 15:27:09 +01:00
Peter Bacon Darwin b54634d37b fix($compile): ensure that $onChanges hook is called correctly
Due to the way that we instantiate controllers, the `$onChanges` hook
was not always available at the time we were trying to trigger the initial
call to this hook. For instance, if the hook was actually defined inside
the constructor function.

This commit fixes that but also fixes the fact that the initial call was
being made in the postDigest anyway, which was incorrect because the
it should have been made before the `$onInit` call.

Closes #14355
Closes #14359
2016-04-01 17:41:07 +01:00
Georgios Kalpakas fa79eaa816 test($browser): fix typo in property name (histroy --> history)
(The semantics of the test aren't affected, because we just needed a falsy value.)
2016-03-31 13:25:46 +03:00
Michał Gołębiowski 1964620e95 chore(*): Remove duplicate globals in .jshintrc files 2016-03-30 13:57:36 +02:00
Martin Staffa 3b05c484af fix(ngOptions): set select value when model matches disabled option
When ngModel is set to a value that matches a disabled option, ngOptions will now select the option
in the select element, which will set select.val() to the option hash value and visually
show the option value / label as selected in the select box. Previously, disabled
options forced the unknown value.
The previous behavior is inconsistent with both default HTML behavior and select with
ngModel but without ngOptions. Both allow disabled values to be selected programmatically.

A common use case for this behavior is an option that was previously valid, but has
been disabled, and cannot be selected again.

This commit removes a duplicate test, and all other tests that previously checked that disabled
options are not set have been adjusted to the ensure the opposite.

Fixes #12756
2016-03-29 20:35:48 +02:00
Lucas Mirelmann 71cf28cf06 refactor(ngResource): handle success and error callbacks using the same promise 2016-03-27 15:07:56 +02:00
Lucas Mirelmann c9dffde1cb feat($q): report promises with non rejection callback
Rejected promises that do not have a callback to handle the rejection report
this to $exceptionHandler so they can be logged to the console.

BREAKING CHANGE

Unhandled rejected promises will be logged to $exceptionHandler.

Tests that depend on specific order or number of messages in $exceptionHandler
will need to handle rejected promises report.

Closes: #13653
Closes: #7992
2016-03-27 15:07:37 +02:00
cscport 0ece2d5e0b docs(angular.bootstrap): fix capitalization in error message
Closes #14325
2016-03-27 15:42:47 +03:00
Lucas Mirelmann 3968a8f8cc docs(ngParseExt): Fix package name 2016-03-26 23:59:38 +01:00
Peter Bacon Darwin a6a4b23517 feat($compile): add isFirstChange() method to onChanges object
Closes #14318
Closes #14323
2016-03-26 20:05:07 +00:00
Lucas Mirelmann bd0915c400 feat(ngParseExt): New ngParseExt module
New ngParseExt module

Including this module into an application will extend $parse to allow identifiers
following ES6 identifiers
2016-03-26 20:39:19 +01:00
Lucas Mirelmann ad298947a0 feat($parse): Add the ability to define the identifier characters
Add the ability to define the identifier starts and identifier continue characters
2016-03-26 20:39:08 +01:00
Lucas Mirelmann fadea2c81f chore(bower): Add parse-ext repository 2016-03-26 20:36:36 +01:00
thorn0 5ceb5dbfa6 perf(injector): cache the results of the native class detection check
Closes: #14322
2016-03-26 16:01:43 +01:00
Lucas Mirelmann bd7d5f6345 perf($parse): Inline constants
Inline constants definitions in function calls, array definitions
and object values.

For the expression [1, {foo: "bar"}, 1 + 2] it changes it from

```js
// After some reordering and cleanup
var v1 = 1;
var v2 = "bar";
var v3 = {foo: v2};
var v4 = 1;
var v5 = 2;
var v6 = plus(v4, v5);
var v7 = [v1, v3, v6];
return v7;
```

to

```js
return [1, {foo: "bar"}, plus(1, 2)];
```

Expression parts that are not constants did not change, and still generate a lot
of intermediate variables.

Closes: #14293
2016-03-26 12:31:39 +01:00
Peter Bacon Darwin 3cd00fa3dd docs(CHANGELOG): add 1.5.3 release notes 2016-03-25 20:02:41 +00:00
Martin Staffa 90cb24e781 chore: add jshint eqeqeq for src/ files
Add jshint "eqeqeq" and "eqnull" rules (to allow == null comparisons).
Only adds it to files under src/, because we these files are unit-tested.
Files in src/ngLocale are excluded, because the code is imported.

Closes #14287
2016-03-25 14:44:12 +01:00
Martin Staffa 4487d4a8a4 fix: make files in src/ jshint: eqeqeq compatible
Add exceptions to the rule in input, ngAria, and parse.
For input and ngAria, the exception is to prevent a breaking change in the radio directive.
A test for the input behavior has been added.
For parse, the exception covers non-strict expression comparison.
2016-03-25 14:44:12 +01:00
Peter Bacon Darwin 874c0fdcdd feat($compile): add more lifecycle hooks to directive controllers
This change adds in the following new lifecycle hooks, which map in some
way to those in Angular 2:

 * `$onChanges(changesObj)` - Called whenever one-way bindings are updated. The `changesObj` is a hash whose keys
   are the names of the bound properties that have changed, and the values are an object of the form
   `{ currentValue: ..., previousValue: ... }`. Use this hook to trigger updates within a component such as
   cloning the bound value to prevent accidental mutation of the outer value.
 * `$onDestroy` - Called on a controller when its containing scope is destroyed. Use this hook for releasing
   external resources, watches and event handlers.
 * `$postLink` - Called after this controller's element and its children been linked. Similar to the post-link
   function this hook can be used to set up DOM event handlers and do direct DOM manipulation.
   Note that child elements that contain `templateUrl` directives will not have been compiled and linked since
   they are waiting for their template to load asynchronously and their own compilation and linking has been
   suspended until that occurs.

Closes #14127
Closes #14030
Closes #14020
Closes #13991
Closes #14302
2016-03-25 12:54:50 +00:00
Martin Staffa 7489d56687 docs(ngAnimate): fix anchoring example
Example must be updated for the default ngRoute hash prefix.

Closes #14312
2016-03-24 11:34:31 +01:00
Martin Staffa cc1de81f5e fix(ngAnimate): run structural animations with cancelled out class changes
When multiple animations on the same element are queued before a $digest passes,
the animator tries to create as few actual animations as possible by joining / canceling
redundant animations. Class-based animations for example are cancelled when the classes that
are added and removed are the same, and the result is no class-change. This however must only
happen if there's no structural animation currently queued.

Fixes #14249
2016-03-24 00:13:30 +01:00
Martin Staffa cbd048d893 fix(ngMessages): don't crash when nested messages are removed
Under specific circumstances, ngMessages would go into an infinite loop and crash the
browser / page:
- At least two ngMessage elements are wrapped inside another element (e.g. ngTransclude)
- The first message is currently visible
- The first message is removed (e.g. when the whole ngMessages element is removed by an ngIf)

When a message is removed, it looks for a previous message - in this specific case it would misidentify
the second message for a previous message, which would then cause the first message to be marked as the
second message's next message, resulting in an infinite loop, and crash.

This fix ensures that when searching for previous messages, ngMessage walks the DOM in a way so
that messages that come after the current message are never identified as previous messages.

This commit also detaches and destroys all child ngMessage elements when the ngMessages element is
destroyed, which should improve performance slightly.

Fixes #14183
Closes #14242
2016-03-24 00:13:30 +01:00
Alex Chuev 67784531c2 docs(guide/component): add missing closing bracket
Closes #14299
2016-03-23 23:57:08 +02:00
pmadruga f01d6f2788 docs(error/$compile.baddir): mention "components" in directive name error
Closes #14212
2016-03-23 21:57:28 +02:00
Daniel Herman e34ef23ab8 fix($compile): workaround a GC bug in Chrome < 50
In the version of V8 used in Chrome < 50, the parent of template nodes for
`transclude: "element"` directives would be improperly garbage collected
despite still having been referenced via `parentNode`.

This bug surfaced due to the introduction of lazy transclusion (652b83e),
and appears under certain circumstances when using directive start and end elements.

It should be removed some time after Chrome 50 has been released.

Fixes #14041
Closes #14286
2016-03-22 19:13:37 +01:00
Martin Staffa bbd3db14f8 perf($compile): use strict comparison for controller === '@'
In the DDO, controller can be '@', which means the controller name
is taken from the directive attribute. This is undocumented and internally
only used by ngController. There seems to be no case where converting the
controller function to a string would actually be necessary.

Related #14268
2016-03-22 11:53:48 +01:00
Steve Mao 2ad8a93657 docs($q): mention ES2015 (as a "synonym" for ES6) and remove "harmony"
Closes #14294
2016-03-22 12:03:37 +02:00
Georgios Kalpakas 9f5526f861 fix($sniffer): fix history sniffing in Chrome Packaged Apps
Although `window.history` is present in the context of Chrome Packaged Apps, it is not allowed to
access `window.history.pushState` or `window.history.state`, resulting in errors when trying to
"sniff" history support.
This commit fixes it by detecting a Chrome Packaged App (through the presence of
`window.chrome.app.runtime`). Note that `window.chrome.app` is present in the context of "normal"
webpages as well, but it doesn't have the `runtime` property, which is only available to packaged
apps (e.g. see https://developer.chrome.com/apps/api_index).

(It also also contains some style changes for making the structure and layout of `$sniffer` tests
 more consistent.)

Fixes #11932

Closes #13945
2016-03-22 11:32:18 +02:00
Wassim Chegham 7452bc4fb6 docs(guide/component-router): fix typos
Closes #14278
2016-03-22 02:13:23 +02:00
Owen Craig 4202d8a5de fix(formatNumber): handle small numbers correctly when gSize !== lgSize
By using `>=` when comparing the number length to `lgSize`, we'll provide the correct value, when
formatting numbers with different `lgSize` than `gSize`.

Fixes #14289

Closes #14290
2016-03-22 00:09:02 +02:00
Georgios Kalpakas 27ceb6a8fc test(TzDate): fix test in Australia
Probably due to implementation differences in browsers for pre-DST period (see
https://github.com/angular/angular.js/issues/5017 and especially
https://github.com/angular/angular.js/issues/5017#issuecomment-90775226 for context), some
`TzDate` tests had different behavior on different Timezones/Regions (e.g. failed in Australia,
which started to observe DST in 1971).
Since the used year (`1970`) didn't have any particular significance, this commit fixes the issue
by using a year that is more consistently handled by browsers (`2000`).

Fixes #14272

Closes #14285
2016-03-21 20:42:22 +02:00
Peter Bacon Darwin aa077e8112 feat($location): default hashPrefix to '!'
The $location service is designed to support hash prefixed URLs
for cases where the browser does not support HTML5 push-state navigation.

The Google Ajax Crawling Scheme expects that local paths within a SPA start
with a hash-bang (e.g. `somedomain.com/base/path/#!/client/side/path`).

The `$locationProvide` allows the application developer to configure the
hashPrefix, and it is normal to set this to a bang '!', but the default
has always been the empty string ''.

This has caused some confusion where a user is not aware of this feature
and wonders why adding a hash value to the location (e.g. `$location.hash('xxx')`)
results in a double hash: `##xxx`.

This commit changes the default value of the prefix to '!', which is more
natural and expected.

See https://developers.google.com/webmasters/ajax-crawling/docs/getting-started

Closes #13812
Closes #14202

BREAKING CHANGE

The hash-prefix for `$location` hash-bang URLs has changed from the empty
string "" to the bang "!". If your application does not use HTML5 mode
or is being run on browsers that do not support HTML5 mode, and you have
not specified your own hash-prefix then client side URLs will now contain
a "!" prefix. For example, rather than `mydomain.com/#/a/b/c` will become
`mydomain/#!/a/b/c`.

If you actually wanted to have no hash-prefix then you should configure
this by adding a configuration block to you application:

```
appModule.config(['$locationProvider', function($locationProvider) {
  $locationProvider.hashPrefix("");
}]);
```
2016-03-21 11:17:28 +00:00
Peter Bacon Darwin 6a56461135 chore(.gitignore): ignore Visual Studio Code settings 2016-03-21 10:43:58 +00:00
surya prakash singh 7e5e66fa3c docs(input[time]): fix a typo in the example
Closes #14220
2016-03-21 01:25:20 +02:00
Rongduan Zhu 9ea5f73f73 docs(guide/component-router): changed path to match diagram
Closes #14277
2016-03-20 23:59:30 +02:00
Georgios Kalpakas 3e9015019f docs(CHANGELOG.md): rearrange v1.5.1 to be right below v1.5.2
Moved the `v1.5.1` section above the `v1.4.10` one, so that it is right below the `v1.5.2` section
for easier reference. Also removed an empty "Breaking Changes" sub-section.

Closes #14283
2016-03-20 22:52:33 +02:00
Georgios Kalpakas 22dee1159c chore(ci-checks): fix the ddescribe-iit task for Jasmine 2
Closes #14276
2016-03-20 22:20:33 +02:00
Matias Niemelä c9b4251413 chore(CHANGELOG): update version reference 2016-03-18 15:38:18 -07:00
Matias Niemelä b0f2ee7cc4 docs(CHANGELOG): add notes for v1.5.2 2016-03-18 15:13:22 -07:00
Martin Staffa e166621c9d fix(ngAnimate.$animate): remove animation callbacks when the element is removed
The test for this didn't actually test the listener removal. The addClass animation after
the element removal didn't start because the enter animation was still in progress.
2016-03-18 15:55:25 +01:00
Jason Bedard a1010c5f74 style($compile,$controller): adding function names for debug/tracing
Closes #13420
2016-03-18 15:44:43 +01:00
Jason Bedard 71e6ccbca6 style($templateRequest): rename minError var to avoid name conflict
Closes #13701
2016-03-18 15:44:34 +01:00
Jason Bedard 03c572551d style(ngModel,ngOptions): make use of declared but unused variables 2016-03-18 15:44:28 +01:00
Jason Bedard ac35b416fb style(*): remove unused variables 2016-03-18 15:44:28 +01:00
Martin Staffa 4ef0c7bac0 docs(guide/Services): add whitespace in code example
Closes #14156
2016-03-18 15:40:57 +01:00
Huc Arnaud 038eabe8db docs(error/tplrt): add missing ' in example code
Missing a ' @ line 46 class='wrapper'

Closes #14258
2016-03-18 15:40:54 +01:00
Maxim Salnikov 25bac4e520 docs(guide/Component Router): fix typo in example code
Closes #14262
2016-03-18 15:40:45 +01:00
Georgios Kalpakas 82a4545e77 docs(CHANGELOG.md): add notes for v1.4.10 2016-03-16 21:16:10 +02:00
Michał Gołębiowski b8343e213f tests(jQuery): make the tests pass on jQuery 3.0.0-beta1
Closes #14229
2016-03-16 18:24:28 +00:00
Michał Gołębiowski 5b2f6fa91f tests(jQuery): test on both oldest & latest supported jQuery version 2016-03-16 18:23:52 +00:00
Michał Gołębiowski 867f1db04c chore(jqLite): stop patching the change jQuery special handler
Code patching the change event in jQuery doesn't exist in jQuery 2 so this patch
hasn't been needed since Angular 1.3
2016-03-16 18:23:51 +00:00
Michał Gołębiowski c011215b7f refactor(jqLite): don't pass useCapture to add/removeEventListener
The useCapture parameter defaults to false even in oldest of our supported
browsers; this is no longer needed. jQuery has removed it in 2.2 as well.
2016-03-16 18:23:51 +00:00
Georgios Kalpakas 99f7302490 docs(CHANGELOG.md): fix typo in anchor name 2016-03-16 19:54:55 +02:00
Josh Schneider 208b84bef1 docs(guide/component-router): fix incorrect hook name for $canActivate
The hook will most likely be named back to `$routerCanActivate` in the future,
but for now this change is accurate.

Closes #14237
2016-03-16 16:45:01 +00:00
Peter Bacon Darwin a9bbfff44b chore(travis): update node and browser versions 2016-03-16 13:58:57 +00:00
Georgios Kalpakas d2cc451b1a docs(CHANGELOG.md): add notes for v1.5.1 2016-03-16 14:13:54 +02:00
Peter Bacon Darwin 693bf61546 chore(jenkins): update node version to 4.4 2016-03-16 11:07:10 +00:00
Peter Bacon Darwin 511503ef3c chore(jenkins): fix node version chooser in build scripts
The `set-node-version.sh` script was being run in its own shell and so
was not actually changing the current version of node.
2016-03-16 11:07:10 +00:00
Lucas Mirelmann eb16611c51 chore(*): Upgrade to Jasmine 2.4
Highlights:
New mechanism to run async tests as Jasmine 2 removed `runs`, `waits` and `waitsFor`
The functions `iit`, `ddescribe` and `tthey` were renamed `fit`, `fdescribe` and
`fthey` as the originals came from Karma, Karma no longer bundles Jasmine and the
new function name comes from Jasmine.

Closes #14226
2016-03-16 09:15:21 +00:00
Peter Bacon Darwin a4e60cb697 docs(guide/location): include section on base[href]
Closes #14018
2016-03-14 14:45:29 +00:00
Lucas Mirelmann 81150ac77d feat($parse): Allow user-defined literals
Allow user-defined literals.

Close: #9504
Close: #9492
Close: #14194
2016-03-13 20:41:23 +01:00
lordg 7ecfa5deba docs(guide/Component Router): adjust the order in the menu
Component Router should come after the menu topic Components as Components should be understood first
before Component Routers. This made it easier to read the Component Routers topic.

Closes #14214
2016-03-11 14:21:38 +01:00
Martin Staffa 567f9b0136 chore: streamline issue/pr templates
Removes the bullet points and makes all prompts bold,
which should make it easier to see which content has been
added by the issue author
2016-03-11 14:21:16 +01:00
Thanos Korakas 0c2d3988ab docs(guide/component): use ctrl instead of this (for consistency)
Closes #14215
2016-03-11 09:34:14 +02:00
Gordon Zhu efd448d7d3 docs(guide/unit-testing): fix typo
Closes #14198
2016-03-09 00:54:07 +02:00
mohamed amr db281c133d refactor(*): use toBeUndefined consistently
Closes #14185
Fixes #14184
2016-03-07 10:35:54 +00:00
Peter Bacon Darwin 6a336ba6a0 docs(guide/component-router): initial draft for component router 0.2.0
Closes #14131
2016-03-04 13:57:15 +00:00
Martin Staffa 67a98112e4 docs($provide): clarify value and constant injectability
Closes #14168
2016-03-04 10:02:28 +01:00
Ciro Nunes f1aea54a9b docs(ngModel.NgModelController): fix typo
Closes #14157
2016-03-02 19:22:19 +01:00
Martin Staffa 663788d8c1 docs(changelog, migration): add BC notice for allowed form name values
Introduced by https://github.com/angular/angular.js/commit/94533e570673e6b2eb92073955541fa289aabe02

Closes #13771
2016-03-02 19:03:31 +01:00
Tim Ruffles af0574ebaa feat(ngMock): add sharedInjector() to angular.mock.module
Allow to opt-in to using a shared injector within a context. This allows  hooks to be
used in Jasmine 2.x.x/Mocha

Closes #14093
Closes #10238
2016-03-01 11:38:27 +00:00
Ivo Mirra 4883e95797 refactor(*): move noop functions to angular.noop
Closes #14151
2016-02-29 18:08:03 +01:00
Georgios Kalpakas 9c7c494c3e docs(errorDisplay): encode < and > in error messages
When an error message contains an HTML string (e.g. `$location:nobase` containing `<base>`), it was
interpreted as a literal HTML element, instead of text. Error messages are not expected to render
as HTML, but we still need to use `.html()` in `errorDisplay`, so that the links created by
`errorLinkFilter` are properly displayed.
This commit solves this issue by replacing `<`/`>` with `&lt;`/`&gt;`.

Related to #14016.
2016-02-29 17:19:29 +01:00
Georgios Kalpakas 321180af13 test(docs): add tests for the errors module 2016-02-29 17:19:29 +01:00
Jason Bedard e2898c9436 refactor($compile): move setup/get controller methods out of the compile node closure
Closes #13427
2016-02-29 17:19:29 +01:00
Jason Bedard c52d0957de refactor($compile): remove out of date jQuery vs jqLite comment/workaround 2016-02-29 17:19:29 +01:00
Nabil Hashmi 7bdc6cb358 docs($http): fix typo in link text (TransformationjqLiks --> Transformations)
Closes #14149
2016-02-28 23:07:45 +02:00
Martin Staffa 2c54a3c081 fix(ngOptions): always set the 'selected' attribute for selected options
We don't set selected property / attribute on options that are already selected.
That happens for example if the browser has automatically selected the first
option in a select. In that case, the selected property is set automatically, but
the selected attribute is not. This doesn't impact the functionality of the select,
but it can be problematic if option elements are selected with `option[selected]` in tests.

Closes #14115
Closes #14125
2016-02-28 16:12:38 +01:00
lordg 5078c76c5d docs(guide/Interpolation): fix code example
The function getForm is receiving a variable from the view and should be using that.

Closes #14142
2016-02-28 16:04:11 +01:00
Matt Janssen 30a7e3a144 docs(guide/Components): add missing $ctrl
docs(guide/Components): add missing $ctrl

The new component example does not work as is. It needs a missing reference to $ctrl.

Closes #14138

Closes #14143
2016-02-28 16:02:42 +01:00
Georgii Dolzhykov a6afa780b7 docs(guide/Services): improve the code example
A factory that doesn't return anything is a bad example of a factory.

Closes #14139
2016-02-28 15:56:49 +01:00
lordg 3faa01fb15 docs(guide/Templates): add title for consistency
Closes #14141
2016-02-28 15:56:44 +01:00
Martin Staffa 0f5bcb7356 docs(guide/interpolation): make some minor improvements, add info
- highlight that interpolation inside expressions is bad practice
- add info about type attr in buttons in IE
2016-02-28 15:56:39 +01:00
lordg db1cf6d293 docs(guide/Filters): add title for consistency
Closes #14143
2016-02-28 15:13:01 +01:00
mohamed amr 6253de3913 test(ngAria): remove incorrect closing div tag after input element
Closes #14146
Closes #14147
2016-02-28 14:58:50 +01:00
Lucas Mirelmann 32feb2b45f refactor($compile): Create non-descriptive comments when debugInfoEnabled is false
When debugInfoEnabled is `false` when comments generated by transclusions, ngIf,
ngRepeat and ngSwitch will not contain any information about the directive nor
the expression associated with it.

Closes: #8722
2016-02-25 20:18:59 +01:00
Georgios Kalpakas 5e37b2a7fd fix(ngRoute): allow ngView to be included in an asynchronously loaded template
During it's linking phase, `ngView` relies on the info provided in `$route.current` for
instantiating the initial view. `$route.current` is set in the callback of a listener to
`$locationChangeSuccess`, which is registered during the instantiation of the `$route` service.

Thus, it is crucial that the `$route` service is instantiated before the initial
`$locationChangeSuccess` is fired. Since `ngView` declares `$route` as a dependency, the service is
instantiated in time if `ngView` is present during the initial load of the page.

Yet, in cases where `ngView` is included in a template that is loaded asynchronously (e.g. in
another directive's template), the directive factory might not be called soon enough for `$route`
to be instantiated before the initial `$locationChangeSuccess` event is fired.

This commit fixes it, by always instantiating `$route` up front, during the initialization phase.

Fixes #1213
Fixes #6812

Closes #14088
2016-02-25 11:54:20 +02:00
Martin Staffa 0749eb44e5 docs($http): add a note about modifying data in transformRequest
Closes #12468
2016-02-24 17:35:54 +01:00
Peter Bacon Darwin c900b9c531 docs(guide/security): provide more information about security features
Thanks to Jim Manico for help updating this guide.
2016-02-24 13:19:05 +00:00
Steve Shaffer 6a4597b47d docs(guide/Internet Explorer Compatibility): Add ng-attr-type workaround for buttons in IE
Closes #14117
Closes #14119
2016-02-24 11:39:58 +00:00
Foxandxss d7cb37032b chore(ISSUE_TEMPLATE): fix typo in ISSUE_TEMPLATE
Closes #14121
2016-02-24 11:36:47 +00:00
Vadorequest 76f47d5632 feat($controllerProvider): add a has() method for checking the existence of a controller
Fixes #13951

Closes #14109
2016-02-24 00:00:13 +02:00
Georgios Kalpakas 871bebf7dc fix(ngMock): don't break if $rootScope.$destroy() is not a function
Previously, `angular-mocks` was calling `$rootScope.$destroy()` after each test as part of it's
cleaning up, assuming that it was always available. This could break if `$rootScope` was mocked
and the mocked version didn't provide the `$destroy()` method.
This commit prevents the error by first checking that `$rootScope.$destroy` is present.

Fixes #14106

Closes #14107
2016-02-23 23:18:18 +02:00
Peter Bacon Darwin 7e112c1fc3 feat($compile): add custom annotations to the controller
This means that we can access these annotations, such as
`$routeConfig` and `$routerCanActivate` without highjacking
the `ng` module.

Closes #14114
2016-02-23 18:55:18 +00:00
Georgios Kalpakas 59aef48281 refactor(ngMock): make ngMock minification-safe
It is not common, but some workflows result in `angular-mocks` being minified.

Fixes #13542

Closes #14073
2016-02-23 14:22:52 +02:00
marvin sl 2ffda41ab0 docs(guide/animations): fix typos in example
Closes #14111
2016-02-23 14:12:53 +02:00
Igor Dolgov f70237a3e8 docs(ngMock): add missing ")" in example
Closes #14112
2016-02-23 13:51:47 +02:00
Martin Staffa 3c86212710 chore: add issue and PR templates 2016-02-22 23:19:45 +01:00
Georgios Kalpakas 85ef70f428 fix(ngMock): prevent memory leak due to data attached to $rootElement
Starting with 88bb551, `ngMock` will attach the `$injector` to the `$rootElement`, but will never
clean it up, resulting in a memory leak. Since a new `$rootElement` is created for every test,
this leak causes Karma to crash on large test-suites.
The problem was not detected by our internal tests, because we do our own clean-up in
`testabilityPatch.js`.

88bb551 was revert with 1b8590a.
This commit incorporates the changes from 88bb551 and prevents the memory leak, by cleaning up all
data attached to `$rootElement` after each test.

Fixes #14094

Closes #14098
2016-02-22 15:57:10 +02:00
anh a7244fdcb0 docs(guide/component): fix $componentController usage
Fixes #14091

Closes #14092
2016-02-22 13:41:09 +02:00
Martin Staffa 565391d30a chore(travis): update Chrome and FF versions, add Safari 9
Closes #13888
2016-02-22 11:24:32 +00:00
Georgios Kalpakas a88473db8a test($resource): clean up commented out code
Closes #13891
Closes #13895
2016-02-22 11:21:02 +00:00
Ben Elliott 68f528aa04 docs(ngMessages): clarify ngMessages docs with clearer example
Closes #14103
2016-02-22 12:04:43 +01:00
Kin 3671adbba6 docs(numberFilter): improve wording for infinity description
Closes #14100
2016-02-22 12:04:43 +01:00
Kin 1edb13f784 docs(angular.forEach): fix typo 2016-02-22 12:04:43 +01:00
Ryo Utsunomiya 113a946a99 docs(guide/components): fix typo
Closes #14099
2016-02-21 10:03:15 +00:00
Gordon Zhu 70caf84634 docs(guide/index): add Firebase Foundations and Angular Course
Closes #14097
2016-02-21 07:52:03 +00:00
Matias Niemelä 1b8590a7c5 revert: fix(ngMock): attach $injector to $rootElement
This reverts commit 88bb5518eb.

The fixes applied in the reverted commit caused a memory leak
with JQuery + Karma.
2016-02-20 21:33:29 -08:00
Georgios Kalpakas 9955bd05ed docs(guide/migration): remove redundant horizontal ruler 2016-02-21 01:18:39 +02:00
Yonatan Kra 02a9543189 docs(guide/component): make clear when required controllers are available
It was unclear that the required controllers are available only just before the `$onInit` lifecycle
hook is triggered.

Closes #14096
2016-02-21 01:12:51 +02:00
TepigMC eda7ef66f7 docs(README.md): fix typo
Closes #14090
2016-02-21 00:50:58 +02:00
MicCarr 2d6c218327 docs(ngMock): fix typo in example
Closes #14069
2016-02-18 14:12:26 +02:00
Jason Bedard 7324804bf5 fix(input): re-validate when partially editing date-family inputs
Fixes #12207
Closes #13886
2016-02-18 10:54:30 +02:00
ryanhart2 84c04b0b68 docs($http): improve description of caching
Included changes:

* Point out that only GET & JSONP requests are cached.
* Explain that the URL+search params are used as cache keys (headers not considered).
* Add note about cache-control headers on response not affecting Angular caching.
* Mention `$httpProvider.defaults.cache` (in addition to `$http.defaults.cache`).
* Clear up how `defaults.cache` and `config.cache` are taken into account for determining the
  caching behavior for each request.

Fixes #11101
Closes #13003
2016-02-18 00:54:18 +02:00
Jason Bedard 735be18344 fix(formatNumber): allow negative fraction size
Closes #13913
2016-02-17 15:42:17 +02:00
Aftab Ansari 3ea4477266 docs(README.md): fix typo
Closes #14062
2016-02-17 15:30:39 +02:00
Georgios Kalpakas 0b1b9112a3 fix(copy): add support for copying Blob objects
Although `copy()` does not need to (and never will) support all kinds of objects, there is a
(not uncommon) usecase for supporting `Blob` objects:

`ngMock`'s `$httpBackend` will return a copy of the response data (so that changes in one test won't
affect others). Since returning `Blob` objects in response to HTTP requests is a valid usecase and
since `ngMocks`'s `$httpBackend` will use `copy()` to create a copy of that data, it is reasonable
to support `Blob` objects.
(I didn't run any benchmarks, but the additional check for the type of the copied element should
have negligible impact, compared to the other stuff that `copy()` is doing.)

Fixes #9669

Closes #14064
2016-02-17 14:33:50 +02:00
Martin Staffa 489835dd0b chore(docs-app): fix middle/right dropdown clicks in FF
Closes #14024
2016-02-17 11:23:05 +01:00
Martin Staffa adbc2b10d2 chore(docs-app): remove obsolete directives
Most of the directives in bootstrap.js haven't been in use since
https://github.com/angular/angular.js/commit/389d4879da4aa620ee95d789b19ff9be44eb730a:
Dropdown-related directives were moved to dropdown-toggle.js, and for
foldout, popover and syntax, the uses and tests were removed, but not the directives themselves.

The last use of tabbable was removed in
https://github.com/angular/angular.js/commit/6b7a1b82bc26bbf4640506a9a3cf37ebf254d3d2
2016-02-17 11:23:05 +01:00
biohazardpb4 ea6c2473c1 fix(ngMockE2E): pass responseType to $delegate when using passThrough
The `ngMockE2E` `$httpBackend` has a mechanism to allow requests to pass through, if one wants to
send a real HTTP request instead of mocking. The specified `responseType` of the request was never
passed through to the "real" `$httpBackend` (of the `ng` module), resulting in it being effectively
ignored.

Fixes #5415

Closes #5783
2016-02-17 00:53:38 +02:00
Georgios Kalpakas b43768a345 docs(guide/forms): make required ngModel optional in custom e-mail RegExp example 2016-02-16 22:52:21 +02:00
Alexander e47957248f docs(guide/component): use fieldType property in component's template
Closes #14059
2016-02-16 22:43:02 +02:00
srijan 019900d7c2 docs(guide/scope): fix typo in image
Closes #13724
2016-02-16 21:49:45 +02:00
Georgios Kalpakas 88bb5518eb fix(ngMock): attach $injector to $rootElement
Fixes #14022

Closes #14034
2016-02-16 21:37:58 +02:00
Martin Staffa 3940edced4 test(*): ensure console log doesn't break the app in IE9
When Angular is loaded more than once (by including the script multiple times),
a warning is logged in the console. IE9 only makes the console available when
the dev tools are open, so before this fix, the browser would throw an error

Note that Protractor doesn't actually support IE9.
2016-02-16 17:01:13 +01:00
lucienbertin 7c60e19eb8 fix(*): only call console.log when window.console exists
`window.console` only exists in IE 8 & 9 when the devtools are open

Fixes #14006
Closes #14007
Closes #14047
2016-02-16 17:00:55 +01:00
alex-teren 632fa30fe3 docs(README.md): fix casing
Closes #14050
2016-02-16 14:46:43 +02:00
Sean Murphy bf2a76d32f fix($routeProvider): properly handle optional eager path named groups
Closes #14011
2016-02-16 14:29:43 +02:00
Lucas Mirelmann 9421674dad fix(dateFilter): Correctly format BC years
- Correctly format BC years
- Fix a function name collition
- Allow TzDate to use BC years
2016-02-14 20:17:42 +01:00
Remy Sharp ece8266b01 docs(error/$location:nobase): fix <base> not showing up in heading
Closes #14016
2016-02-13 20:14:42 +02:00
Wesley Cho b8b5b885f7 docs($compile): change component example to use controllerAs
Closes #14010
2016-02-12 12:30:01 +01:00
Georgios Kalpakas e4e30961ca feat(dateFilter): add support for STANDALONEMONTH in format (LLLL)
Fixes #13999

Closes #14013
2016-02-12 13:12:33 +02:00
Lucas Mirelmann 1061c56fe1 fix($compile): allow directives to have decorators
Allow directives to have decorators that modify the directive `scope` property

Close: #10149
2016-02-12 11:24:41 +01:00
Lucas Mirelmann 7617c08da6 fix($compile): do not add <span> elements to root text nodes
BREAKING CHANGE:

Text nodes at the root of transcluded content will no longer be wrapped into <span>
elements. If there is a need for this <span> element to be present, then this should
be added to the content to be transcluded.

Before:

```html
<div directive-that-will-transclude-the-content>
  I expect this content to e wrapped
</div>
```

After:

```html
<div directive-that-will-transclude-the-content>
  <span>I expect this content to e wrapped</span>
</div>
```
2016-02-12 11:23:58 +01:00
Lucas Mirelmann a021a376fc style($compile): Style fixes 2016-02-12 11:20:02 +01:00
Martin Staffa a7d69c9d42 docs: allow plnkr links to open in new window
Closes #8328
Closes #14008
2016-02-11 06:25:57 -08:00
Gabriel Monteagudo f0f6da304c fix($resource): fix parse errors on older Android WebViews
Error is caused by reserved keyword 'finally'.

Closes #13989
2016-02-10 12:32:10 +02:00
Lee Adcock 9425015a69 fix(input[date]): support years with more than 4 digits
Previously, the date-related regular expressions only matched years with no more than 4 digits.
This commit adds support for years with more than 4 digits. It also resolves an ambiguity in
`ISO_DATE_REGEXP` by matching the whole string (when it previosuly allowed extra characters around
the date string).

Fixes #13735
Closes #13905
2016-02-10 11:58:03 +02:00
Martin Sikora 7b592f9edd docs(error/$compile:tplrt): fix typo
Closes #13992
2016-02-10 11:03:05 +02:00
Daniel Herman c966876e57 perf(ngAnimate): avoid jqLite/jQuery for upward DOM traversal
The `parentNode` property is well supported between all browsers.  Since
no other functionality was required here other than traversing upwards
using `.parent()`, we can use the DOM API directly.

Closes: #13879
2016-02-09 21:28:58 +01:00
Daniel Herman bfce0675e2 perf(ngAnimate): avoid $.fn.data overhead with jQuery
Unlike jqLite, jquery scrapes the attributes of an element looking for
data- keys that match the requested property.  When many elements are
being animated due to something like `ngRepeat` unrolling within one
digest cycle, the amount of time spent in that one function quickly adds
up.

By changing our API to use the lower level data API, we can cut the time
spent in this function by half when jQuery is loaded.
2016-02-09 21:28:42 +01:00
Daniel Herman 2e3c6404f2 perf(ngRepeat): avoid duplicate jqLite wrappers
Internally, `$animate` already wraps elements passed through with
`jqLite`, so we can avoid needless duplication here.
2016-02-09 21:28:28 +01:00
Martin Staffa b04871b43f docs(*): clarify limitations of app bootstrapping
- Note that bootstrapping on elements with transclusion directives
is dangerous and not recommended.

- group info on limitations, and add them to the guide

Closes #11421
Closes #13572
Closes #12583
2016-02-09 11:41:54 +01:00
Martin Staffa 4ba8e3463a docs(ngRepeat): clarify limitations of object iteration
Related #6266
2016-02-09 11:36:36 +01:00
Peter Bacon Darwin 9881e77ccb refactor($componentController): don't return an object from the provider constructor function
Closes #13969
Closes #13977
2016-02-08 16:09:41 -08:00
Martin Staffa 17ba2a6e7c docs(guide/Unit Testing): add info about promises
Related #1915
2016-02-08 23:50:28 +01:00
Georgios Kalpakas 3bfeda3b2b docs(guide/migration): document a BC to ngAria (d06431e)
Closes #13949
2016-02-08 23:25:23 +02:00
Martin Staffa 4fed66da6c docs(guide/animation): add info on various topics
- how to enable / disable animations

Closes #8812

- how to handle conflicts with existing animations

Closes #8033
Closes #11820

- what happens on boostrap / how to enable animations on bootstrap
2016-02-08 16:56:36 +01:00
Martin Staffa 7de7059f95 docs: clean up formatting of animation events
Closes #12670
Closes #10742
2016-02-08 16:56:36 +01:00
Aashish Nagpal cff232a8a2 docs(README.md): add purpose section
Add a new purpose section to enable newcomers (technical and non-technical)
better understand the purpose of AngularJS

Close #13963
2016-02-08 02:12:06 -08:00
John Mercer 614ecb7aa6 docs(guide): add new book
Closes #13954
2016-02-08 02:05:47 -08:00
Prayag Verma 77b1407e0d docs(guide/migration): fix typo (a --> an)
Closes #13959
2016-02-06 16:12:04 +02:00
Martin Staffa c4e47e491f docs(error/iscp): include one-way bindings, mark spaces as allowed 2016-02-05 16:12:00 +01:00
Martin Staffa 87ac4443b6 docs(guide/components): update to use one-way binding 2016-02-05 16:12:00 +01:00
Martin Staffa 75f23f0b87 style(filters): squelch a closure compiler warning
Related #13932
2016-02-05 16:05:07 +01:00
Peter Bacon Darwin 39eecd136f docs(CHANGELOG): add notes for 1.5.0 release 2016-02-05 10:04:17 +00:00
kuroky360 260cfe6dc9 refactor(toJson): use the isUndefined() function
Closes #13923
2016-02-04 10:35:48 +02:00
Georgios Kalpakas 455af41a19 docs(guide/migration): mention isolate scope one-way bindings
Closes #13940
2016-02-04 10:28:47 +02:00
campersau f3c8aa2790 refactor(ngAria): remove unused dependency from ngModel directive
Mentioned in https://github.com/angular/angular.js/commit/d06431e5309bb0125588877451dc79b935808134#commitcomment-15871053.

Closes #13942
2016-02-04 01:05:08 +02:00
Georgios Kalpakas e2312e3efd docs(ngRequired): fix link 2016-02-04 00:12:58 +02:00
Georgios Kalpakas a460ce4665 refactor(ngAria): remove redundant '?' in DDO's require
It also fixes some dangling links in Accessibility guide.
2016-02-03 23:54:43 +02:00
Marcy Sutton d06431e530 fix(ngAria): Apply ARIA attrs correctly
BREAKING CHANGE: Where appropriate, ngAria now applies ARIA to custom controls only, not native inputs. Because of this, support for `aria-multiline` on textareas has been removed.

New support added for ngValue, ngChecked, and ngRequired, along with updated documentation.

Closes #13078
Closes #11374
Closes #11830

Closes #13483
2016-02-03 23:18:49 +02:00
Georgios Kalpakas 34ec0d9629 docs(guide/migration): add TOC and fix heading levels
Closes #13938
2016-02-03 20:23:11 +02:00
Martin Staffa 4ac23c0ac5 feat($compile): add one-way binding to the isolate scope definition
This change allows the developer to bind an isolate scope / controller property
to an expression, using a `<` binding, in such a way that if the value of the
expression changes, the scope/controller property is updated but not the
converse.

The binding is implemented as a single simple watch, which can also provide
performance benefits over two way bindings.

Closes #13928
Closes #13854
Closes #12835
Closes #13900
2016-02-03 14:01:21 +00:00
Georgii Dolzhykov 507cf31ff9 docs($compile): refine explanation of isolate scope =-binding
The current version of this paragraph is in many ways inaccurate and confusing.

Closes #13921
2016-02-03 14:59:10 +02:00
Georgios Kalpakas 91414918d7 docs(guide/accessibility): fix links
Closes #13936
2016-02-03 12:17:31 +02:00
Georgios Kalpakas 52c21fe51d docs(CHANGELOG.md): more explicitly mention that the usemap posed security risks
(Related to https://github.com/angular/angular.js/pull/13826#issuecomment-178868005.)
2016-02-03 12:11:50 +02:00
Georgios Kalpakas 2f0a50b526 fix($route): allow preventing a route reload
Fixes #9824
Closes #13894
2016-02-02 23:14:14 +02:00
Georgios Kalpakas 4a80a2e8bc docs(guide/migration): update with changes from v1.5.0-rc.2
Closes #13919
2016-02-02 21:34:47 +02:00
Georgios Kalpakas 446fac84d9 docs(CHANGELOG.md): document 234053f as a BC
Closes #13927
2016-02-02 14:31:36 +02:00
thorn0 43f72066e1 refactor(injector): remove unneeded JSHint directives
Closes #13922
2016-02-02 13:51:53 +02:00
Georgios Kalpakas a909ed1a5c docs(CHANGELOG.md): fix function name ($ngOnInit --> $onInit) 2016-02-01 22:15:49 +02:00
Lucas Mirelmann 1c6edd416b fix($rootScope): Set no context when calling helper functions for $watch
When calling a $watch getter or listener, do not expose the inner workings with `this`.

Closes: #13909
2016-02-01 21:05:34 +01:00
Georgios Kalpakas 8bda5ec735 docs(guide/directive): minor fixes/improvements
Closes #13908
2016-02-01 15:12:19 +01:00
Wojciech Krzystek 23395ce07d docs($http): reword the XSRF attack overview
Previous version emphasised "gaining user's private data".
While this perfectly describes JSON vulnerability (which is based on XSRF),
data theft suits XSS more.
Pure XSRF is more about performing requests that have side effects.

Closes #13901
2016-01-31 13:21:33 +02:00
Prayag Verma c81c9e7cf4 docs(misc/downloading): fix typo (it --> in)
Closes #13899
2016-01-31 10:45:51 +02:00
Georgii Dolzhykov 344b4bcb95 docs(TRIAGING.md): fix a broken link
Closes #13904
2016-01-31 10:37:36 +02:00
Smith 34ba294f76 docs(error/$rootScope:inprog): fix typos ("a $apply" --> "an $apply")
Closes #13896
2016-01-31 10:32:10 +02:00
Prayag Verma 50ecc370b9 docs(guide/component): fix typo (defintion --> definition)
Closes #13898
2016-01-31 10:24:27 +02:00
Georgios Kalpakas 622c421696 fix(dateFilter, input): fix Date parsing in IE/Edge when timezone offset contains :
When `Date.parse`-ing a date string, IE and Edge don't recognize the timezone offset in the format
`+HH:mm` (but only without the `:`). According to [the spec][1], the timezone offset should
contain `:`. The [ISO 8601 Standard][2] allows both forms (with and without `:`).
Although the `Date` implementation in JavaScript does not 100% follow the ISO 8601 Standard (it's
just _based on it_), all other browsers seem to recognize both forms as well.

[1]: http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15
[2]: https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC

Fixes #13880

Closes #13887
2016-01-30 00:05:49 +02:00
Dan Ryan db1180f3b3 docs(guide/component): fix fn parameter in example
The wrong field name was being passed into the `$ctrl.update` call in `heroDetail.html` resulting
in the wrong behavior (`name` was being updated instead of `location`)

Closes #13890
2016-01-29 16:48:18 +01:00
Georgios Kalpakas ca5b27bd0b fix(select): handle corner case of adding options via a custom directive
Under specific circumstances (e.g. adding options via a directive with `replace: true` and a
structural directive in its template), an error occurred when trying to call `hasAttribute()` on a
comment node (which doesn't support that method).
This commit fixes it by filtering out comment nodes in the `addOption()` method.

Fixes #13874
Closes #13878
2016-01-29 14:34:57 +02:00
Martin Staffa 3d158f629b docs(ngAnimateChildren) add docs 2016-01-28 21:14:53 +01:00
Martin Staffa 8aecf46ad2 fix(ngAnimateChildren): make it compatible with ngIf
Previously, ngAnimateChildren would set the data on the element
in an $observe listener, which means the data was available after one digest happend.
This is too late when the element is animated immediately after compilation, as happens with ngIf.
Now the data is also set right in the linking function.

Fixes #13865
Closes #13876
2016-01-28 21:14:40 +01:00
Martin Staffa 2072641537 docs(guide/component): add the component guide
- introduce components
- component types are based on Angular2 docs
- conceptually, we promote parent -> child data flow and clear inputs and outputs
- the info about multi-transclusion / requiring controllers, and components as route templates
has been moved from the component docs to the guide
2016-01-28 20:28:03 +01:00
Michael 63154c3d1a docs($compile): minor typo/style correction
Closes #13864
2016-01-28 19:18:20 +02:00
Lucas Mirelmann 37cb9ad436 fix($parse): Copy inputs for expressions with expensive checks
Closes: #13871
2016-01-28 15:33:39 +01:00
Peter Bacon Darwin 5a3504abdc docs(CHANGELOG): add changes for 1.5.0-rc.2 2016-01-28 09:51:01 +00:00
Martin Staffa 0dfc1dfebf fix(ngTouch): deprecate ngClick and disable it by default
This commit deprecates the ngClick directive from the ngTouch module.
Additionally, it disables it by default. It can be enabled in the new $touchProvider with
the $touchProvider.ngClickOverrideEnabled() method.

The directive was conceived to remove the 300ms delay
for click events on mobile browsers, by sending a synthetic click event on touchstart.
It also tried to make sure that the original click event that the browser sends after 300ms
was "busted", so that no redundant "ghost-clicks" appear.

There are various reasons why the directive is being deprecated.

- "This is an ugly, terrible hack!" (says so in the source)
- It is plagued by various bugs that are hard to fix / test for all platforms (see below)
- Simply including ngTouch activates the ngClick override, which means even if you simply want
to use ngSwipe, you may break parts of your app
- There exist alternatives for removing the 300ms delay, that can be used very well with Angular:
[FastClick](https://github.com/ftlabs/fastclick), [Tappy!](https://github.com/filamentgroup/tappy/)
(There's also hammer.js for touch events / gestures)
- The 300ms delay itself is on the way out - Chrome and Firefox for Android remove the 300ms delay
when the usual `<meta name="viewport" content="width=device-width">` is set. In IE, the
`touch-action` css property can be set to `none` or `manipulation` to remove the delay. Finally,
since iOs 8, Safari doesn't delay "slow" taps anymore. There are some caveats though, which can be
found in this excellent article on which this summary is based: http://developer.telerik.com/featured/300-ms-click-delay-ios-8/

Note that this change does not affect the `ngSwipe` directive.

Issues with interactive elements (input, a etc.) when parent element has ngClick:
Closes #4030
Closes #5307
Closes #6001
Closes #6432
Closes #7231
Closes #11358
Closes #12082
Closes #12153
Closes #12392
Closes #12545
Closes #12867
Closes #13213
Closes #13558

Other issues:
- incorrect event order
- incorrect event propagation
- ghost-clicks / failing clickbusting with corner cases
- browser specific bugs
- et al.

Closes #3296
Closes #3347
Closes #3447
Closes #3999
Closes #4428
Closes #6251
Closes #6330
Closes #7134
Closes #7935
Closes #9724
Closes #9744
Closes #9872
Closes #10211
Closes #10366
Closes #10918
Closes #11197
Closes #11261
Closes #11342
Closes #11577
Closes #12150
Closes #12317
Closes #12455
Closes #12734
Closes #13122
Closes #13272
Closes #13447

BREAKING CHANGE:

The `ngClick` override directive from the `ngTouch` module is **deprecated and disabled by default**.
This means that on touch-based devices, users might now experience a 300ms delay before a click event is fired.

If you rely on this directive, you can still enable it with the `$touchProvider.ngClickOverrideEnabled()`method:

```js
angular.module('myApp').config(function($touchProvider) {
  $touchProvider.ngClickOverrideEnabled(true);
});
```

For migration, we recommend using [FastClick](https://github.com/ftlabs/fastclick).
Also note that modern browsers remove the 300ms delay under some circumstances:
- Chrome and Firefox for Android remove the 300ms delay when the well-known `<meta name="viewport" content="width=device-width">` is set
- Internet Explorer removes the delay when  `touch-action` css property is set to `none` or `manipulation`
- Since iOs 8, Safari removes the delay on so-called "slow taps"

See this [article by Telerik](http://developer.telerik.com/featured/300-ms-click-delay-ios-8/) for more info on the topic.
Note that this change does not affect the `ngSwipe` directive.
2016-01-27 20:23:02 +01:00
Martin Staffa e9c406b246 fix($animateCss): cancel fallback timeout when animation ends normally
Previously, css animations would not cancel the timeout when the
animation ends normally (calling end explicitly / transitionEnd event).
This meant that the timeout callback fn was always called after 150% of
the animation time was over. Since the animation was already closed at this
point, it would not do any work twice, but simply remove the timer data
from the element.
This commit changes the behavior to cancel the timeout and remove the data
when it is found during animation closing.

Closes #13787
2016-01-27 19:27:34 +01:00
Matias Niemelä 79b6d55792 chore(travis): add an integration hook for the angular hubot daemon
Closes #13777
2016-01-27 17:47:33 +00:00
Georgios Kalpakas 8f94b5b277 docs(CHANGELOG): remove duplicates and fix typos
Removed some entries from `v1.5.0-beta.2` which are also included in `v1.5.0-beta.1`
and fixed some typos.

Closes #13858
2016-01-27 16:46:08 +00:00
Isaac b11120be0a docs($cookiesProvider): clarify parameters description
Fixed a grammatical mistake ("equals to"), made hyphenation consistent, fixed punctuation and
clarified the sentence structure.

Closes #13853
2016-01-27 16:30:46 +01:00
Martin Staffa bfba95ce46 docs($resource): fix an unmatched link 2016-01-27 16:30:46 +01:00
Thomas Moffett 310f80e78e docs(guide): change concepts.graffle/data.plist to fix 'World' spelling
The change is only to concepts.graffle/data.plist to fix 'World' spelling.
Another PR, #13724, already fixed the actual image.

Closes #13704
Closes #13734
2016-01-27 15:00:47 +00:00
Lucas Mirelmann acfda1022d fix($parse): Preserve expensive checks when runnning $eval inside an expression
When running an expression with expensive checks, there is a call to `$eval` or `$evalAsync`
then that expression is also evaluated using expensive checks

Closes: #13850
2016-01-27 15:30:50 +01:00
robw 04d4d93e5b docs(ngModel): add section explaining that ngModel watches by reference
The new section explains that changing only a property on an object doesn't
trigger re-rendering.

Closes #13224
Closes #13518
2016-01-27 14:24:34 +00:00
Georgios Kalpakas 8348365df9 fix($compile): properly denormalize templates when only one of the start/end symbols is different
Previously, if either of the start/end interpolation symbols remained unchanged (i.e. `{{` or `}}`),
then directive templates would not be denormalized properly. Changing only one of the start/end
symbols (but not both) is an uncommon but legitimate usecase.

Closes #13848
2016-01-26 20:16:49 +02:00
Georgios Kalpakas 16bcdcb61d docs(guide/migration): add notes for migrating from 1.4 to 1.5
Part of #13474 (includes changes up until `v1.5.0-rc.1`)
Closes #13808
2016-01-26 20:09:54 +02:00
Leo Gallucci adcfa74327 docs(guide/directives): improve Protractor test for bindings
This needs Protractor >= 1.3.0 to work.

Closes #9330
2016-01-26 15:09:02 +01:00
Michal Raczkowski d641901be6 feat($resource): add support for timeout in cancellable actions
Old behavior: actions can be either cancellable or have a numeric timeout.
When having both defined, cancellable was ignored.
With this commit: it's possible for actions to have both cancellable:true
and numeric timeout defined.

Example usage:

```js
var Post = $resource('/posts/:id', {id: '@id'}, {
  get: {
    method: 'GET',
    cancellable: true,
    timeout: 10000
  }
});

var currentPost = Post.get({id: 1});
...
// the next request can cancel the previous one
currentPost.$cancelRequest();
currentPost = Post.get({id: 2});

// any of those requests will also timeout, if the response
// doesn't come within 10 seconds
```

Closes #13824
2016-01-26 13:59:28 +02:00
Peter Bacon Darwin eae0a1121f chore(ngLocale): regenerate locales to include original localeId
Closes #13390
2016-01-26 11:27:22 +00:00
Peter Bacon Darwin 173c9063e7 style(i18n): improve indentation for readability 2016-01-26 11:27:14 +00:00
Peter Bacon Darwin b461551b81 chore(i18n): fix up i18n testing tools 2016-01-26 11:27:14 +00:00
Peter Bacon Darwin 63492a0261 feat($locale): Include original locale ID in $locale
Most systems use *IETF language tag* codes which are typically a combination
of the ISO 639 language code and ISO 3166-1 country code with an underscore
or hyphen delimiter. For example `en_US`, `en_AU`, etc.

Whilst the `$locale.id` comes close, the lowercase format makes it impossible
to transform to an IETF tag reliably. For example, it would be impossible
to deduce `en_Dsrt_US` from `en-dsrt-us`.

Closes #13390
2016-01-26 11:27:13 +00:00
Robert Reiz adb0e1746b docs(bower.json): add MIT license
Closes #13405
2016-01-26 11:03:28 +00:00
Zac Smith 3be79cd6a1 docs(tutorial): fix typo
Closes #13843
2016-01-26 11:07:58 +02:00
Martin Staffa e4c6e01791 docs($sceDelegateProvider): fix markdown errors
Closes #13360
2016-01-25 22:59:27 +01:00
Martin Staffa fb76d96009 docs(guide/interpolation): fix dangling link 2016-01-25 22:52:44 +01:00
Martin Staffa f322c4f3c3 docs(guide/directives): link to the scope property docs
Closes #12500
2016-01-25 22:52:44 +01:00
Robin Glauser 081f6ec7f2 docs(error/modulerr): add additional debugging help
This simple tip can help to diagnose the error.

Closes #12958
2016-01-25 17:07:20 +00:00
Moorzee 9bb6a30417 docs(tutorial/Tutorial): Java installation
Add step to ensure java is installed on development machine.

Closes #12938
2016-01-25 16:52:25 +00:00
marianoc84 97e97d1eb7 docs(guide/Modules): update style guide link
The linked blog post recommends John Papa's Guide.

Closes #12898
2016-01-25 16:34:16 +00:00
Lucas Galfaso 1ab4e44443 fix(dateFilter): follow the CLDR on pattern escape sequences
When there are two single quotes "''" (quotes for clarification) that are not
part of an escape sequence, then this sequence should be handled as one single
quote. See http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns
second and forth examples

Closes #12839
2016-01-25 14:54:15 +00:00
Livvie Lin 99eeec358c style(src): delete whitespace and use single quotes
This change edits syntax for code consistency.

It removes whitespace to match the style of the rest of the code,
and changes double quotes to single quotes to conform with
Google's JavaScript Style Guide.

Closes #12889
2016-01-25 14:52:29 +00:00
Tobias Leugger - Vibes ce8a7525cc docs(error/unpr): add hint about using ngStrictDi
The unknown provider error often happens when code is minified and one
did not use the correct syntax that supports minification. It's
frustrating to have to hunt for a bug in minified code, so adding the
simple hint that `ngStrictDi` will tell you what is wrong in the original
code will save you quite some trouble.

Closes #12717
2016-01-25 14:40:24 +00:00
Martin Raifer 5df2e5ce29 docs(tutorial/step-7): add troubleshooting instructions
Show troubleshooting instructions as in step 11.

Closes #12715
2016-01-25 14:37:00 +00:00
Alireza Mirian ef03dfc4a4 docs($injector): fix inaccuracy in $provide.service docs
Closes #12664
Closes #12665
2016-01-25 14:33:16 +00:00
Wesley Cho 4ff9c027b0 docs(compile): improve nonassign error message
- Improve error message to mention attribute the expression errored on

Fixes #13827

Closes #13828
2016-01-24 17:17:35 +01:00
Matias Niemelä 20b8ece444 fix(ngAnimate): properly cancel-out previously running class-based animations
Prior to this fix the addition and removal of a CSS class via
ngAnimate would cause flicker effects because $animate was unable
to keep track of the CSS classes once they were applied to the
element. This fix ensures that ngAnimate always keeps a reference
to the classes in the currently running animation so that cancelling
works accordingly.

The commit also adds a test for a previously untested animation merge path.

Closes #10156
Closes #13822
2016-01-23 16:28:51 +01:00
Qingyu Zhou 6406e3b01d docs(tutorial/step_12): change "click" to "hover"
Should be "hover" not "click", since we trigger the change at "mouseenter", not "click".

Closes #13831
2016-01-23 14:21:24 +02:00
Lucas Mirelmann 234053fc9a fix(ngSanitize): Blacklist the attribute usemap
Given that the attribute `name` is blacklisted, the attribute `usemap` should be
blacklisted too.

Closes: ##13826
2016-01-22 21:16:31 +01:00
Josh Duff a277bcf0f7 refactor(equals): Cleanup equals function for readability
- Removes unnecessary nested if condition
- Simplify check when one argument is a regex

Closes: #13650
2016-01-22 20:52:38 +01:00
Peter Bacon Darwin 7985416d39 docs(CHANGELOG): fix animation grouping 2016-01-21 14:30:35 +00:00
Peter Bacon Darwin dc3013e848 docs(CHANGELOG): add release notes for 1.4.9 2016-01-21 12:42:44 +00:00
Edgar Flores 0f2926db38 docs(guide/Interpolation): fix links
The links were not working, either `{` was missing or they were in the wrong location

Closes #13809
2016-01-20 21:04:50 +01:00
Lucas Galfaso bd59335eba test(input): test for #12106
Add a test that checks that an <input> value is not set when the value is equal
to the current value

Closes #12592
2016-01-20 15:11:07 +00:00
Adrian Roselli 6aa111b333 docs(tutorial/step-6): add alt attribute to images
See http://www.ssbbartgroup.com/blog/accessible-images-using-angular/

Closes #12569
2016-01-20 14:50:53 +00:00
Martin Staffa 42b5ce99fb docs(guide/filter): clarify how to use filters in controllers
Closes #11915
2016-01-20 10:41:15 +01:00
Matias Niemelä 2cb1989d12 chore($AnimateRunner): examine the document more carefully
Some internal tests were failing because the `$document[0]` value
was null. This fix ensures that the if statement surrounding that
is more careful.
2016-01-19 13:27:38 -08:00
Martin Staffa 1137d91abd docs(ngRepeat): point out animate example, remove ng-init
Closes #9047
2016-01-19 20:09:29 +01:00
Maxime Lasserre 288e4e33c3 docs($animate): make naming consistent
In the description of the example, you use `element` to refer to the container parameter and
`listenerFn` to refer to the callback parameter.

Closes #12716
2016-01-19 20:09:29 +01:00
Daniel Herman d98c5f03a4 chore($compile): remove an unused dependency
Fixes #13791

Closes #13801
2016-01-19 20:25:36 +02:00
Peter Bacon Darwin 8d20b04f1c docs($compile): fix typo 2016-01-19 18:07:25 +00:00
Peter Bacon Darwin 56c3666fe5 feat($compile): allow required controllers to be bound to the directive controller
If directives are required through an object hash, rather than a string or array,
the required directives' controllers are bound to the current directive's controller
in much the same way as the properties are bound to using `bindToController`.

This only happens if `bindToController` is truthy.

The binding is done after the controller has been constructed and all the bindings
are guaranteed to be complete by the time the controller's `$onInit` method
is called.

This change makes it much simpler to access require controllers without the
need for manually wiring them up in link functions. In particular this
enables support for `require` in directives defined using `mod.component()`

Closes #6040
Closes #5893
Closes #13763
2016-01-19 18:07:24 +00:00
Peter Bacon Darwin cd21216ff7 feat($compile): allow require to be an object
This provides an elegant alternative to the array form of the `require`
property but also helps to support binding of `require`d controllers
to directive controllers.

Closes #8401
Closes #13763
2016-01-19 18:06:50 +00:00
Peter Bacon Darwin 3ffdf380c5 feat($compile): call $ngOnInit on directive controllers after controller construction
This enables option three of https://github.com/angular/angular.js/issues/13510#issuecomment-164140194
by allowing the creator of directive controllers using ES6 classes to have a hook
that is called when the bindings are definitely available.

Moreover this will help solve the problem of accessing `require`d controllers
from controller instances without resorting to wiring up in a `link` function.
See https://github.com/angular/angular.js/issues/5893

Closes #13763
2016-01-19 18:06:30 +00:00
Peter Bacon Darwin db5e0ffe12 fix($compile): handle boolean attributes in @ bindings
Closes #13767
Closes #13769
2016-01-19 16:35:37 +00:00
Daniel Herman 92e4801d88 perf($compile): avoid needless overhead when wrapping text nodes
This commit positively affects performance in two main ways:

1,  When wrapping text nodes in the compile step, we do not need the overhead
of the `forEach` function versus a normal for loop since we do not make
use of the closure for anything.

2.  When actually wrapping the node, we can completely bypass jqLite which
avoids several function calls and the overhead of cloning the wrapper node
which we already know to be unique.

Tests in applications show about an 83% decrease in time spent in this
specific loop.
2016-01-19 16:24:53 +00:00
thorn0 6a92e9111f docs(uppercase, lowercase): undocument these artifacts
Closes #11387
Closes #13779
2016-01-19 16:12:11 +00:00
Georgios Kalpakas ba6d37756e docs(ngModel): rename $asyncValidators error to nopromise and add missing error page
Closes #13795
2016-01-19 16:05:45 +02:00
Martin Staffa 683bd92f56 perf(ngAnimate): speed up areAnimationsAllowed check
This commit speeds up the code that checks if an element can
be animated, for the following two cases:

The checks will be sped up in cases where the animation
is disabled via $animate.enabled(element, false) on any parent element.

A minor speed-up is also included for cases where the $rootElement of the
app (the bootstrap element) is on the body or lower in the DOM tree.
2016-01-19 13:14:04 +01:00
Martin Staffa 7700e2df09 fix($animate): correctly handle $animate.pin() host elements
This commit fixes two bugs:
1) Previously, animate would assume that a found host element
was part of the $rootElement (while it's possible that it is also outside the root).

2) Previously, if a parent of the animated element was pinned to a host element, the
host would not be checked regarding animations enabled status etc.

Closes #13783
2016-01-19 13:14:04 +01:00
Martin Staffa 3fb809e412 docs($compile): correct transcludeControllers definition
Closes #13793
2016-01-19 12:08:08 +01:00
Matias Niemelä 52ea4110d3 fix(ngAnimate): ensure that animate promises resolve when the document is hidden
Prior to this fix any promise/callback chained on a call to the $animate
methods would only flush if and when the browser page is visible. This
fix ensures that a timeout will be used instead when the document
is hidden.
2016-01-17 20:00:49 +01:00
Matias Niemelä a3a7afd3aa fix(ngAnimate): do not trigger animations if the document is hidden
Prior to this fix, ngAnimate would always trigger animations even if
the browser tab or browser window was not visible. This would cause
issues with class updates / DOM operations even if elements were not
using animations. The root cause is that browsers do not flush calls to
requestAnimationFrame when browser windows / tabs are not visible.

This fix disables animations if `document.hidden` is `true`.

Closes #12842
Closes #13776
2016-01-17 20:00:41 +01:00
Martin Staffa 20bc37fbc8 chore(benchmark): improve largetable layout 2016-01-17 19:55:39 +01:00
Martin Staffa 7761b6c3b0 docs(CHANGELOG): add missing breaking changes for 1.5.0-rc.1, fix layout
- add missing component() breaking changes
- put component related feats/fixes under "component"
- move features above fixes
2016-01-17 19:26:23 +01:00
1521 changed files with 185046 additions and 65332 deletions
+10
View File
@@ -0,0 +1,10 @@
bower_components/**
build/**
docs/app/assets/js/angular-bootstrap/**
docs/config/templates/**
node_modules/**
lib/htmlparser/**
src/angular.bind.js
src/ngParseExt/ucd.js
i18n/closure/**
tmp/**
+117
View File
@@ -0,0 +1,117 @@
{
"rules": {
// Rules are divided into sections from http://eslint.org/docs/rules/
// Possible errors
"comma-dangle": ["error", "never"],
"no-cond-assign": ["error", "except-parens"],
"no-constant-condition": ["error", {"checkLoops": false}],
"no-control-regex": "error",
"no-debugger": "error",
"no-dupe-args": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-empty-character-class": "error",
"no-empty": "error",
"no-ex-assign": "error",
"no-extra-boolean-cast": "error",
"no-extra-semi": "error",
"no-func-assign": "error",
"no-inner-declarations": "error",
"no-invalid-regexp": "error",
"no-irregular-whitespace": "error",
"no-negated-in-lhs": "error",
"no-obj-calls": "error",
"no-regex-spaces": "error",
"no-sparse-arrays": "error",
"no-unreachable": "error",
"use-isnan": "error",
"no-unsafe-finally": "error",
"valid-typeof": "error",
"no-unexpected-multiline": "error",
// Best practices
"accessor-pairs": "error",
"array-callback-return": "error",
"eqeqeq": ["error", "allow-null"],
"no-alert": "error",
"no-caller": "error",
"no-case-declarations": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-label": "error",
"no-fallthrough": "error",
"no-floating-decimal": "error",
"no-implied-eval": "error",
"no-invalid-this": "error",
"no-iterator": "error",
"no-multi-str": "error",
"no-new-func": "error",
"no-new-wrappers": "error",
"no-new": "error",
"no-octal-escape": "error",
"no-octal": "error",
"no-proto": "error",
"no-redeclare": "error",
"no-return-assign": "error",
"no-script-url": "error",
"no-self-assign": "error",
"no-self-compare": "error",
"no-sequences": "error",
"no-throw-literal": "error",
"no-unmodified-loop-condition": "error",
"no-unused-expressions": "error",
"no-unused-labels": "error",
"no-useless-call": "error",
"no-useless-concat": "error",
"no-useless-escape": "error",
"no-void": "error",
"no-with": "error",
"radix": "error",
"wrap-iife": ["error", "inside"],
// Strict mode
"strict": ["error", "global"],
// Variables
"no-delete-var": "error",
"no-label-var": "error",
"no-restricted-globals": ["error", "event"],
"no-shadow-restricted-names": "error",
"no-undef-init": "error",
"no-undef": "error",
"no-unused-vars": ["error", { "vars": "local", "args": "none" }],
// Node.js
"handle-callback-err": "error",
// Stylistic issues
"array-bracket-spacing": ["error", "never"],
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
"comma-style": ["error", "last"],
"eol-last": "error",
"keyword-spacing": "error",
"linebreak-style": ["error", "unix"],
"max-len": ["error", { "code": 200, "ignoreComments": true, "ignoreUrls": true }],
"new-cap": "error",
"new-parens": "error",
"no-array-constructor": "error",
"no-bitwise": "error",
"no-mixed-spaces-and-tabs": "error",
"no-multiple-empty-lines": ["error", { "max": 3, "maxEOF": 1 }],
"no-whitespace-before-property": "error",
"no-spaced-func": "error",
"no-trailing-spaces": "error",
"no-unneeded-ternary": "error",
"quotes": ["error", "single"],
"semi-spacing": "error",
"semi": "error",
"space-before-blocks": ["error", "always"],
"space-before-function-paren": ["error", "never"],
"space-in-parens": ["error", "never"],
"space-infix-ops": "error",
"space-unary-ops": ["error", { "words": true, "nonwords": false }],
"unicode-bom": ["error", "never"]
}
}
+17
View File
@@ -0,0 +1,17 @@
{
"extends": "./.eslintrc-base.json",
"env": {
// Note: don't set `"browser": true`; code in "src/" should be compatible with
// non-browser environments like Node.js with a custom window implementation
// like jsdom. All browser globals should be taken from window.
"browser": false,
"node": false
},
"globals": {
"window": false,
"angular": false
}
}
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "./.eslintrc-base.json",
"env": {
"browser": false,
"node": true
}
}
+25
View File
@@ -0,0 +1,25 @@
{
// This config contains proposed rules that we'd like to have enabled but haven't
// converted the code to adhere yet. If a decision comes to not enable one of these
// rules, it should be removed from the file. Every rule that got enabled in the
// end should be moved from here to a respective section in .eslintrc.json
"rules": {
// Rules are divided into sections from http://eslint.org/docs/rules/
// Best practices
"complexity": ["error", 10],
"dot-notation": "error",
"dot-location": ["error", "property"],
// Stylistic issues
"block-spacing": ["error", "always"],
"comma-spacing": "error",
"id-blacklist": ["error", "event"],
"indent": ["error", 2],
"key-spacing": ["error", { "beforeColon": false, "afterColon": true, "mode": "minimum" }],
"object-curly-spacing": ["error", "never"],
"object-property-newline": ["error", { "allowMultiplePropertiesPerLine": true }],
"operator-linebreak": ["error", "after", { "overrides": { "?": "before", ":": "before" }}]
}
}
+4
View File
@@ -0,0 +1,4 @@
{
"root": true,
"extends": "./.eslintrc-node.json"
}
+36
View File
@@ -0,0 +1,36 @@
<!--
IF YOU DON'T FILL OUT THE FOLLOWING INFORMATION WE MIGHT CLOSE YOUR ISSUE WITHOUT INVESTIGATION
-->
<!--
- For *SUPPORT QUESTIONS*, use one of the
[support channels](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#question).
- Before submitting, please **SEARCH GITHUB** for a similar issue or PR. -->
**I'm submitting a ...**
<!-- (check one with "x") -->
- [ ] bug report
- [ ] feature request
- [ ] other (Please do not submit support requests here (see above))
**Current behavior:**
<!-- Describe how the bug manifests / how the current features are insufficient. -->
**Expected / new behavior:**
<!-- Describe what the behavior would be without the bug / how the feature would improve AngularJS -->
**Minimal reproduction of the problem with instructions:**
<!--
If the current behavior is a bug or you can illustrate your feature request better with an example,
please provide the *STEPS TO REPRODUCE* and if possible a *MINIMAL DEMO* of the problem via
https://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:yBpEi4).
-->
**Angular version:** 1.x.y
<!-- Check whether this is still an issue in the most recent stable or in the snapshot AngularJS version (https://code.angularjs.org/snapshot/) -->
**Browser:** [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
<!-- All browsers where this could be reproduced (and Operating System if relevant) -->
**Anything else:**
<!-- e.g. stacktraces, related issues, suggestions how to fix -->
+23
View File
@@ -0,0 +1,23 @@
**What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)**
**What is the current behavior? (You can also link to an open issue here)**
**What is the new behavior (if this is a feature change)?**
**Does this PR introduce a breaking change?**
**Please check if the PR fulfills these requirements**
- [ ] The commit message follows our guidelines: https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit-message-format
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)
**Other information**:
+3
View File
@@ -20,3 +20,6 @@ libpeerconnection.log
npm-debug.log
/tmp/
/scripts/bower/bower-*
.vscode
*.log
*.stackdump
-48
View File
@@ -1,48 +0,0 @@
{
"excludeFiles": ["src/ngLocale/**"],
"disallowKeywords": ["with"],
"disallowKeywordsOnNewLine": ["else"],
"disallowMixedSpacesAndTabs": true,
"disallowMultipleLineStrings": true,
"disallowNewlineBeforeBlockStatements": true,
"disallowSpaceAfterObjectKeys": true,
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
"disallowSpaceBeforeBinaryOperators": [","],
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
"disallowSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInCallExpression": true,
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInsideArrayBrackets": true,
"requireSpaceBeforeKeywords": [
"else",
"while",
"catch"
],
"disallowSpacesInsideParentheses": true,
"disallowTrailingComma": true,
"disallowTrailingWhitespace": true,
"requireCommaBeforeLineBreak": true,
"requireLineFeedAtFileEnd": true,
"requireSpaceAfterBinaryOperators": ["?", ":", "+", "-", "/", "*", "%", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "&&", "||"],
"requireSpaceBeforeBinaryOperators": ["?", ":", "+", "-", "/", "*", "%", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "&&", "||"],
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
"requireSpaceBeforeBlockStatements": true,
"requireSpacesInConditionalExpression": {
"afterTest": true,
"beforeConsequent": true,
"afterConsequent": true,
"beforeAlternate": true
},
"requireSpacesInForStatement": true,
"requireSpacesInFunction": {
"beforeOpeningCurlyBrace": true
},
"validateLineBreaks": "LF"
}
-2
View File
@@ -1,2 +0,0 @@
node_modules/**
lib/htmlparser/**
-5
View File
@@ -1,5 +0,0 @@
{
"extends": ".jshintrc-base",
"node": true,
"globals": {}
}
-19
View File
@@ -1,19 +0,0 @@
{
"bitwise": true,
"immed": true,
"newcap": true,
"noarg": true,
"noempty": true,
"nonew": true,
"trailing": true,
"maxlen": 200,
"boss": true,
"eqnull": true,
"expr": true,
"globalstrict": true,
"laxbreak": true,
"loopfunc": true,
"sub": true,
"undef": true,
"indent": 2
}
+1
View File
@@ -0,0 +1 @@
6
+6 -17
View File
@@ -1,13 +1,12 @@
language: node_js
sudo: false
node_js:
- '4.2'
- '6'
cache:
yarn: true
directories:
- node_modules
- bower_components
- docs/bower_components
branches:
except:
@@ -36,19 +35,8 @@ addons:
packages:
- g++-4.8
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
#- npm install -g npm@2.5
# Install npm dependencies and ensure that npm cache is not stale
- npm install
before_script:
- du -sh ./node_modules ./bower_components/ || true
- ./scripts/travis/before_build.sh
script:
@@ -62,6 +50,7 @@ notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/d2120f3f2bb39a4531b2
on_success: change # options: [always|never|change] default: always
- http://104.197.9.155:8484/hubot/travis/activity #hubot-server
on_success: always # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: false # default: false
on_start: always # default: false
+4309 -183
View File
File diff suppressed because it is too large Load Diff
+79 -54
View File
@@ -14,62 +14,75 @@ today! Here are the guidelines we'd like you to follow:
- [Further Info](#info)
## <a name="coc"></a> Code of Conduct
Help us keep Angular open and inclusive. Please read and follow our [Code of Conduct][coc].
Help us keep AngularJS open and inclusive. Please read and follow our [Code of Conduct][coc].
## <a name="question"></a> Got a Question or Problem?
If you have questions about how to use AngularJS, please direct these to the [Google Group][groups]
discussion list or [StackOverflow][stackoverflow]. We are also available on [IRC][irc] and [Gitter][gitter].
discussion list or [StackOverflow][stackoverflow]. We are also available on [IRC][irc] and
[Gitter][gitter].
## <a name="issue"></a> Found an Issue?
If you find a bug in the source code or a mistake in the documentation, you can help us by
submitting an issue to our [GitHub Repository][github]. Even better you can submit a Pull Request
with a fix.
***Localization Issue:*** *Angular.js uses the [Google Closure I18N library], to generate its own I18N files. This means that
any changes to these files would be lost the next time that we import the library. The recommended
approach is to submit a patch to the I18N project directly, instead of submitting it here.*
**Localization Issues:** AngularJS uses the [Google Closure I18N library] to generate
its own I18N files (the ngLocale module). This means that any changes to these files would be lost
the next time that we import the library.
Since the Closure library i18n data is itself auto-generated from the data of the
[Common Locale Data Repository (CLDR)] project, errors in the data should
be reported there. See also the [Closure guide to i18n changes].
**Please see the Submission Guidelines below**.
**Please see the [Submission Guidelines](#submit) below.**
## <a name="feature"></a> Want a Feature?
You can request a new feature by submitting an issue to our [GitHub Repository][github]. If you
would like to implement a new feature then consider what kind of change it is:
* **Major Changes** that you wish to contribute to the project should be discussed first on our
[dev mailing list][angular-dev] or [IRC][irc] so that we can better coordinate our efforts, prevent
duplication of work, and help you to craft the change so that it is successfully accepted into the
project.
* **Small Changes** can be crafted and submitted to the [GitHub Repository][github] as a Pull Request.
[dev mailing list][angular-dev] or [IRC][irc] so that we can better coordinate our efforts,
prevent duplication of work, and help you to craft the change so that it is successfully accepted
into the project.
* **Small Changes** can be crafted and submitted to the [GitHub Repository][github] as a Pull
Request.
## <a name="docs"></a> Want a Doc Fix?
If you want to help improve the docs, it's a good idea to let others know what you're working on to
minimize duplication of effort. Before starting, check out the issue queue for
[Milestone:Docs Only](https://github.com/angular/angular.js/issues?milestone=24&state=open).
Comment on an issue to let others know what you're working on, or create a new issue if your work
doesn't fit within the scope of any of the existing doc fix projects.
minimize duplication of effort. Create a new issue (or comment on a related existing one) to let
others know what you're working on.
For large fixes, please build and test the documentation before submitting the PR to be sure you haven't
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.
For large fixes, please build and test the documentation before submitting the PR to be sure you
haven't accidentally introduced any layout or formatting issues. You should also make sure that your
commit message starts with "docs" and follows the **[Commit Message Guidelines](#commit)** 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 follow the commit message
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
### Submitting an Issue
Before you submit your issue search the archive, maybe your question was already answered.
If your issue appears to be a bug, and hasn't been reported, open a new issue.
Help us to maximize the effort we can spend fixing issues and adding new
features, by not reporting duplicate issues. Providing the following information will increase the
chances of your issue being dealt with quickly:
If your issue appears to be a bug, and hasn't been reported, open a new issue. Help us to maximize
the effort we can spend fixing issues and adding new features, by not reporting duplicate issues.
Providing the following information will increase the chances of your issue being dealt with
quickly:
* **Overview of the Issue** - if an error is being thrown a non-minified stack trace helps
* **Motivation for or Use Case** - explain why this is a bug for you
* **Angular Version(s)** - is it a regression?
* **Browsers and Operating System** - is this a problem with all browsers or only IE8?
* **AngularJS Version(s)** - is it a regression?
* **Browsers and Operating System** - is this a problem with all browsers or only specific ones?
* **Reproduce the Error** - provide a live example (using [Plunker][plunker] or
[JSFiddle][jsfiddle]) or an unambiguous set of steps.
* **Related Issues** - has a similar issue been reported before?
@@ -89,22 +102,22 @@ Before you submit your pull request consider the following guidelines:
requests. We cannot accept code without this.
* Make your changes in a new git branch:
```shell
git checkout -b my-fix-branch master
```
```shell
git checkout -b my-fix-branch master
```
* Create your patch, **including appropriate test cases**.
* Follow our [Coding Rules](#rules).
* Run the full Angular test suite, as described in the [developer documentation][dev-doc],
* Run the full AngularJS test suite, as described in the [developer documentation][dev-doc],
and ensure that all tests pass.
* Commit your changes using a descriptive commit message that follows our
[commit message conventions](#commit-message-format) and passes our commit message presubmit hook
`validate-commit-msg.js`. Adherence to the [commit message conventions](#commit-message-format)
is required because release notes are automatically generated from these messages.
[commit message conventions](#commit) and passes our commit message presubmit hook
(`validate-commit-msg.js`). Adherence to the [commit message conventions](#commit) is required,
because release notes are automatically generated from these messages.
```shell
git commit -a
```
```shell
git commit -a
```
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:
@@ -119,22 +132,24 @@ Before you submit your pull request consider the following guidelines:
git push origin my-fix-branch
```
* In GitHub, send a pull request to `angular:master`.
* If we suggest changes then:
* Make the required updates.
* Re-run the Angular test suite to ensure tests are still passing.
* Commit your changes to your branch (e.g. `my-fix-branch`).
* Push the changes to your GitHub repository (this will update your Pull Request).
In GitHub, send a pull request to `angular.js:master`.
If we suggest changes, then:
* Make the required updates.
* Re-run the AngularJS test suite to ensure tests are still passing.
* Commit your changes to your branch (e.g. `my-fix-branch`).
* Push the changes to your GitHub repository (this will update your Pull Request).
If the PR gets too outdated we may ask you to rebase and force push to update the PR:
```shell
git rebase master -i
git push origin my-fix-branch -f
```
```shell
git rebase master -i
git push origin my-fix-branch -f
```
*WARNING. Squashing or reverting commits and forced push thereafter may remove GitHub comments
on code that were previously made by you and others in your commits.*
_WARNING: Squashing or reverting commits and force-pushing thereafter may remove GitHub comments
on code that were previously made by you or others in your commits. Avoid any form of rebasing
unless necessary._
That's it! Thank you for your contribution!
@@ -168,15 +183,16 @@ from the main (upstream) repository:
```
## <a name="rules"></a> Coding Rules
To ensure consistency throughout the source code, keep these rules in mind as you are working:
* All features or bug fixes **must be tested** by one or more [specs][unit-testing].
* All public API methods **must be documented** with ngdoc, an extended version of jsdoc (we added
support for markdown and templating via @ngdoc tag). To see how we document our APIs, please check
out the existing ngdocs and see [this wiki page][ngDocs].
out the existing source code and see [this wiki page][ngDocs].
* With the exceptions listed below, we follow the rules contained in
[Google's JavaScript Style Guide][js-style-guide]:
* **Do not use namespaces**: Instead, wrap the entire angular code base in an anonymous closure and
* **Do not use namespaces**: Instead, wrap the entire AngularJS code base in an anonymous closure and
export our API explicitly rather than implicitly.
* Wrap all code at **100 characters**.
* Instead of complex inheritance hierarchies, we **prefer simple objects**. We use prototypal
@@ -193,7 +209,9 @@ We have very precise rules over how our git commit messages can be formatted. T
readable messages** that are easy to follow when looking through the **project history**. But also,
we use the git commit messages to **generate the AngularJS change log**.
The commit message formatting can be added using a typical git workflow or through the use of a CLI wizard ([Commitizen](https://github.com/commitizen/cz-cli)). To use the wizard, run `npm run commit` in your terminal after staging your changes in git.
The commit message formatting can be added using a typical git workflow or through the use of a CLI
wizard ([Commitizen](https://github.com/commitizen/cz-cli)). To use the wizard, run `yarn run commit`
in your terminal after staging your changes in git.
### Commit Message Format
Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
@@ -213,7 +231,8 @@ Any line of the commit message cannot be longer 100 characters! This allows the
to read on GitHub as well as in various git tools.
### Revert
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit. In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit.
In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.
### Type
Must be one of the following:
@@ -225,7 +244,7 @@ Must be one of the following:
semi-colons, etc)
* **refactor**: A code change that neither fixes a bug nor adds a feature
* **perf**: A code change that improves performance
* **test**: Adding missing tests
* **test**: Adding missing or correcting existing tests
* **chore**: Changes to the build process or auxiliary tools and libraries such as documentation
generation
@@ -233,6 +252,8 @@ Must be one of the following:
The scope could be anything specifying place of the commit change. For example `$location`,
`$browser`, `$compile`, `$rootScope`, `ngHref`, `ngClick`, `ngView`, etc...
You can use `*` when the change affects more than a single scope.
### Subject
The subject contains succinct description of the change:
@@ -246,9 +267,10 @@ The body should include the motivation for the change and contrast this with pre
### Footer
The footer should contain any information about **Breaking Changes** and is also the place to
reference GitHub issues that this commit **Closes**.
[reference GitHub issues that this commit closes][closing-issues].
**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this.
**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines.
The rest of the commit message is then used for this.
A detailed explanation can be found in this [document][commit-message-format].
@@ -269,6 +291,7 @@ You can find out more detailed information about contributing in the
[Google Closure I18N library]: https://github.com/google/closure-library/tree/master/closure/goog/i18n
[angular-dev]: https://groups.google.com/forum/?fromgroups#!forum/angular-dev
[closing-issues]: https://help.github.com/articles/closing-issues-via-commit-messages/
[coc]: https://github.com/angular/code-of-conduct/blob/master/CODE_OF_CONDUCT.md
[commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
[contribute]: http://docs.angularjs.org/misc/contribute
@@ -280,12 +303,14 @@ You can find out more detailed information about contributing in the
[groups]: https://groups.google.com/forum/?fromgroups#!forum/angular
[individual-cla]: http://code.google.com/legal/individual-cla-v1.0.html
[irc]: http://webchat.freenode.net/?channels=angularjs&uio=d4
[js-style-guide]: http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml
[js-style-guide]: https://google.github.io/styleguide/javascriptguide.xml
[jsfiddle]: http://jsfiddle.net/
[list]: https://groups.google.com/forum/?fromgroups#!forum/angular
[ngDocs]: https://github.com/angular/angular.js/wiki/Writing-AngularJS-Documentation
[plunker]: http://plnkr.co/edit
[stackoverflow]: http://stackoverflow.com/questions/tagged/angularjs
[unit-testing]: https://docs.angularjs.org/guide/unit-testing
[Common Locale Data Repository (CLDR)]: http://cldr.unicode.org
[Closure guide to i18n changes]: https://github.com/google/closure-library/wiki/Internationalization-%28i18n%29-changes-in-Closure-Library
[![Analytics](https://ga-beacon.appspot.com/UA-8594346-11/angular.js/CONTRIBUTING.md?pixel)](https://github.com/igrigorik/ga-beacon)
+116 -87
View File
@@ -1,21 +1,73 @@
'use strict';
var serveFavicon = require('serve-favicon');
var serveStatic = require('serve-static');
var serveIndex = require('serve-index');
var files = require('./angularFiles').files;
var util = require('./lib/grunt/utils.js');
var versionInfo = require('./lib/versions/version-info');
var path = require('path');
var e2e = require('./test/e2e/tools');
var semver = require('semver');
var exec = require('shelljs').exec;
var pkg = require(__dirname + '/package.json');
// Node.js version checks
if (!semver.satisfies(process.version, pkg.engines.node)) {
reportOrFail('Invalid node version (' + process.version + '). ' +
'Please use a version that satisfies ' + pkg.engines.node);
}
// Yarn version checks
var expectedYarnVersion = pkg.engines.yarn;
var currentYarnVersion = exec('yarn --version', {silent: true}).stdout.trim();
if (!semver.satisfies(currentYarnVersion, expectedYarnVersion)) {
reportOrFail('Invalid yarn version (' + currentYarnVersion + '). ' +
'Please use a version that satisfies ' + expectedYarnVersion);
}
// Grunt CLI version checks
var expectedGruntVersion = pkg.engines.grunt;
var currentGruntVersions = exec('grunt --version', {silent: true}).stdout;
var match = /^grunt-cli v(.+)$/m.exec(currentGruntVersions);
if (!match) {
reportOrFail('Unable to compute the current grunt-cli version. We found:\n' +
currentGruntVersions);
} else {
if (!semver.satisfies(match[1], expectedGruntVersion)) {
reportOrFail('Invalid grunt-cli version (' + match[1] + '). ' +
'Please use a version that satisfies ' + expectedGruntVersion);
}
}
// Ensure Node.js dependencies have been installed
if (!process.env.TRAVIS && !process.env.JENKINS_HOME) {
var yarnOutput = exec('yarn install');
if (yarnOutput.code !== 0) {
throw new Error('Yarn install failed: ' + yarnOutput.stderr);
}
}
module.exports = function(grunt) {
//grunt plugins
// this loads all the node_modules that start with `grunt-` as plugins
require('load-grunt-tasks')(grunt);
// load additional grunt tasks
grunt.loadTasks('lib/grunt');
grunt.loadNpmTasks('angular-benchpress');
// compute version related info for this build
var NG_VERSION = versionInfo.currentVersion;
NG_VERSION.cdn = versionInfo.cdnVersion;
var dist = 'angular-'+ NG_VERSION.full;
var dist = 'angular-' + NG_VERSION.full;
if (versionInfo.cdnVersion == null) {
throw new Error('Unable to read CDN version, are you offline or has the CDN not been properly pushed?\n' +
'Perhaps you want to set the NG1_BUILD_NO_REMOTE_VERSION_REQUESTS environment variable?');
}
//config
grunt.initConfig({
@@ -34,15 +86,15 @@ module.exports = function(grunt) {
hostname: '0.0.0.0',
base: '.',
keepalive: true,
middleware: function(connect, options){
middleware: function(connect, options) {
var base = Array.isArray(options.base) ? options.base[options.base.length - 1] : options.base;
return [
util.conditionalCsp(),
util.rewrite(),
e2e.middleware(),
connect.favicon('images/favicon.ico'),
connect.static(base),
connect.directory(base)
serveFavicon('images/favicon.ico'),
serveStatic(base),
serveIndex(base)
];
}
}
@@ -54,7 +106,7 @@ module.exports = function(grunt) {
// to avoid https://github.com/joyent/libuv/issues/826
port: 8000,
hostname: '0.0.0.0',
middleware: function(connect, options){
middleware: function(connect, options) {
var base = Array.isArray(options.base) ? options.base[options.base.length - 1] : options.base;
return [
function(req, resp, next) {
@@ -67,8 +119,8 @@ module.exports = function(grunt) {
},
util.conditionalCsp(),
e2e.middleware(),
connect.favicon('images/favicon.ico'),
connect.static(base)
serveFavicon('images/favicon.ico'),
serveStatic(base)
];
}
}
@@ -79,6 +131,8 @@ module.exports = function(grunt) {
tests: {
jqlite: 'karma-jqlite.conf.js',
jquery: 'karma-jquery.conf.js',
'jquery-2.2': 'karma-jquery-2.2.conf.js',
'jquery-2.1': 'karma-jquery-2.1.conf.js',
docs: 'karma-docs.conf.js',
modules: 'karma-modules.conf.js'
},
@@ -87,6 +141,8 @@ module.exports = function(grunt) {
autotest: {
jqlite: 'karma-jqlite.conf.js',
jquery: 'karma-jquery.conf.js',
'jquery-2.2': 'karma-jquery-2.2.conf.js',
'jquery-2.1': 'karma-jquery-2.1.conf.js',
modules: 'karma-modules.conf.js',
docs: 'karma-docs.conf.js'
},
@@ -104,65 +160,23 @@ module.exports = function(grunt) {
tmp: ['tmp']
},
jshint: {
options: {
jshintrc: true,
},
node: {
files: { src: ['*.js', 'lib/**/*.js'] },
},
tests: {
files: { src: 'test/**/*.js' },
},
ng: {
files: { src: files['angularSrc'].concat('!src/angular.bind.js') },
},
ngAnimate: {
files: { src: 'src/ngAnimate/**/*.js' },
},
ngCookies: {
files: { src: 'src/ngCookies/**/*.js' },
},
ngLocale: {
files: { src: 'src/ngLocale/**/*.js' },
},
ngMessageFormat: {
files: { src: 'src/ngMessageFormat/**/*.js' },
},
ngMessages: {
files: { src: 'src/ngMessages/**/*.js' },
},
ngMock: {
files: { src: 'src/ngMock/**/*.js' },
},
ngResource: {
files: { src: 'src/ngResource/**/*.js' },
},
ngRoute: {
files: { src: 'src/ngRoute/**/*.js' },
},
ngSanitize: {
files: { src: 'src/ngSanitize/**/*.js' },
},
ngScenario: {
files: { src: 'src/ngScenario/**/*.js' },
},
ngTouch: {
files: { src: 'src/ngTouch/**/*.js' },
},
ngAria: {
files: {src: 'src/ngAria/**/*.js'},
}
},
jscs: {
src: [
'src/**/*.js',
'test/**/*.js',
'!src/angular.bind.js' // we ignore this file since contains an early return statement
],
options: {
config: '.jscsrc'
eslint: {
all: {
src: [
'*.js',
'benchmarks/**/*.js',
'docs/**/*.js',
'lib/**/*.js',
'scripts/**/*.js',
'src/**/*.js',
'test/**/*.js',
'i18n/**/*.js',
'!docs/app/assets/js/angular-bootstrap/**',
'!docs/config/templates/**',
'!src/angular.bind.js',
'!i18n/closure/**',
'!src/ngParseExt/ucd.js'
]
}
},
@@ -231,6 +245,10 @@ module.exports = function(grunt) {
dest: 'build/angular-aria.js',
src: util.wrap(files['angularModules']['ngAria'], 'module')
},
parseext: {
dest: 'build/angular-parse-ext.js',
src: util.wrap(files['angularModules']['ngParseExt'], 'module')
},
'promises-aplus-adapter': {
dest:'tmp/promises-aplus-adapter++.js',
src:['src/ng/q.js', 'lib/promises-aplus/promises-aplus-test-adapter.js']
@@ -249,7 +267,8 @@ module.exports = function(grunt) {
resource: 'build/angular-resource.js',
route: 'build/angular-route.js',
sanitize: 'build/angular-sanitize.js',
aria: 'build/angular-aria.js'
aria: 'build/angular-aria.js',
parseext: 'build/angular-parse-ext.js'
},
@@ -264,12 +283,17 @@ module.exports = function(grunt) {
],
options: {
disallowed: [
'fit',
'iit',
'xit',
'fthey',
'tthey',
'xthey',
'fdescribe',
'ddescribe',
'xdescribe'
'xdescribe',
'it.only',
'describe.only'
]
}
},
@@ -294,7 +318,7 @@ module.exports = function(grunt) {
compress: {
build: {
options: {archive: 'build/' + dist +'.zip', mode: 'zip'},
options: {archive: 'build/' + dist + '.zip', mode: 'zip'},
src: ['**'],
cwd: 'build',
expand: true,
@@ -304,17 +328,16 @@ module.exports = function(grunt) {
},
shell: {
'npm-install': {
command: 'node scripts/npm/check-node-modules.js'
'install-node-dependencies': {
command: 'yarn'
},
'promises-aplus-tests': {
options: {
stdout: false,
stderr: true,
failOnError: true
},
command: path.normalize('./node_modules/.bin/promises-aplus-tests tmp/promises-aplus-adapter++.js')
command: path.normalize('./node_modules/.bin/promises-aplus-tests tmp/promises-aplus-adapter++.js --timeout 2000')
}
},
@@ -334,20 +357,15 @@ 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', 'Run unit, docs and e2e tests with Karma', ['eslint', '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:jquery', 'Run the jQuery (latest) unit tests with Karma', ['tests:jquery']);
grunt.registerTask('test:jquery-2.2', 'Run the jQuery 2.2 unit tests with Karma', ['tests:jquery-2.2']);
grunt.registerTask('test:jquery-2.1', 'Run the jQuery 2.1 unit tests with Karma', ['tests:jquery-2.1']);
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', ['test:jqlite', 'test:jquery', 'test:modules']);
grunt.registerTask('test:unit', 'Run unit, jQuery and Karma module tests with Karma', ['test:jqlite', 'test:jquery', 'test:jquery-2.2', 'test:jquery-2.1', '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']);
@@ -356,7 +374,18 @@ module.exports = function(grunt) {
grunt.registerTask('minify', ['bower', 'clean', 'build', 'minall']);
grunt.registerTask('webserver', ['connect:devserver']);
grunt.registerTask('package', ['bower', 'validate-angular-files', 'clean', 'buildall', 'minall', 'collect-errors', 'docs', 'copy', 'write', 'compress']);
grunt.registerTask('ci-checks', ['ddescribe-iit', 'merge-conflict', 'jshint', 'jscs']);
grunt.registerTask('package', ['bower', 'validate-angular-files', 'clean', 'buildall', 'minall', 'collect-errors', 'write', 'docs', 'copy', 'compress']);
grunt.registerTask('ci-checks', ['ddescribe-iit', 'merge-conflict', 'eslint']);
grunt.registerTask('default', ['package']);
};
function reportOrFail(message) {
if (process.env.TRAVIS || process.env.JENKINS_HOME) {
throw new Error(message);
} else {
console.log('===============================================================================');
console.log(message);
console.log('===============================================================================');
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
The MIT License
Copyright (c) 2010-2016 Google, Inc. http://angularjs.org
Copyright (c) 2010-2017 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
+1 -1
View File
@@ -7,7 +7,7 @@ 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
pass allows using type annotations for AngularJS objects. For example,
Angular's $scope objects can be annotated as:
AngularJS's $scope objects can be annotated as:
```js
/** @type {angular.Scope} */
var scope = $scope;
+75 -13
View File
@@ -2,31 +2,33 @@ AngularJS [![Build Status](https://travis-ci.org/angular/angular.js.svg?branch=m
=========
AngularJS lets you write client-side web applications as if you had a smarter browser. It lets you
use good old HTML (or HAML, Jade and friends!) as your template language and lets you extend HTMLs
use good old HTML (or HAML, Jade/Pug and friends!) as your template language and lets you extend HTMLs
syntax to express your applications components clearly and succinctly. It automatically
synchronizes data from your UI (view) with your JavaScript objects (model) through 2-way data
binding. To help you structure your application better and make it easy to test, AngularJS teaches
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. Best of all?? It makes development fun!
It also helps with server-side communication, taming async callbacks with promises and deferreds,
and it makes client-side navigation and deeplinking with hashbang urls or HTML5 pushState a
piece of cake. Best of all? It makes development fun!
* Web site: http://angularjs.org
* Tutorial: http://docs.angularjs.org/tutorial
* API Docs: http://docs.angularjs.org/api
* Developer Guide: http://docs.angularjs.org/guide
* Web site: https://angularjs.org
* Tutorial: https://docs.angularjs.org/tutorial
* API Docs: https://docs.angularjs.org/api
* Developer Guide: https://docs.angularjs.org/guide
* Contribution guidelines: [CONTRIBUTING.md](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md)
* Dashboard: http://dashboard.angularjs.org
* Dashboard: https://dashboard.angularjs.org
##### Looking for the new Angular? Go here: https://github.com/angular/angular
Building AngularJS
---------
[Once you have your environment set up](http://docs.angularjs.org/misc/contribute) just run:
[Once you have set up your environment](https://docs.angularjs.org/misc/contribute), just run:
grunt package
Running Tests
Running tests
-------------
To execute all unit tests, use:
@@ -37,9 +39,69 @@ To execute end-to-end (e2e) tests, use:
grunt package
grunt test:e2e
To learn more about the grunt tasks, run `grunt --help` and also read our
[contribution guidelines](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md).
To learn more about the grunt tasks, run `grunt --help`
Contribute & Develop
--------------------
We've set up a separate document for our [contribution guidelines](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md).
[![Analytics](https://ga-beacon.appspot.com/UA-8594346-11/angular.js/README.md?pixel)](https://github.com/igrigorik/ga-beacon)
What to use AngularJS for and when to use it
---------
AngularJS is the next generation framework where each component is designed to work with every other
component in an interconnected way like a well-oiled machine. AngularJS is JavaScript MVC made easy
and done right. (Well it is not really MVC, read on, to understand what this means.)
#### MVC, no, MV* done the right way!
MVC, short for Model-View-Controller, is a design pattern, i.e. how the code should be organized and
how the different parts of an application separated for proper readability and debugging. Model is
the data and the database. View is the user interface and what the user sees. Controller is the main
link between Model and View. These are the three pillars of major programming frameworks present on
the market today. On the other hand AngularJS works on MV*, short for Model-View-_Whatever_. The
_Whatever_ is AngularJS's way of telling that you may create any kind of linking between the Model
and the View here.
Unlike other frameworks in any programming language, where MVC, the three separate components, each
one has to be written and then connected by the programmer, AngularJS helps the programmer by asking
him/her to just create these and everything else will be taken care of by AngularJS.
#### Interconnection with HTML at the root level
AngularJS uses HTML to define the user's interface. AngularJS also enables the programmer to write
new HTML tags (AngularJS Directives) and increase the readability and understandability of the HTML
code. Directives are AngularJSs way of bringing additional functionality to HTML. Directives
achieve this by enabling us to invent our own HTML elements. This also helps in making the code DRY
(Don't Repeat Yourself), which means once created, a new directive can be used anywhere within the
application.
HTML is also used to determine the wiring of the app. Special attributes in the HTML determine where
to load the app, which components or controllers to use for each element, etc. We specify "what"
gets loaded, but not "how". This declarative approach greatly simplifies app development in a sort
of WYSIWYG way. Rather than spending time on how the program flows and orchestrating the various
moving parts, we simply define what we want and AngularJS will take care of the dependencies.
#### Data Handling made simple
Data and Data Models in AngularJS are plain JavaScript objects and one can add and change properties
directly on it and loop over objects and arrays at will.
#### Two-way Data Binding
One of AngularJS's strongest features. Two-way Data Binding means that if something changes in the
Model, the change gets reflected in the View instantaneously, and the same happens the other way
around. This is also referred to as Reactive Programming, i.e. suppose `a = b + c` is being
programmed and after this, if the value of `b` and/or `c` is changed then the value of `a` will be
automatically updated to reflect the change. AngularJS uses its "scopes" as a glue between the Model
and View and makes these updates in one available for the other.
#### Less Written Code and Easily Maintainable Code
Everything in AngularJS is created to enable the programmer to end up writing less code that is
easily maintainable and readable by any other new person on the team. Believe it or not, one can
write a complete working two-way data binded application in less than 10 lines of code. Try and see
for yourself!
#### Testing Ready
AngularJS has Dependency Injection, i.e. it takes care of providing all the necessary dependencies
to its controllers and services whenever required. This helps in making the AngularJS code ready for
unit testing by making use of mock dependencies created and injected. This makes AngularJS more
modular and easily testable thus in turn helping a team create more robust applications.
+5 -5
View File
@@ -1,6 +1,6 @@
# Triage new issues/PRs on github
This document shows the steps the Angular team is using to triage issues.
This document shows the steps the AngularJS team is using to triage issues.
The labels are used later on for [planning releases](#assigning-work).
@@ -20,7 +20,7 @@ The following is done automatically so you don't have to worry about it:
This process based on the idea of minimizing user pain
[from this blog post](http://www.lostgarden.com/2008/05/improving-bug-triage-with-user-pain.html).
1. Open the list of [non triaged issues](https://github.com/angular/angular.js/issues?direction=desc&milestone=none&page=1&sort=created&state=open)
1. Open the list of [non triaged issues](https://github.com/angular/angular.js/issues?q=is%3Aopen+sort%3Acreated-desc+no%3Amilestone)
* Sort by submit date, with the newest issues first
* You don't have to do issues in order; feel free to pick and choose issues as you please.
* You can triage older issues as well
@@ -45,12 +45,12 @@ This process based on the idea of minimizing user pain
1. Label `frequency: *` How often does this issue come up? How many developers does this affect? Chose just one of the following:
* low - obscure issue affecting a handful of developers
* moderate - impacts a common usage pattern
* high - impacts most or all Angular apps
* high - impacts most or all AngularJS apps
1. Label `severity: *` - How bad is the issue? Chose just one of the following:
* security issue
* regression
* memory leak
* broken expected use - it's hard or impossible for a developer using Angular to accomplish something that Angular should be able to do
* broken expected use - it's hard or impossible for a developer using AngularJS to accomplish something that AngularJS should be able to do
* confusing - unexpected or inconsistent behavior; hard-to-debug
* inconvenience - causes ugly/boilerplate code in apps
1. Label `component: *`
@@ -95,7 +95,7 @@ You can mention him in the relevant thread like this: `@btford`.
> Thanks for submitting this issue!
> Unfortunately, we don't think this functionality belongs in core.
> The good news is that you could easily implement this as a third-party module and publish it on Bower and/or npm.
> The good news is that you could easily implement this as a third-party module and publish it on Bower and/or to the npm repository.
## Assigning Work
Vendored Executable → Regular
+27 -7
View File
@@ -5,6 +5,7 @@ var angularFiles = {
'src/minErr.js',
'src/Angular.js',
'src/loader.js',
'src/shallowCopy.js',
'src/stringify.js',
'src/AngularPublic.js',
'src/jqLite.js',
@@ -27,6 +28,7 @@ var angularFiles = {
'src/ng/httpBackend.js',
'src/ng/interpolate.js',
'src/ng/interval.js',
'src/ng/jsonpCallbacks.js',
'src/ng/locale.js',
'src/ng/location.js',
'src/ng/log.js',
@@ -68,6 +70,7 @@ var angularFiles = {
'src/ng/directive/ngInit.js',
'src/ng/directive/ngList.js',
'src/ng/directive/ngModel.js',
'src/ng/directive/ngModelOptions.js',
'src/ng/directive/ngNonBindable.js',
'src/ng/directive/ngOptions.js',
'src/ng/directive/ngPluralize.js',
@@ -78,7 +81,6 @@ 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/validators.js',
'src/angular.bind.js',
'src/publishExternalApis.js',
@@ -120,10 +122,15 @@ var angularFiles = {
'ngMessages': [
'src/ngMessages/messages.js'
],
'ngParseExt': [
'src/ngParseExt/ucd.js',
'src/ngParseExt/module.js'
],
'ngResource': [
'src/ngResource/resource.js'
],
'ngRoute': [
'src/shallowCopy.js',
'src/ngRoute/route.js',
'src/ngRoute/routeParams.js',
'src/ngRoute/directive/ngView.js'
@@ -133,12 +140,12 @@ var angularFiles = {
'src/ngSanitize/filter/linky.js'
],
'ngMock': [
'src/ngMock/angular-mocks.js'
'src/ngMock/angular-mocks.js',
'src/ngMock/browserTrigger.js'
],
'ngTouch': [
'src/ngTouch/touch.js',
'src/ngTouch/swipe.js',
'src/ngTouch/directive/ngClick.js',
'src/ngTouch/directive/ngSwipe.js'
],
'ngAria': [
@@ -148,7 +155,6 @@ var angularFiles = {
'angularScenario': [
'src/ngScenario/Scenario.js',
'src/ngScenario/browserTrigger.js',
'src/ngScenario/Application.js',
'src/ngScenario/Describe.js',
'src/ngScenario/Future.js',
@@ -171,6 +177,7 @@ var angularFiles = {
'test/auto/*.js',
'test/ng/**/*.js',
'test/ngAnimate/*.js',
'test/ngMessageFormat/*.js',
'test/ngMessages/*.js',
'test/ngCookies/*.js',
'test/ngResource/*.js',
@@ -202,12 +209,14 @@ var angularFiles = {
'build/docs/docs-scenario.js'
],
"karmaModules": [
'karmaModules': [
'build/angular.js',
'@angularSrcModules',
'src/ngScenario/browserTrigger.js',
'test/modules/no_bootstrap.js',
'test/helpers/*.js',
'test/ngAnimate/*.js',
'test/ngMessageFormat/*.js',
'test/ngMessages/*.js',
'test/ngMock/*.js',
'test/ngCookies/*.js',
'test/ngRoute/**/*.js',
@@ -234,6 +243,17 @@ var angularFiles = {
]
};
['2.1', '2.2'].forEach(function(jQueryVersion) {
angularFiles['karmaJquery' + jQueryVersion] = []
.concat(angularFiles.karmaJquery)
.map(function(path) {
if (path.startsWith('bower_components/jquery')) {
return path.replace(/^bower_components\/jquery/, 'bower_components/jquery-' + jQueryVersion);
}
return path;
});
});
angularFiles['angularSrcModules'] = [].concat(
angularFiles['angularModules']['ngAnimate'],
angularFiles['angularModules']['ngMessageFormat'],
@@ -255,7 +275,7 @@ if (exports) {
Array.prototype.slice.call(arguments, 0).forEach(function(filegroup) {
angularFiles[filegroup].forEach(function(file) {
// replace @ref
var match = file.match(/^\@(.*)/);
var match = file.match(/^@(.*)/);
if (match) {
files = files.concat(angularFiles[match[1]]);
} else {
+11
View File
@@ -0,0 +1,11 @@
{
"root": true,
"extends": "../.eslintrc-browser.json",
"globals": {
"benchmarkSteps": false,
// Benchmarks are not run in IE 9 so we're fine.
"console": false
}
}
+44
View File
@@ -0,0 +1,44 @@
'use strict';
angular
.module('animationBenchmark', ['ngAnimate'], config)
.controller('BenchmarkController', BenchmarkController);
// Functions - Definitions
function config($compileProvider) {
$compileProvider
.commentDirectivesEnabled(false)
.cssClassDirectivesEnabled(false)
.debugInfoEnabled(false);
}
function BenchmarkController($scope) {
var self = this;
var itemCount = 1000;
var items = (new Array(itemCount + 1)).join('.').split('');
benchmarkSteps.push({
name: 'create',
fn: function() {
$scope.$apply(function() {
self.items = items;
});
}
});
benchmarkSteps.push({
name: '$digest',
fn: function() {
$scope.$root.$digest();
}
});
benchmarkSteps.push({
name: 'destroy',
fn: function() {
$scope.$apply(function() {
self.items = [];
});
}
});
}
+22
View File
@@ -0,0 +1,22 @@
/* eslint-env node */
'use strict';
module.exports = function(config) {
config.set({
scripts: [
{
id: 'jquery',
src: 'jquery-noop.js'
}, {
id: 'angular',
src: '/build/angular.js'
}, {
id: 'angular-animate',
src: '/build/angular-animate.js'
}, {
src: 'app.js'
}
]
});
};
+1
View File
@@ -0,0 +1 @@
// Override me with ?jquery=/bower_components/jquery/dist/jquery.js
+28
View File
@@ -0,0 +1,28 @@
<style>
[ng-cloak] { display: none !important; }
.animation-container .ng-enter,
.animation-container .ng-leave {
transition: all 0.1s;
}
.animation-container .ng-enter,
.animation-container .ng-leave.ng-leave-active {
opacity: 0;
}
.animation-container .ng-enter.ng-enter-active,
.animation-container .ng-leave {
opacity: 1;
}
</style>
<div ng-app="animationBenchmark" ng-cloak ng-controller="BenchmarkController as bm">
<div class="container-fluid">
<h2>Large collection of elements animated in and out with ngAnimate</h2>
<div class="animation-container">
<div ng-repeat="i in bm.items track by $index">
Just a plain ol' element
</div>
</div>
</div>
</div>
+61
View File
@@ -0,0 +1,61 @@
'use strict';
var app = angular.module('boostrapCompileBenchmark', []);
var commentDirectivesEnabled;
var cssClassDirectivesEnabled;
app.config(function($compileProvider) {
$compileProvider.debugInfoEnabled(false);
commentDirectivesEnabled = window.location.toString().indexOf('comment=disabled') === -1;
cssClassDirectivesEnabled = window.location.toString().indexOf('css=disabled') === -1;
$compileProvider
.commentDirectivesEnabled(commentDirectivesEnabled)
.cssClassDirectivesEnabled(cssClassDirectivesEnabled);
})
.controller('DataController', function DataController($compile, $http, $rootScope) {
this.isEA = !commentDirectivesEnabled && !cssClassDirectivesEnabled;
this.isEAC = !commentDirectivesEnabled && cssClassDirectivesEnabled;
this.isEAM = commentDirectivesEnabled && !cssClassDirectivesEnabled;
this.isEACM = commentDirectivesEnabled && cssClassDirectivesEnabled;
this.repeats = 50;
this.templates = [
'bootstrap-carousel.tpl.html',
'bootstrap-theme.tpl.html'
];
this.html = null;
this.loadTemplate = function() {
this.html = null;
$http.get(window.location.pathname + this.selectedTemplate)
.then(function(response) { this.html = response.data; }.bind(this));
};
this.selectedTemplate = this.templates[0];
this.loadTemplate();
var linkers = [];
benchmarkSteps.push({
name: 'create',
fn: function() {
for (var i = 0; i < this.repeats; i++) {
var linker = $compile(this.html);
linkers.push(linker);
}
}.bind(this)
});
benchmarkSteps.push({
name: 'destroy',
fn: function() {
linkers.length = 0;
}
});
});
@@ -0,0 +1,172 @@
<!-- code from http://getbootstrap.com/examples/carousel -->
<div class="navbar-wrapper">
<div class="container">
<nav class="navbar navbar-inverse navbar-static-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Project name</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li class="dropdown-header">Nav header</li>
<li><a href="#">Separated link</a></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
</div>
</div>
<!-- Carousel
================================================== -->
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="item active">
<img class="first-slide" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="First slide">
<div class="container">
<div class="carousel-caption">
<h1>Example headline.</h1>
<p>Note: If you're viewing this page via a <code>file://</code> URL, the "next" and "previous" Glyphicon buttons on the left and right might not load/display properly due to web browser security rules.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Sign up today</a></p>
</div>
</div>
</div>
<div class="item">
<img class="second-slide" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Second slide">
<div class="container">
<div class="carousel-caption">
<h1>Another example headline.</h1>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Learn more</a></p>
</div>
</div>
</div>
<div class="item">
<img class="third-slide" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Third slide">
<div class="container">
<div class="carousel-caption">
<h1>One more for good measure.</h1>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Browse gallery</a></p>
</div>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div><!-- /.carousel -->
<!-- Marketing messaging and featurettes
================================================== -->
<!-- Wrap the rest of the page in another container to center all the content. -->
<div class="container marketing">
<!-- Three columns of text below the carousel -->
<div class="row">
<div class="col-lg-4">
<img class="img-circle" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Generic placeholder image" width="140" height="140">
<h2>Heading</h2>
<p>Donec sed odio dui. Etiam porta sem malesuada magna mollis euismod. Nullam id dolor id nibh ultricies vehicula ut id elit. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna.</p>
<p><a class="btn btn-default" href="#" role="button">View details &raquo;</a></p>
</div><!-- /.col-lg-4 -->
<div class="col-lg-4">
<img class="img-circle" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Generic placeholder image" width="140" height="140">
<h2>Heading</h2>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh.</p>
<p><a class="btn btn-default" href="#" role="button">View details &raquo;</a></p>
</div><!-- /.col-lg-4 -->
<div class="col-lg-4">
<img class="img-circle" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Generic placeholder image" width="140" height="140">
<h2>Heading</h2>
<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
<p><a class="btn btn-default" href="#" role="button">View details &raquo;</a></p>
</div><!-- /.col-lg-4 -->
</div><!-- /.row -->
<!-- START THE FEATURETTES -->
<hr class="featurette-divider">
<div class="row featurette">
<div class="col-md-7">
<h2 class="featurette-heading">First featurette heading. <span class="text-muted">It'll blow your mind.</span></h2>
<p class="lead">Donec ullamcorper nulla non metus auctor fringilla. Vestibulum id ligula porta felis euismod semper. Praesent commodo cursus magna, vel scelerisque nisl consectetur. Fusce dapibus, tellus ac cursus commodo.</p>
</div>
<div class="col-md-5">
<img class="featurette-image img-responsive center-block" data-src="holder.js/500x500/auto" alt="Generic placeholder image">
</div>
</div>
<hr class="featurette-divider">
<div class="row featurette">
<div class="col-md-7 col-md-push-5">
<h2 class="featurette-heading">Oh yeah, it's that good. <span class="text-muted">See for yourself.</span></h2>
<p class="lead">Donec ullamcorper nulla non metus auctor fringilla. Vestibulum id ligula porta felis euismod semper. Praesent commodo cursus magna, vel scelerisque nisl consectetur. Fusce dapibus, tellus ac cursus commodo.</p>
</div>
<div class="col-md-5 col-md-pull-7">
<img class="featurette-image img-responsive center-block" data-src="holder.js/500x500/auto" alt="Generic placeholder image">
</div>
</div>
<hr class="featurette-divider">
<div class="row featurette">
<div class="col-md-7">
<h2 class="featurette-heading">And lastly, this one. <span class="text-muted">Checkmate.</span></h2>
<p class="lead">Donec ullamcorper nulla non metus auctor fringilla. Vestibulum id ligula porta felis euismod semper. Praesent commodo cursus magna, vel scelerisque nisl consectetur. Fusce dapibus, tellus ac cursus commodo.</p>
</div>
<div class="col-md-5">
<img class="featurette-image img-responsive center-block" data-src="holder.js/500x500/auto" alt="Generic placeholder image">
</div>
</div>
<hr class="featurette-divider">
<!-- /END THE FEATURETTES -->
<!-- FOOTER -->
<footer>
<p class="pull-right"><a href="#">Back to top</a></p>
<p>&copy; 2016 Company, Inc. &middot; <a href="#">Privacy</a> &middot; <a href="#">Terms</a></p>
</footer>
</div><!-- /.container -->
@@ -0,0 +1,595 @@
<!-- Fixed navbar -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Bootstrap theme</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li class="dropdown-header">Nav header</li>
<li><a href="#">Separated link</a></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="container theme-showcase" role="main">
<!-- Main jumbotron for a primary marketing message or call to action -->
<div class="jumbotron">
<h1>Theme example</h1>
<p>This is a template showcasing the optional theme stylesheet included in Bootstrap. Use it as a starting point to create something more unique by building on or modifying it.</p>
</div>
<div class="page-header">
<h1>Buttons</h1>
</div>
<p>
<button type="button" class="btn btn-lg btn-default">Default</button>
<button type="button" class="btn btn-lg btn-primary">Primary</button>
<button type="button" class="btn btn-lg btn-success">Success</button>
<button type="button" class="btn btn-lg btn-info">Info</button>
<button type="button" class="btn btn-lg btn-warning">Warning</button>
<button type="button" class="btn btn-lg btn-danger">Danger</button>
<button type="button" class="btn btn-lg btn-link">Link</button>
</p>
<p>
<button type="button" class="btn btn-default">Default</button>
<button type="button" class="btn btn-primary">Primary</button>
<button type="button" class="btn btn-success">Success</button>
<button type="button" class="btn btn-info">Info</button>
<button type="button" class="btn btn-warning">Warning</button>
<button type="button" class="btn btn-danger">Danger</button>
<button type="button" class="btn btn-link">Link</button>
</p>
<p>
<button type="button" class="btn btn-sm btn-default">Default</button>
<button type="button" class="btn btn-sm btn-primary">Primary</button>
<button type="button" class="btn btn-sm btn-success">Success</button>
<button type="button" class="btn btn-sm btn-info">Info</button>
<button type="button" class="btn btn-sm btn-warning">Warning</button>
<button type="button" class="btn btn-sm btn-danger">Danger</button>
<button type="button" class="btn btn-sm btn-link">Link</button>
</p>
<p>
<button type="button" class="btn btn-xs btn-default">Default</button>
<button type="button" class="btn btn-xs btn-primary">Primary</button>
<button type="button" class="btn btn-xs btn-success">Success</button>
<button type="button" class="btn btn-xs btn-info">Info</button>
<button type="button" class="btn btn-xs btn-warning">Warning</button>
<button type="button" class="btn btn-xs btn-danger">Danger</button>
<button type="button" class="btn btn-xs btn-link">Link</button>
</p>
<div class="page-header">
<h1>Tables</h1>
</div>
<div class="row">
<div class="col-md-6">
<table class="table">
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<td>2</td>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<td>3</td>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</table>
</div>
<div class="col-md-6">
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<td>2</td>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<td>3</td>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-md-6">
<table class="table table-bordered">
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="2">1</td>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<td>Mark</td>
<td>Otto</td>
<td>@TwBootstrap</td>
</tr>
<tr>
<td>2</td>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<td>3</td>
<td colspan="2">Larry the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</table>
</div>
<div class="col-md-6">
<table class="table table-condensed">
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<td>2</td>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<td>3</td>
<td colspan="2">Larry the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="page-header">
<h1>Thumbnails</h1>
</div>
<img data-src="holder.js/200x200" class="img-thumbnail" alt="200x200" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgdmlld0JveD0iMCAwIDIwMCAyMDAiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPjwhLS0KU291cmNlIFVSTDogaG9sZGVyLmpzLzIwMHgyMDAKQ3JlYXRlZCB3aXRoIEhvbGRlci5qcyAyLjYuMC4KTGVhcm4gbW9yZSBhdCBodHRwOi8vaG9sZGVyanMuY29tCihjKSAyMDEyLTIwMTUgSXZhbiBNYWxvcGluc2t5IC0gaHR0cDovL2ltc2t5LmNvCi0tPjxkZWZzPjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+PCFbQ0RBVEFbI2hvbGRlcl8xNTYyY2ExYjA3YiB0ZXh0IHsgZmlsbDojQUFBQUFBO2ZvbnQtd2VpZ2h0OmJvbGQ7Zm9udC1mYW1pbHk6QXJpYWwsIEhlbHZldGljYSwgT3BlbiBTYW5zLCBzYW5zLXNlcmlmLCBtb25vc3BhY2U7Zm9udC1zaXplOjEwcHQgfSBdXT48L3N0eWxlPjwvZGVmcz48ZyBpZD0iaG9sZGVyXzE1NjJjYTFiMDdiIj48cmVjdCB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgZmlsbD0iI0VFRUVFRSIvPjxnPjx0ZXh0IHg9Ijc0LjY5NTMxMjUiIHk9IjEwNC41Ij4yMDB4MjAwPC90ZXh0PjwvZz48L2c+PC9zdmc+" data-holder-rendered="true" style="width: 200px; height: 200px;">
<div class="page-header">
<h1>Labels</h1>
</div>
<h1>
<span class="label label-default">Default</span>
<span class="label label-primary">Primary</span>
<span class="label label-success">Success</span>
<span class="label label-info">Info</span>
<span class="label label-warning">Warning</span>
<span class="label label-danger">Danger</span>
</h1>
<h2>
<span class="label label-default">Default</span>
<span class="label label-primary">Primary</span>
<span class="label label-success">Success</span>
<span class="label label-info">Info</span>
<span class="label label-warning">Warning</span>
<span class="label label-danger">Danger</span>
</h2>
<h3>
<span class="label label-default">Default</span>
<span class="label label-primary">Primary</span>
<span class="label label-success">Success</span>
<span class="label label-info">Info</span>
<span class="label label-warning">Warning</span>
<span class="label label-danger">Danger</span>
</h3>
<h4>
<span class="label label-default">Default</span>
<span class="label label-primary">Primary</span>
<span class="label label-success">Success</span>
<span class="label label-info">Info</span>
<span class="label label-warning">Warning</span>
<span class="label label-danger">Danger</span>
</h4>
<h5>
<span class="label label-default">Default</span>
<span class="label label-primary">Primary</span>
<span class="label label-success">Success</span>
<span class="label label-info">Info</span>
<span class="label label-warning">Warning</span>
<span class="label label-danger">Danger</span>
</h5>
<h6>
<span class="label label-default">Default</span>
<span class="label label-primary">Primary</span>
<span class="label label-success">Success</span>
<span class="label label-info">Info</span>
<span class="label label-warning">Warning</span>
<span class="label label-danger">Danger</span>
</h6>
<p>
<span class="label label-default">Default</span>
<span class="label label-primary">Primary</span>
<span class="label label-success">Success</span>
<span class="label label-info">Info</span>
<span class="label label-warning">Warning</span>
<span class="label label-danger">Danger</span>
</p>
<div class="page-header">
<h1>Badges</h1>
</div>
<p>
<a href="#">Inbox <span class="badge">42</span></a>
</p>
<ul class="nav nav-pills" role="tablist">
<li role="presentation" class="active"><a href="#">Home <span class="badge">42</span></a></li>
<li role="presentation"><a href="#">Profile</a></li>
<li role="presentation"><a href="#">Messages <span class="badge">3</span></a></li>
</ul>
<div class="page-header">
<h1>Dropdown menus</h1>
</div>
<div class="dropdown theme-dropdown clearfix">
<a id="dropdownMenu1" href="#" class="sr-only dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li class="active"><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div>
<div class="page-header">
<h1>Navs</h1>
</div>
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#">Home</a></li>
<li role="presentation"><a href="#">Profile</a></li>
<li role="presentation"><a href="#">Messages</a></li>
</ul>
<ul class="nav nav-pills" role="tablist">
<li role="presentation" class="active"><a href="#">Home</a></li>
<li role="presentation"><a href="#">Profile</a></li>
<li role="presentation"><a href="#">Messages</a></li>
</ul>
<div class="page-header">
<h1>Navbars</h1>
</div>
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Project name</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li class="dropdown-header">Nav header</li>
<li><a href="#">Separated link</a></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<nav class="navbar navbar-inverse">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Project name</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li class="dropdown-header">Nav header</li>
<li><a href="#">Separated link</a></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="page-header">
<h1>Alerts</h1>
</div>
<div class="alert alert-success" role="alert">
<strong>Well done!</strong> You successfully read this important alert message.
</div>
<div class="alert alert-info" role="alert">
<strong>Heads up!</strong> This alert needs your attention, but it's not super important.
</div>
<div class="alert alert-warning" role="alert">
<strong>Warning!</strong> Best check yo self, you're not looking too good.
</div>
<div class="alert alert-danger" role="alert">
<strong>Oh snap!</strong> Change a few things up and try submitting again.
</div>
<div class="page-header">
<h1>Progress bars</h1>
</div>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%;"><span class="sr-only">60% Complete</span></div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width: 40%"><span class="sr-only">40% Complete (success)</span></div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" style="width: 20%"><span class="sr-only">20% Complete</span></div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%"><span class="sr-only">60% Complete (warning)</span></div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width: 80%"><span class="sr-only">80% Complete (danger)</span></div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-striped" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%"><span class="sr-only">60% Complete</span></div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-success" style="width: 35%"><span class="sr-only">35% Complete (success)</span></div>
<div class="progress-bar progress-bar-warning" style="width: 20%"><span class="sr-only">20% Complete (warning)</span></div>
<div class="progress-bar progress-bar-danger" style="width: 10%"><span class="sr-only">10% Complete (danger)</span></div>
</div>
<div class="page-header">
<h1>List groups</h1>
</div>
<div class="row">
<div class="col-sm-4">
<ul class="list-group">
<li class="list-group-item">Cras justo odio</li>
<li class="list-group-item">Dapibus ac facilisis in</li>
<li class="list-group-item">Morbi leo risus</li>
<li class="list-group-item">Porta ac consectetur ac</li>
<li class="list-group-item">Vestibulum at eros</li>
</ul>
</div><!-- /.col-sm-4 -->
<div class="col-sm-4">
<div class="list-group">
<a href="#" class="list-group-item active">
Cras justo odio
</a>
<a href="#" class="list-group-item">Dapibus ac facilisis in</a>
<a href="#" class="list-group-item">Morbi leo risus</a>
<a href="#" class="list-group-item">Porta ac consectetur ac</a>
<a href="#" class="list-group-item">Vestibulum at eros</a>
</div>
</div><!-- /.col-sm-4 -->
<div class="col-sm-4">
<div class="list-group">
<a href="#" class="list-group-item active">
<h4 class="list-group-item-heading">List group item heading</h4>
<p class="list-group-item-text">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
</a>
<a href="#" class="list-group-item">
<h4 class="list-group-item-heading">List group item heading</h4>
<p class="list-group-item-text">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
</a>
<a href="#" class="list-group-item">
<h4 class="list-group-item-heading">List group item heading</h4>
<p class="list-group-item-text">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
</a>
</div>
</div><!-- /.col-sm-4 -->
</div>
<div class="page-header">
<h1>Panels</h1>
</div>
<div class="row">
<div class="col-sm-4">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Panel title</h3>
</div>
<div class="panel-body">
Panel content
</div>
</div>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Panel title</h3>
</div>
<div class="panel-body">
Panel content
</div>
</div>
</div><!-- /.col-sm-4 -->
<div class="col-sm-4">
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">Panel title</h3>
</div>
<div class="panel-body">
Panel content
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">Panel title</h3>
</div>
<div class="panel-body">
Panel content
</div>
</div>
</div><!-- /.col-sm-4 -->
<div class="col-sm-4">
<div class="panel panel-warning">
<div class="panel-heading">
<h3 class="panel-title">Panel title</h3>
</div>
<div class="panel-body">
Panel content
</div>
</div>
<div class="panel panel-danger">
<div class="panel-heading">
<h3 class="panel-title">Panel title</h3>
</div>
<div class="panel-body">
Panel content
</div>
</div>
</div><!-- /.col-sm-4 -->
</div>
<div class="page-header">
<h1>Wells</h1>
</div>
<div class="well">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas sed diam eget risus varius blandit sit amet non magna. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Cras mattis consectetur purus sit amet fermentum. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Aenean lacinia bibendum nulla sed consectetur.</p>
</div>
<div class="page-header">
<h1>Carousel</h1>
</div>
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class=""></li>
<li data-target="#carousel-example-generic" data-slide-to="1" class=""></li>
<li data-target="#carousel-example-generic" data-slide-to="2" class="active"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="item">
<img data-src="holder.js/1140x500/auto/#777:#555/text:First slide" alt="First slide [1140x500]" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTE0MCIgaGVpZ2h0PSI1MDAiIHZpZXdCb3g9IjAgMCAxMTQwIDUwMCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+PCEtLQpTb3VyY2UgVVJMOiBob2xkZXIuanMvMTE0MHg1MDAvYXV0by8jNzc3OiM1NTUvdGV4dDpGaXJzdCBzbGlkZQpDcmVhdGVkIHdpdGggSG9sZGVyLmpzIDIuNi4wLgpMZWFybiBtb3JlIGF0IGh0dHA6Ly9ob2xkZXJqcy5jb20KKGMpIDIwMTItMjAxNSBJdmFuIE1hbG9waW5za3kgLSBodHRwOi8vaW1za3kuY28KLS0+PGRlZnM+PHN0eWxlIHR5cGU9InRleHQvY3NzIj48IVtDREFUQVsjaG9sZGVyXzE1NjJjYTIxYzRkIHRleHQgeyBmaWxsOiM1NTU7Zm9udC13ZWlnaHQ6Ym9sZDtmb250LWZhbWlseTpBcmlhbCwgSGVsdmV0aWNhLCBPcGVuIFNhbnMsIHNhbnMtc2VyaWYsIG1vbm9zcGFjZTtmb250LXNpemU6NTdwdCB9IF1dPjwvc3R5bGU+PC9kZWZzPjxnIGlkPSJob2xkZXJfMTU2MmNhMjFjNGQiPjxyZWN0IHdpZHRoPSIxMTQwIiBoZWlnaHQ9IjUwMCIgZmlsbD0iIzc3NyIvPjxnPjx0ZXh0IHg9IjM5MC41MDc4MTI1IiB5PSIyNzUuNSI+Rmlyc3Qgc2xpZGU8L3RleHQ+PC9nPjwvZz48L3N2Zz4=" data-holder-rendered="true">
</div>
<div class="item active left">
<img data-src="holder.js/1140x500/auto/#666:#444/text:Second slide" alt="Second slide [1140x500]" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTE0MCIgaGVpZ2h0PSI1MDAiIHZpZXdCb3g9IjAgMCAxMTQwIDUwMCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+PCEtLQpTb3VyY2UgVVJMOiBob2xkZXIuanMvMTE0MHg1MDAvYXV0by8jNjY2OiM0NDQvdGV4dDpTZWNvbmQgc2xpZGUKQ3JlYXRlZCB3aXRoIEhvbGRlci5qcyAyLjYuMC4KTGVhcm4gbW9yZSBhdCBodHRwOi8vaG9sZGVyanMuY29tCihjKSAyMDEyLTIwMTUgSXZhbiBNYWxvcGluc2t5IC0gaHR0cDovL2ltc2t5LmNvCi0tPjxkZWZzPjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+PCFbQ0RBVEFbI2hvbGRlcl8xNTYyY2ExZTY3NCB0ZXh0IHsgZmlsbDojNDQ0O2ZvbnQtd2VpZ2h0OmJvbGQ7Zm9udC1mYW1pbHk6QXJpYWwsIEhlbHZldGljYSwgT3BlbiBTYW5zLCBzYW5zLXNlcmlmLCBtb25vc3BhY2U7Zm9udC1zaXplOjU3cHQgfSBdXT48L3N0eWxlPjwvZGVmcz48ZyBpZD0iaG9sZGVyXzE1NjJjYTFlNjc0Ij48cmVjdCB3aWR0aD0iMTE0MCIgaGVpZ2h0PSI1MDAiIGZpbGw9IiM2NjYiLz48Zz48dGV4dCB4PSIzMzUuNjAxNTYyNSIgeT0iMjc1LjUiPlNlY29uZCBzbGlkZTwvdGV4dD48L2c+PC9nPjwvc3ZnPg==" data-holder-rendered="true">
</div>
<div class="item next left">
<img data-src="holder.js/1140x500/auto/#555:#333/text:Third slide" alt="Third slide [1140x500]" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTE0MCIgaGVpZ2h0PSI1MDAiIHZpZXdCb3g9IjAgMCAxMTQwIDUwMCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+PCEtLQpTb3VyY2UgVVJMOiBob2xkZXIuanMvMTE0MHg1MDAvYXV0by8jNTU1OiMzMzMvdGV4dDpUaGlyZCBzbGlkZQpDcmVhdGVkIHdpdGggSG9sZGVyLmpzIDIuNi4wLgpMZWFybiBtb3JlIGF0IGh0dHA6Ly9ob2xkZXJqcy5jb20KKGMpIDIwMTItMjAxNSBJdmFuIE1hbG9waW5za3kgLSBodHRwOi8vaW1za3kuY28KLS0+PGRlZnM+PHN0eWxlIHR5cGU9InRleHQvY3NzIj48IVtDREFUQVsjaG9sZGVyXzE1NjJjYTFiNTg5IHRleHQgeyBmaWxsOiMzMzM7Zm9udC13ZWlnaHQ6Ym9sZDtmb250LWZhbWlseTpBcmlhbCwgSGVsdmV0aWNhLCBPcGVuIFNhbnMsIHNhbnMtc2VyaWYsIG1vbm9zcGFjZTtmb250LXNpemU6NTdwdCB9IF1dPjwvc3R5bGU+PC9kZWZzPjxnIGlkPSJob2xkZXJfMTU2MmNhMWI1ODkiPjxyZWN0IHdpZHRoPSIxMTQwIiBoZWlnaHQ9IjUwMCIgZmlsbD0iIzU1NSIvPjxnPjx0ZXh0IHg9IjM3Ny44NjcxODc1IiB5PSIyNzUuNSI+VGhpcmQgc2xpZGU8L3RleHQ+PC9nPjwvZz48L3N2Zz4=" data-holder-rendered="true">
</div>
</div>
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div> <!-- /container -->
@@ -0,0 +1,15 @@
/* eslint-env node */
'use strict';
module.exports = function(config) {
config.set({
scripts: [{
id: 'angular',
src: '/build/angular.js'
},
{
src: 'app.js'
}]
});
};
+40
View File
@@ -0,0 +1,40 @@
<div ng-app="boostrapCompileBenchmark" ng-cloak>
<div ng-controller="DataController as config">
<p>Please, select which configuration you want to use:</p>
<ul>
<li>
<a href="?comment=disabled&css=disabled">Only EA</a>
<span ng-show="config.isEA">(active)</span>
</li>
<li>
<a href="?comment=disabled">Active EA and classes directives</a>
<span ng-show="config.isEAC">(active)</span>
</li>
<li>
<a href="?css=disabled">Active EA and comment directives</a>
<span ng-show="config.isEAM">(active)</span>
</li>
<li>
<a href="?">Active all directives</a>
<span ng-show="config.isEACM">(active)</span>
</li>
</ul>
<hr>
<p>How many repetitions do you want to do?</p>
<input type="number" ng-model="config.repeats">
<hr>
<p>Template to $compile:</p>
<select
ng-options="template for template in config.templates"
ng-model="config.selectedTemplate"
ng-change="config.loadTemplate()"></select>
<p>The benchmark is
<span ng-show="config.html">Ready!</span>
<span ng-hide="config.html">LOADING!</span>
</p>
</div>
</div>
+8 -7
View File
@@ -1,3 +1,5 @@
'use strict';
var app = angular.module('eventDelegationBenchmark', []);
app.directive('noopDir', function() {
@@ -5,7 +7,7 @@ app.directive('noopDir', function() {
compile: function($element, $attrs) {
return function($scope, $element) {
return 1;
}
};
}
};
});
@@ -13,12 +15,12 @@ app.directive('noopDir', function() {
app.directive('nativeClick', ['$parse', function($parse) {
return {
compile: function($element, $attrs) {
var expr = $parse($attrs.tstEvent);
$parse($attrs.tstEvent);
return function($scope, $element) {
$element[0].addEventListener('click', function() {
console.log('clicked');
}, false);
}
};
}
};
}]);
@@ -26,13 +28,12 @@ app.directive('nativeClick', ['$parse', function($parse) {
app.directive('dlgtClick', function() {
return {
compile: function($element, $attrs) {
var evt = $attrs.dlgtClick;
// We don't setup the global event listeners as the costs are small and one time only...
}
};
});
app.controller('DataController', function($rootScope) {
app.controller('DataController', function DataController($rootScope) {
this.ngRepeatCount = 1000;
this.rows = [];
var self = this;
@@ -47,8 +48,8 @@ app.controller('DataController', function($rootScope) {
self.rows = oldRows;
if (self.rows.length !== self.ngRepeatCount) {
self.rows = [];
for (var i=0; i<self.ngRepeatCount; i++) {
self.rows.push('row'+i);
for (var i = 0; i < self.ngRepeatCount; i++) {
self.rows.push('row' + i);
}
}
$rootScope.$apply();
+6 -2
View File
@@ -1,10 +1,14 @@
/* eslint-env node */
'use strict';
module.exports = function(config) {
config.set({
scripts: [{
id: 'angular',
src: '/build/angular.js'
},{
src: 'app.js',
}, {
src: 'app.js'
}]
});
};
+13 -9
View File
@@ -1,3 +1,5 @@
'use strict';
var app = angular.module('largetableBenchmark', []);
app.config(function($compileProvider) {
@@ -12,21 +14,23 @@ app.filter('noop', function() {
};
});
app.controller('DataController', function($scope, $rootScope) {
app.controller('DataController', function DataController($scope, $rootScope) {
var totalRows = 1000;
var totalColumns = 20;
var data = $scope.data = [];
$scope.digestDuration = '?';
$scope.numberOfBindings = totalRows*totalColumns*2 + totalRows + 1;
$scope.numberOfBindings = totalRows * totalColumns * 2 + totalRows + 1;
$scope.numberOfWatches = '?';
/** @this */
function iGetter() { return this.i; }
/** @this */
function jGetter() { return this.j; }
for (var i=0; i<totalRows; i++) {
for (var i = 0; i < totalRows; i++) {
data[i] = [];
for (var j=0; j<totalColumns; j++) {
for (var j = 0; j < totalColumns; j++) {
data[i][j] = {
i: i, j: j,
iFn: iGetter,
@@ -64,14 +68,13 @@ app.controller('DataController', function($scope, $rootScope) {
});
});
var fn = function() { return 'x'};
app.directive('baselineBindingTable', function() {
return {
restrict: 'E',
link: function ($scope, $element) {
link: function($scope, $element) {
var i, j, row, cell, comment;
var document = window.document;
var template = document.createElement('span');
template.setAttribute('ng-repeat', 'foo in foos');
template.classList.add('ng-scope');
@@ -104,8 +107,9 @@ app.directive('baselineBindingTable', function() {
app.directive('baselineInterpolationTable', function() {
return {
restrict: 'E',
link: function ($scope, $element) {
link: function($scope, $element) {
var i, j, row, cell, comment;
var document = window.document;
var template = document.createElement('span');
template.setAttribute('ng-repeat', 'foo in foos');
template.classList.add('ng-scope');
@@ -180,4 +184,4 @@ app.directive('baselineTable', function() {
};
});
*/
*/
+5 -1
View File
@@ -1,3 +1,7 @@
/* eslint-env node */
'use strict';
module.exports = function(config) {
config.set({
scripts: [{
@@ -9,7 +13,7 @@ module.exports = function(config) {
src: '/build/angular.js'
},
{
src: 'app.js',
src: 'app.js'
}]
});
};
+1 -1
View File
@@ -1 +1 @@
//Override me with ?jquery=/bower_components/jquery/dist/jquery.js
// Override me with ?jquery=/bower_components/jquery/dist/jquery.js
+14 -14
View File
@@ -8,20 +8,20 @@
Large table rendered with AngularJS
</p>
<div>none: <input type="radio" ng-model="benchmarkType" value="none"></div>
<div>baseline binding: <input type="radio" ng-model="benchmarkType" value="baselineBinding"></div>
<div>baseline interpolation: <input type="radio" ng-model="benchmarkType" value="baselineInterpolation"></div>
<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>
<div><label><input type="radio" ng-model="benchmarkType" value="none">none: </label></div>
<div><label><input type="radio" ng-model="benchmarkType" value="baselineBinding">baseline binding: </label></div>
<div><label><input type="radio" ng-model="benchmarkType" value="baselineInterpolation">baseline interpolation: </label></div>
<div><label><input type="radio" ng-model="benchmarkType" value="ngBind">ngBind: </label></div>
<div><label><input type="radio" ng-model="benchmarkType" value="ngBindOnce">ngBindOnce: </label></div>
<div><label><input type="radio" ng-model="benchmarkType" value="interpolation">interpolation: </label></div>
<div><label><input type="radio" ng-model="benchmarkType" value="bindOnceInterpolation">interpolation + bind-once: </label></div>
<div><label><input type="radio" ng-model="benchmarkType" value="interpolationAttr">attribute interpolation: </label></div>
<div><label><input type="radio" ng-model="benchmarkType" value="ngBindFn">ngBind + fnInvocation: </label></div>
<div><label><input type="radio" ng-model="benchmarkType" value="interpolationFn">interpolation + fnInvocation: </label></div>
<div><label><input type="radio" ng-model="benchmarkType" value="ngBindFilter">ngBind + filter: </label></div>
<div><label><input type="radio" ng-model="benchmarkType" value="interpolationFilter">interpolation + filter: </label></div>
<div><label><input type="radio" ng-model="benchmarkType" value="ngModelConstName">ngModel (const name): </label></div>
<div><label><input type="radio" ng-model="benchmarkType" value="ngModelInterpName">ngModel (interp name): </label></div>
<ng-switch on="benchmarkType">
<baseline-binding-table ng-switch-when="baselineBinding">
+108
View File
@@ -0,0 +1,108 @@
'use strict';
var app = angular.module('ngClassBenchmark', []);
app.controller('DataController', function DataController($scope) {
this.init = function() {
this.numberOfTodos = 1000;
this.implementation = 'tableOptimized';
this.completedPeriodicity = 3;
this.importantPeriodicity = 13;
this.urgentPeriodicity = 29;
this.createTodos(100);
this.setTodosValuesWithSeed(0);
};
this.clearTodos = function() {
this.todos = null;
};
this.createTodos = function(count) {
var i;
this.todos = [];
for (i = 0; i < count; i++) {
this.todos.push({
id: i + 1,
completed: false,
important: false,
urgent: false
});
}
};
this.setTodosValuesWithSeed = function(offset) {
var i, todo;
for (i = 0; i < this.todos.length; i++) {
todo = this.todos[i];
todo.completed = 0 === (i + offset) % this.completedPeriodicity;
todo.important = 0 === (i + offset) % this.importantPeriodicity;
todo.urgent = 0 === (i + offset) % this.urgentPeriodicity;
}
};
this.init();
benchmarkSteps.push({
name: 'setup',
fn: function() {
$scope.$apply();
this.clearTodos();
this.createTodos(this.numberOfTodos);
}.bind(this)
});
benchmarkSteps.push({
name: 'create',
fn: function() {
// initialize data for first time that will construct the DOM
this.setTodosValuesWithSeed(0);
$scope.$apply();
}.bind(this)
});
benchmarkSteps.push({
name: '$apply',
fn: function() {
$scope.$apply();
}
});
benchmarkSteps.push({
name: 'update',
fn: function() {
// move everything but completed
this.setTodosValuesWithSeed(3);
$scope.$apply();
}.bind(this)
});
benchmarkSteps.push({
name: 'unclass',
fn: function() {
// remove all classes
this.setTodosValuesWithSeed(NaN);
$scope.$apply();
}.bind(this)
});
benchmarkSteps.push({
name: 'class',
fn: function() {
// add all classes as the initial state
this.setTodosValuesWithSeed(0);
$scope.$apply();
}.bind(this)
});
benchmarkSteps.push({
name: 'destroy',
fn: function() {
this.clearTodos();
$scope.$apply();
}.bind(this)
});
});
+15
View File
@@ -0,0 +1,15 @@
/* eslint-env node */
'use strict';
module.exports = function(config) {
config.set({
scripts: [{
id: 'angular',
src: '/build/angular.js'
},
{
src: 'app.js'
}]
});
};
+177
View File
@@ -0,0 +1,177 @@
<style>
.gold {
background: gold;
}
.silver {
background: silver;
}
.table tbody tr > td.success {
background-color: #dff0d8;
}
.table tbody tr > td.error {
background-color: #f2dede;
}
.table tbody tr > td.warning {
background-color: #fcf8e3;
}
.table tbody tr > td.info {
background-color: #d9edf7;
}
.completed {
text-decoration: line-through;
}
.important {
font-weight: bold;
}
.urgent {
color: red;
}
</style>
<div ng-app="ngClassBenchmark" ng-cloak class="container-fluid">
<div ng-controller="DataController as benchmark" class="row">
<div class="col-lg-12">
<div class="well">
<h3>Parameters</h3>
<br>
<p>
<label>Number of todos</label><br>
<input type="number" ng-model="benchmark.numberOfTodos">
</p>
<br>
<p>
<label>Implementation</label><br>
<div class="radio">
<label>
<input ng-model="benchmark.implementation" value="tableOptimized"
type="radio" name="implementation">
Table optimized <br>
<code>ng-class="todo.completed && 'success'"</code>
</label>
</div>
<div class="radio">
<label>
<input ng-model="benchmark.implementation" value="table"
type="radio" name="implementation">
Table <br>
<code>ng-class="{success: todo.completed}"</code>
</label>
</div>
<div class="radio">
<label>
<input ng-model="benchmark.implementation" value="list"
type="radio" name="implementation">
List <br>
<code>ng-class="{completed: todo.completed, urgent: todo.urgent, important: todo.important"}</code>
</label>
</div>
<div class="radio">
<label>
<input ng-model="benchmark.implementation" value="singleOptimized"
type="radio" name="implementation">
Single ngClass optimized <br>
<code>
ng-class="{'panel-success': !!benchmark.todos, 'panel-danger': !benchmark.todos}"
</code>
</label>
</div>
<div class="radio">
<label>
<input ng-model="benchmark.implementation" value="single"
type="radio" name="implementation">
Single ngClass <br>
<code>
ng-class="{'panel-success': benchmark.todos, 'panel-danger': !benchmark.todos}"
</code>
</label>
</div>
</p>
</div>
<br>
<h3>Example</h3>
<div ng-switch="benchmark.implementation">
<table ng-switch-when="tableOptimized" class="table">
<thead>
<tr>
<th>todo #id</th>
<th>completed?</th>
<th>urgent?</th>
<th>important?</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="todo in benchmark.todos track by todo.id"
ng-class="todo.completed && 'active'"
ng-class-even="todo.completed && todo.important && 'gold'"
ng-class-odd="todo.completed && todo.important && 'silver'"
>
<td>#{{todo.id}}</td>
<td>{{todo.completed}}</td>
<td ng-class="todo.urgent && 'danger'">{{todo.urgent}}</td>
<td ng-class="todo.important && 'success'">{{todo.important}}</td>
</tr>
</tbody>
</table>
<table ng-switch-when="table" class="table">
<thead>
<tr>
<th>todo #id</th>
<th>completed?</th>
<th>urgent?</th>
<th>important?</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="todo in benchmark.todos track by todo.id"
ng-class="{active: todo.completed}"
ng-class-even="{gold: todo.completed && todo.important}"
ng-class-odd="{silver: todo.completed && todo.important}"
>
<td>#{{todo.id}}</td>
<td>{{todo.completed}}</td>
<td ng-class="{danger: todo.urgent}">{{todo.urgent}}</td>
<td ng-class="{success: todo.important}">{{todo.important}}</td>
</tr>
</tbody>
</table>
<ul ng-switch-when="list">
<li ng-repeat="todo in benchmark.todos track by todo.id"
ng-class="{
completed: todo.completed,
urgent: todo.urgent,
important: todo.important
}">#{{todo.id}}</li>
</ul>
<div ng-switch-when="singleOptimized"
class="panel"
ng-class="{'panel-success': !!benchmark.todos, 'panel-danger': !benchmark.todos}">
<div class="panel-heading">
<h3 class="panel-title">Information</h3>
</div>
<div class="panel-body"> The title is green because there are todos... </div>
</div>
<div ng-switch-when="single"
class="panel"
ng-class="{'panel-success': benchmark.todos, 'panel-danger': !benchmark.todos}">
<div class="panel-heading">
<h3 class="panel-title">Information</h3>
</div>
<div class="panel-body"> The title is green because there are todos... </div>
</div>
</div>
</div>
</div>
</div>
<br><br><br>
Executable → Regular
+1 -1
View File
@@ -1,4 +1,4 @@
"use strict";
'use strict';
/* globals angular, benchmarkSteps */
+6 -2
View File
@@ -1,11 +1,15 @@
/* eslint-env node */
'use strict';
module.exports = function(config) {
config.set({
scripts: [ {
scripts: [{
id: 'angular',
src: '/build/angular.js'
},
{
src: 'app.js',
src: 'app.js'
}]
});
};
View File
+5 -3
View File
@@ -1,11 +1,13 @@
'use strict';
var app = angular.module('orderByBenchmark', []);
app.controller('DataController', function($rootScope, $scope) {
app.controller('DataController', function DataController($rootScope, $scope) {
this.ngRepeatCount = 5000;
this.rows = [];
var self = this;
$scope.benchmarkType = 'basic';
$scope.benchmarkType = 'baseline';
$scope.rawProperty = function(key) {
return function(item) {
@@ -37,7 +39,7 @@ app.controller('DataController', function($rootScope, $scope) {
}
}
}
})
});
benchmarkSteps.push({
name: '$apply',
+9 -5
View File
@@ -1,14 +1,18 @@
/* eslint-env node */
'use strict';
module.exports = function(config) {
config.set({
scripts: [
{
"id": "jquery",
"src": "jquery-noop.js"
},{
'id': 'jquery',
'src': 'jquery-noop.js'
}, {
id: 'angular',
src: '/build/angular.js'
},{
src: 'app.js',
}, {
src: 'app.js'
}]
});
};
+1
View File
@@ -0,0 +1 @@
// Override me with ?jquery=/bower_components/jquery/dist/jquery.js
+23 -22
View File
@@ -1,3 +1,5 @@
'use strict';
var app = angular.module('parsedExpressionBenchmark', []);
app.config(function($compileProvider) {
@@ -17,11 +19,10 @@ app.directive('bmPeWatch', function() {
return {
restrict: 'A',
compile: function($element, $attrs) {
$element.text( $attrs.bmPeWatch );
$element.text($attrs.bmPeWatch);
return function($scope, $element, $attrs) {
$scope.$watch($attrs.bmPeWatch, function(val) {
$element.text(val);
});
};
}
@@ -38,9 +39,9 @@ app.directive('bmPeWatchLiteral', function($parse) {
return {
restrict: 'A',
compile: function($element, $attrs) {
$element.text( $attrs.bmPeWatchLiteral );
$element.text($attrs.bmPeWatchLiteral);
return function($scope, $element, $attrs) {
$scope.$watch( $parse($attrs.bmPeWatchLiteral, retZero) );
$scope.$watch($parse($attrs.bmPeWatchLiteral, retZero));
};
}
};
@@ -53,33 +54,33 @@ app.controller('DataController', function($scope, $rootScope) {
var star = '*';
$scope.func = function() { return star;};
$scope.func = function() { return star; };
for (var i=0; i<totalRows; i++) {
for (var i = 0; i < totalRows; i++) {
data.push({
index: i,
odd: i%2 === 0,
even: i%2 === 1,
str0: "foo-" + Math.random()*Date.now(),
str1: "bar-" + Math.random()*Date.now(),
str2: "baz-" + Math.random()*Date.now(),
num0: Math.random()*Date.now(),
num1: Math.random()*Date.now(),
num2: Math.random()*Date.now(),
date0: new Date(Math.random()*Date.now()),
date1: new Date(Math.random()*Date.now()),
date2: new Date(Math.random()*Date.now()),
func: function(){ return star; },
obj: data[i-1],
keys: data[i-1] && (data[i-1].keys || Object.keys(data[i-1])),
constructor: data[i-1]
odd: i % 2 === 0,
even: i % 2 === 1,
str0: 'foo-' + Math.random() * Date.now(),
str1: 'bar-' + Math.random() * Date.now(),
str2: 'baz-' + Math.random() * Date.now(),
num0: Math.random() * Date.now(),
num1: Math.random() * Date.now(),
num2: Math.random() * Date.now(),
date0: new Date(Math.random() * Date.now()),
date1: new Date(Math.random() * Date.now()),
date2: new Date(Math.random() * Date.now()),
func: function() { return star; },
obj: data[i - 1],
keys: data[i - 1] && (data[i - 1].keys || Object.keys(data[i - 1])),
constructor: data[i - 1]
});
}
benchmarkSteps.push({
name: '$apply',
fn: function() {
for (var i=0; i<50; i++) {
for (var i = 0; i < 50; i++) {
$rootScope.$digest();
}
}
+6 -2
View File
@@ -1,11 +1,15 @@
/* eslint-env node */
'use strict';
module.exports = function(config) {
config.set({
scripts: [ {
scripts: [{
id: 'angular',
src: '/build/angular.js'
},
{
src: 'app.js',
src: 'app.js'
}]
});
};
+17
View File
@@ -52,6 +52,11 @@
<label for="functionCalls">Function calls</label>
</li>
<li>
<input type="radio" ng-model="expressionType" value="assignment" id="assignment">
<label for="assignment">Assignment</label>
</li>
<li>
<input type="radio" ng-model="expressionType" value="objectLiterals" id="objectLiterals">
<label for="objectLiterals">Object Literals</label>
@@ -197,6 +202,18 @@
<span bm-pe-watch="row.func(row.func(), row.func())"></span>
</li>
<li ng-switch-when="assignment" ng-repeat="(rowIdx, row) in ::data">
<span bm-pe-watch="row.foo = row.str0"></span>
<span bm-pe-watch="row.obj.foo = row.str1"></span>
<span bm-pe-watch="row.obj.obj.foo = row.str2"></span>
<span bm-pe-watch="row['bar'] = row.num0"></span>
<span bm-pe-watch="row.obj['bar'] = row.num1"></span>
<span bm-pe-watch="row.obj.obj['bar'] = row.num2"></span>
<span bm-pe-watch="row[0] = row.date0"></span>
<span bm-pe-watch="row.obj[0] = row.date1"></span>
<span bm-pe-watch="row.obj.obj[0] = row.date2"></span>
</li>
<li ng-switch-when="objectLiterals" ng-repeat="(rowIdx, row) in ::data">
<span bm-pe-watch-literal="{foo: rowIdx}"></span>
<span bm-pe-watch-literal="{foo: row, bar: rowIdx}"></span>
+104
View File
@@ -0,0 +1,104 @@
'use strict';
/* globals angular, benchmarkSteps */
var app = angular.module('selectBenchmark', []);
app.config(function($compileProvider) {
if ($compileProvider.debugInfoEnabled) {
$compileProvider.debugInfoEnabled(false);
}
});
app.controller('DataController', function($scope, $element) {
$scope.groups = [];
$scope.count = 10000;
function changeOptions() {
$scope.groups = [];
var i = 0;
var group;
while (i < $scope.count) {
if (i % 100 === 0) {
group = {
name: 'group-' + $scope.groups.length,
items: []
};
$scope.groups.push(group);
}
group.items.push({
id: i,
label: 'item-' + i
});
i++;
}
}
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.groups[10].items[0];
});
}
});
benchmarkSteps.push({
name: 'set-model-2',
fn: function() {
$scope.$apply(function() {
$scope.x = $scope.groups[0].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');
}
});
});
+15
View File
@@ -0,0 +1,15 @@
/* eslint-env node */
'use strict';
module.exports = function(config) {
config.set({
scripts: [{
id: 'angular',
src: '/build/angular.js'
},
{
src: 'app.js'
}]
});
};
+15
View File
@@ -0,0 +1,15 @@
<div ng-app="selectBenchmark" ng-cloak>
<div ng-controller="DataController">
<div class="container-fluid">
<p>
Tests the execution of a select with ngRepeat'ed options with ngValue for rendering during model
and option updates.
</p>
<select ng-model="x">
<optgroup ng-repeat="g in groups track by g.name" label="{{g.name}}">
<option ng-repeat="a in g.items track by a.id" ng-value="a">{{a.label}}</option>
</optgroup>
</select>
</div>
</div>
</div>
+6 -3
View File
@@ -1,8 +1,11 @@
{
"name": "AngularJS",
"name": "angularjs",
"license": "MIT",
"devDependencies": {
"jquery": "2.1.1",
"jquery": "3.2.1",
"jquery-2.2": "jquery#2.2.4",
"jquery-2.1": "jquery#2.1.4",
"closure-compiler": "https://dl.google.com/closure-compiler/compiler-20140814.zip",
"ng-closure-runner": "https://raw.github.com/angular/ng-closure-runner/v0.2.3/assets/ng-closure-runner.zip"
"ng-closure-runner": "https://raw.github.com/angular/ng-closure-runner/v0.2.4/assets/ng-closure-runner.zip"
}
}
-210
View File
@@ -1,210 +0,0 @@
#!/usr/bin/env node
// TODO(vojta): pre-commit hook for validating messages
// TODO(vojta): report errors, currently Q silence everything which really sucks
'use strict';
var child = require('child_process');
var fs = require('fs');
var util = require('util');
var q = require('qq');
var GIT_LOG_CMD = 'git log --grep="%s" -E --format=%s %s..HEAD';
var GIT_TAG_CMD = 'git describe --tags --abbrev=0';
var HEADER_TPL = '<a name="%s"></a>\n# %s (%s)\n\n';
var LINK_ISSUE = '[#%s](https://github.com/angular/angular.js/issues/%s)';
var LINK_COMMIT = '[%s](https://github.com/angular/angular.js/commit/%s)';
var EMPTY_COMPONENT = '$$';
var warn = function() {
console.log('WARNING:', util.format.apply(null, arguments));
};
var parseRawCommit = function(raw) {
if (!raw) return null;
var lines = raw.split('\n');
var msg = {}, match;
msg.hash = lines.shift();
msg.subject = lines.shift();
msg.closes = [];
msg.breaks = [];
lines.forEach(function(line) {
match = line.match(/(?:Closes|Fixes)\s#(\d+)/);
if (match) msg.closes.push(parseInt(match[1]));
});
match = raw.match(/BREAKING CHANGE:([\s\S]*)/);
if (match) {
msg.breaking = match[1];
}
msg.body = lines.join('\n');
match = msg.subject.match(/^(.*)\((.*)\)\:\s(.*)$/);
if (!match || !match[1] || !match[3]) {
warn('Incorrect message: %s %s', msg.hash, msg.subject);
return null;
}
msg.type = match[1];
msg.component = match[2];
msg.subject = match[3];
return msg;
};
var linkToIssue = function(issue) {
return util.format(LINK_ISSUE, issue, issue);
};
var linkToCommit = function(hash) {
return util.format(LINK_COMMIT, hash.substr(0, 8), hash);
};
var currentDate = function() {
var now = new Date();
var pad = function(i) {
return ('0' + i).substr(-2);
};
return util.format('%d-%s-%s', now.getFullYear(), pad(now.getMonth() + 1), pad(now.getDate()));
};
var printSection = function(stream, title, section, printCommitLinks) {
printCommitLinks = printCommitLinks === undefined ? true : printCommitLinks;
var components = Object.getOwnPropertyNames(section).sort();
if (!components.length) return;
stream.write(util.format('\n## %s\n\n', title));
components.forEach(function(name) {
var prefix = '-';
var nested = section[name].length > 1;
if (name !== EMPTY_COMPONENT) {
if (nested) {
stream.write(util.format('- **%s:**\n', name));
prefix = ' -';
} else {
prefix = util.format('- **%s:**', name);
}
}
section[name].forEach(function(commit) {
if (printCommitLinks) {
stream.write(util.format('%s %s\n (%s', prefix, commit.subject, linkToCommit(commit.hash)));
if (commit.closes.length) {
stream.write(',\n ' + commit.closes.map(linkToIssue).join(', '));
}
stream.write(')\n');
} else {
stream.write(util.format('%s %s\n', prefix, commit.subject));
}
});
});
stream.write('\n');
};
var readGitLog = function(grep, from) {
var deferred = q.defer();
// TODO(vojta): if it's slow, use spawn and stream it instead
child.exec(util.format(GIT_LOG_CMD, grep, '%H%n%s%n%b%n==END==', from), function(code, stdout, stderr) {
var commits = [];
stdout.split('\n==END==\n').forEach(function(rawCommit) {
var commit = parseRawCommit(rawCommit);
if (commit) commits.push(commit);
});
deferred.resolve(commits);
});
return deferred.promise;
};
var writeChangelog = function(stream, commits, version) {
var sections = {
fix: {},
feat: {},
perf: {},
breaks: {}
};
sections.breaks[EMPTY_COMPONENT] = [];
commits.forEach(function(commit) {
var section = sections[commit.type];
var component = commit.component || EMPTY_COMPONENT;
if (section) {
section[component] = section[component] || [];
section[component].push(commit);
}
if (commit.breaking) {
sections.breaks[component] = sections.breaks[component] || [];
sections.breaks[component].push({
subject: util.format("due to %s,\n %s", linkToCommit(commit.hash), commit.breaking),
hash: commit.hash,
closes: []
});
}
});
stream.write(util.format(HEADER_TPL, version, version, currentDate()));
printSection(stream, 'Bug Fixes', sections.fix);
printSection(stream, 'Features', sections.feat);
printSection(stream, 'Performance Improvements', sections.perf);
printSection(stream, 'Breaking Changes', sections.breaks, false);
};
var getPreviousTag = function() {
var deferred = q.defer();
child.exec(GIT_TAG_CMD, function(code, stdout, stderr) {
if (code) deferred.reject('Cannot get the previous tag.');
else deferred.resolve(stdout.replace('\n', ''));
});
return deferred.promise;
};
var generate = function(version, file) {
getPreviousTag().then(function(tag) {
console.log('Reading git log since', tag);
readGitLog('^fix|^feat|^perf|BREAKING', tag).then(function(commits) {
console.log('Parsed', commits.length, 'commits');
console.log('Generating changelog to', file || 'stdout', '(', version, ')');
writeChangelog(file ? fs.createWriteStream(file) : process.stdout, commits, version);
});
});
};
// 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) {
generate(process.argv[2], process.argv[3]);
}
-108
View File
@@ -1,108 +0,0 @@
/* global describe: false, beforeEach: false, afterEach: false, it: false, expect: false */
'use strict';
describe('changelog.js', function() {
var ch = require('./changelog');
describe('parseRawCommit', function() {
it('should parse raw commit', function() {
var msg = ch.parseRawCommit(
'9b1aff905b638aa274a5fc8f88662df446d374bd\n' +
'feat(scope): broadcast $destroy event on scope destruction\n' +
'perf testing shows that in chrome this change adds 5-15% overhead\n' +
'when destroying 10k nested scopes where each scope has a $destroy listener\n');
expect(msg.type).toBe('feat');
expect(msg.hash).toBe('9b1aff905b638aa274a5fc8f88662df446d374bd');
expect(msg.subject).toBe('broadcast $destroy event on scope destruction');
expect(msg.body).toBe('perf testing shows that in chrome this change adds 5-15% overhead\n' +
'when destroying 10k nested scopes where each scope has a $destroy listener\n');
expect(msg.component).toBe('scope');
});
it('should parse closed issues', function() {
var msg = ch.parseRawCommit(
'13f31602f396bc269076ab4d389cfd8ca94b20ba\n' +
'feat(ng-list): Allow custom separator\n' +
'bla bla bla\n\n' +
'Closes #123\nCloses #25\n');
expect(msg.closes).toEqual([123, 25]);
});
it('should parse breaking changes', function() {
var msg = ch.parseRawCommit(
'13f31602f396bc269076ab4d389cfd8ca94b20ba\n' +
'feat(ng-list): Allow custom separator\n' +
'bla bla bla\n\n' +
'BREAKING CHANGE: first breaking change\nsomething else\n' +
'another line with more info\n');
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);
});
});
});
+1
View File
@@ -0,0 +1 @@
.visible-phone{display:none}.visible-desktop{display:block}.navbar{display:block}.navbar .container{padding:0 16px;width:auto}.navbar .brand{float:left;margin:8px 80px 0 8px;padding:0}.navbar .brand a{display:block;height:30px;margin:6px 0 5px 0;overflow:hidden;padding:0;width:117px}.navbar .nav{float:right}.navbar .nav .dropdown-toggle{color:rgba(255,255,255,0.87);font-size:16px;font-weight:300;line-height:56px;padding:0 24px;text-transform:uppercase;transition:all .3s}.navbar .nav .dropdown-toggle:hover,.navbar .nav .dropdown-toggle:active,.navbar .nav .dropdown-toggle:focus{background:#37474F;color:#fff}.navbar .nav .dropdown-menu{background:#37474F;border:none;border-radius:0;box-shadow:0 0 16px rgba(0,0,0,0.12),0 16px 16px rgba(0,0,0,0.24);color:#fff;left:auto;margin:0;padding:0;right:0}.navbar .nav .dropdown-menu:after,.navbar .nav .dropdown-menu:before{display:none}.navbar .nav .dropdown-menu li{border-bottom:1px solid rgba(38,50,56,0.56);box-sizing:border-box;line-height:48px}.navbar .nav .dropdown-menu li:last-child{border:none}.navbar .nav .dropdown-menu a{background:#37474F;color:#fff;font-weight:300;line-height:48px;padding:0 16px;transition:all .2s}.navbar .nav .dropdown-menu a:hover,.navbar .nav .dropdown-menu a:focus{background:#455A64}.navbar .navbar-search{left:200px;margin:0;position:absolute;right:440px;top:8px;width:auto}.navbar .navbar-search i{color:#546E7A;font-size:16px;left:12px;position:absolute;top:11px}.navbar .navbar-search .search-query{background:#37474F;border:none;border-radius:2px;box-shadow:none;box-sizing:border-box;color:#546E7A;font-size:14px;height:40px;width:100%;padding:0 16px 0 32px;text-shadow:none;transition:all .3s}.navbar .navbar-search .search-query:-webkit-autofill,.navbar .navbar-search .search-query:-webkit-autofill:hover,.navbar .navbar-search .search-query:-webkit-autofill:focus{background-color:#fff;transition:background-color 5000s ease-in-out 0s;-webkit-text-fill-color:#455A64}.navbar .navbar-search .search-query:hover,.navbar .navbar-search .search-query:active,.navbar .navbar-search .search-query:focus{background:#fff;box-shadow:inset 0 2px 4px rgba(0,0,0,0.24);color:#2196F3}.navbar .navbar-search .search-query::-webkit-input-placeholder{color:#546E7A}.navbar .navbar-search .search-query::-moz-placeholder{color:#546E7A}.navbar .navbar-search .search-query:-ms-input-placeholder{color:#546E7A}.navbar .navbar-search .search-query:-moz-placeholder{color:#546E7A}#navbar-main .navbar-inner{background:#263238;height:56px}#navbar-notice{z-index:1029;top:56px}#navbar-notice .navbar-inner{background:#ECEFF1;box-shadow:0 0 3px rgba(0,0,0,0.12),0 3px 3px rgba(0,0,0,0.24);height:auto}.site-notice{padding:4px 0;text-align:center;font-size:13px;margin:0}@media handheld and (max-width: 800px), screen and (max-device-width: 800px), screen and (max-width: 800px){.visible-phone{display:block}.visible-desktop{display:none}}@media handheld and (max-width: 800px), screen and (max-device-width: 800px), screen and (max-width: 800px){.homepage .container{padding:16px;width:auto}.homepage .span1{width:auto}.homepage .span2{width:auto}.homepage .span3{width:auto}.homepage .span4{width:auto}.homepage .span5{width:auto}.homepage .span6{width:auto}.homepage .span7{width:auto}.homepage .span8{width:auto}.homepage .span9{width:auto}.homepage .span10{width:auto}.homepage .navbar .container{padding:0 8px}.homepage #navbar-main .navbar-inner{height:40px}.homepage #navbar-main .brand{margin:6px 0 0 0}.homepage #navbar-main .brand a{margin:0}.homepage #navbar-main .nav{margin:0}.homepage #navbar-main .nav .dropdown-toggle{font-size:12px;line-height:40px;padding:0 8px}.homepage #navbar-main .dropdown-menu a{padding:0 8px}.homepage #navbar-main .navbar-search{background:#263238;border-bottom:1px solid #263238;left:0;right:0;top:100%}.homepage #navbar-main .navbar-search i{left:12px;top:7px}.homepage #navbar-main .navbar-search .search-query{border-radius:0;height:32px}.homepage #navbar-notice{top:40px}.homepage #navbar-notice .site-notice{font-size:11px}.homepage .hero{padding:80px 32px 32px 32px}.homepage .hero h2{background-size:230px 60px;height:60px;width:230px}}
+2 -2
View File
@@ -22,7 +22,7 @@ ul.doc-example > li.doc-example-heading {
span.nojsfiddle {
float: right;
font-size: 14px;
margin-right:10px;
margin-right: 10px;
margin-top: 10px;
}
@@ -42,7 +42,7 @@ form.jsfiddle button {
color: #7989D6;
border-color: #7989D6;
-moz-border-radius: 8px;
-webkit-border-radius:8px;
-webkit-border-radius: 8px;
border-radius: 8px;
}
+340 -218
View File
@@ -1,21 +1,21 @@
html, body {
position:relative;
height:100%;
position: relative;
height: 100%;
}
#wrapper {
min-height:100%;
position:relative;
padding-bottom:120px;
min-height: 100%;
position: relative;
padding-bottom: 120px;
}
.footer {
border-top:20px solid white;
position:absolute;
bottom:0;
left:0;
right:0;
z-index:100;
border-top: 20px solid white;
position: absolute;
bottom: 0;
left: 0;
right: 0;
z-index: 100;
padding-top: 2em;
background-color: #333;
color: white;
@@ -23,20 +23,20 @@ html, body {
}
.header-fixed {
position:fixed;
z-index:1000;
top:0;
left:0;
right:0;
position: fixed;
z-index: 1000;
top: 0;
left: 0;
right: 0;
}
.header-branding {
min-height:41px!important;
min-height: 41px !important;
}
.docs-navbar-primary {
border-radius:0!important;
margin-bottom:0!important;
border-radius: 0 !important;
margin-bottom: 0 !important;
}
/* Logo */
@@ -49,41 +49,46 @@ h1,h2,h3,h4,h5,h6 {
}
.subnav-body {
margin:70px 0 20px;
margin: 70px 0 20px;
}
.header .brand {
padding-top: 6px;
padding-bottom: 0px;
}
.header .brand img {
margin-top:5px;
height: 30px;
margin-top: 0;
height: auto;
vertical-align: top;
}
.docs-search {
margin:10px 0;
padding:4px 0 4px 20px;
background:white;
border-radius:20px;
vertical-align:middle;
margin: 10px 0;
padding: 4px 0 4px 20px;
background: white;
border-radius: 20px;
vertical-align: middle;
}
.docs-search > .search-query {
font-size:14px;
border:0;
width:80%;
color:#555;
font-size: 14px;
border: 0;
width: 80%;
color: #555;
}
.docs-search > .search-icon {
font-size:15px;
margin-right:10px;
font-size: 15px;
margin-right: 10px;
}
.navbar .navbar-search i {
top: 13px;
font-size: 12px;
}
.docs-search > .search-query:focus {
outline:0;
outline: 0;
}
/* end: Logo */
@@ -101,31 +106,31 @@ h1,h2,h3,h4,h5,h6 {
.naked-list,
.naked-list ul,
.naked-list li {
list-style:none;
margin:0;
padding:0;
list-style: none;
margin: 0;
padding: 0;
}
.nav-index-section a {
font-weight:bold;
font-weight: bold;
font-family: "Open Sans";
color:black!important;
margin-top:10px;
display:block;
color: black !important;
margin-top: 10px;
display: block;
}
.nav-index-group {
margin-bottom:20px!important;
margin-bottom: 20px !important;
}
.nav-index-group-heading {
color:#6F0101;
font-weight:bold;
font-size:1.2em;
padding:0;
margin:0;
border-bottom:1px solid #aaa;
margin-bottom:5px;
color: #6F0101;
font-weight: bold;
font-size: 1.2em;
padding: 0;
margin: 0;
border-bottom: 1px soild #aaa;
margin-bottom: 5px;
}
.nav-index-group .nav-index-listing.current a {
@@ -133,58 +138,58 @@ h1,h2,h3,h4,h5,h6 {
}
.nav-breadcrumb {
margin:4px 0;
padding:0;
margin: 4px 0;
padding: 0;
}
.nav-breadcrumb-entry {
font-family: "Open Sans";
padding:0;
margin:0;
font-size:18px;
display:inline-block;
vertical-align:middle;
padding: 0;
margin: 0;
font-size: 18px;
display: inline-block;
vertical-align: middle;
}
.nav-breadcrumb-entry > .divider {
color:#555;
display:inline-block;
padding-left:8px;
color: #555;
display: inline-block;
padding-left: 8px;
}
.nav-breadcrumb-entry > span,
.nav-breadcrumb-entry > a {
color:#6F0101;
color: #6F0101;
}
.step-list > li:nth-child(1) {
padding-left:20px;
padding-left: 20px;
}
.step-list > li:nth-child(2) {
padding-left:40px;
padding-left: 40px;
}
.step-list > li:nth-child(3) {
padding-left:60px;
padding-left: 60px;
}
.api-profile-header-heading {
margin:0;
padding:0;
margin: 0;
padding: 0;
}
.api-profile-header-structure,
.api-profile-header-structure a {
font-family: "Open Sans";
font-weight:bold;
color:#999;
font-weight: bold;
color: #999;
}
.api-profile-section {
margin-top:30px;
padding-top:30px;
border-top:1px solid #aaa;
margin-top: 30px;
padding-top: 30px;
border-top: 1px solid #aaa;
}
pre {
@@ -196,23 +201,23 @@ pre {
.aside-nav a:link,
.aside-nav a:visited,
.aside-nav a:active {
color:#999;
color: #999;
}
.aside-nav a:hover {
color:black;
color: black;
}
.api-profile-description > p:first-child {
margin:15px 0;
font-size:18px;
margin: 15px 0;
font-size: 18px;
}
p > code,
code.highlighted {
background:#f4f4f4;
border-radius:5px;
padding:2px 5px;
color:maroon;
background: #f4f4f4;
border-radius: 5px;
padding: 2px 5px;
color: maroon;
}
ul + p {
@@ -220,8 +225,8 @@ ul + p {
}
.docs-version-jump {
min-width:100%;
max-width:100%;
min-width: 100%;
max-width: 100%;
}
.picker {
@@ -267,14 +272,14 @@ ul + p {
}
.picker:after {
content:"";
content: "";
position: absolute;
right: 8%;
top: 50%;
z-index: 0;
color: #999;
width: 0;
margin-top:-2px;
margin-top: -2px;
height: 0;
border-top: 6px solid;
border-right: 6px solid transparent;
@@ -287,32 +292,33 @@ iframe.example {
}
.search-results-frame {
clear:both;
display:table;
width:100%;
clear: both;
display: table;
width: 100%;
}
.search-results.ng-hide {
display:none;
display: none;
}
.search-results-container {
padding-bottom:1em;
border-top:1px solid #111;
background:#181818;
box-shadow:inset 0 0 10px #111;
position: relative;
padding-bottom: 1em;
border-top: 1px solid #111;
background: #181818;
box-shadow: inset 0 0 10px #111;
}
.search-results-container .search-results-group {
vertical-align:top;
padding:10px 10px;
display:inline-block;
vertical-align: top;
padding: 10px 10px;
display: inline-block;
}
.search-results-group-heading {
font-family: "Open Sans";
padding-left:10px;
color:white;
padding-left: 10px;
color: white;
}
.search-results-group .search-results {
@@ -321,14 +327,23 @@ iframe.example {
}
.search-results-frame > .search-results-group:first-child > .search-results {
border-right:1px solid #222;
border-right: 1px solid #222;
}
.search-results-group.col-group-api {
width: 30%;
}
.search-results-group.col-group-api { width:30%; }
.search-results-group.col-group-guide,
.search-results-group.col-group-tutorial { width:20%; }
.search-results-group.col-group-tutorial {
width: 20%;
}
.search-results-group.col-group-misc,
.search-results-group.col-group-error { width:15%; float: right; }
.search-results-group.col-group-error {
width: 15%;
float: right;
}
@supports ((column-count: 2) or (-moz-column-count: 2) or (-ms-column-count: 2) or (-webkit-column-count: 2)) {
.search-results-group.col-group-api .search-results {
@@ -371,14 +386,14 @@ iframe.example {
}
.search-results-group.col-group-api .search-result {
width:48%;
display:inline-block;
width: 48%;
display: inline-block;
padding-left: 12px;
}
@supports ((column-count: 2) or (-moz-column-count: 2) or (-ms-column-count: 2) or (-webkit-column-count: 2)) {
.search-results-group.col-group-api .search-result {
width:auto;
width: auto;
display: list-item;
}
}
@@ -395,135 +410,137 @@ iframe.example {
border-top-right-radius: 5px;
border-top-left-radius: 5px;
width: 200px;
box-shadow:0 0 10px #111;
box-shadow: 0 0 10px #111;
}
.variables-matrix {
border:1px solid #ddd;
width:100%;
margin:10px 0;
border: 1px solid #ddd;
width: 100%;
margin: 10px 0;
}
.variables-matrix td,
.variables-matrix th {
padding:10px;
padding: 10px;
}
.variables-matrix td {
border-top:1px solid #eee;
border-top: 1px solid #eee;
}
.variables-matrix td + td,
.variables-matrix th + th {
border-left:1px solid #eee;
border-left: 1px solid #eee;
}
.variables-matrix tr:nth-child(even) td {
background:#f5f5f5;
background: #f5f5f5;
}
.variables-matrix th {
background:#f1f1f1;
background: #f1f1f1;
}
.sup-header {
padding-top:10px;
padding-bottom:5px;
background:rgba(245,245,245,0.88);
box-shadow:0 0 2px #999;
#navbar-sub {
padding-top: 10px;
padding-bottom: 5px;
background: rgba(245,245,245,0.88);
box-shadow: 0 0 2px #999;
z-index: 1028;
top: 83px;
}
.main-body-grid {
margin-top:120px;
position:relative;
margin-top: 144px;
position: relative;
}
.main-body-grid > .grid-left,
.main-body-grid > .grid-right {
padding:20px 0;
padding: 20px 0;
}
.main-body-grid > .grid-left {
position:fixed;
top:120px;
bottom:0;
overflow:auto;
position: fixed;
top: 144px;
bottom: 0;
overflow: auto;
}
.main-header-grid > .grid-left,
.main-body-grid > .grid-left {
width:260px;
width: 260px;
}
.main-header-grid > .grid-right,
.main-body-grid > .grid-right {
margin-left:270px;
position:relative;
margin-left: 270px;
position: relative;
}
.main-header-grid > .grid-left {
float:left;
float: left;
}
.main-body-grid .side-navigation {
position:relative;
padding-bottom:120px;
position: relative;
padding-bottom: 120px;
}
.main-body-grid .side-navigation.ng-hide {
display:block!important;
display: block!important;
}
.variables-matrix td {
vertical-align:top;
padding:5px;
vertical-align: top;
padding: 5px;
}
.type-hint {
display:inline-block;
display: inline-block;
background: gray;
}
.variables-matrix .type-hint {
text-align:center;
min-width:60px;
margin:1px 5px;
text-align: center;
min-width: 60px;
margin: 1px 5px;
}
.type-hint + .type-hint {
margin-top:5px;
margin-top: 5px;
}
.type-hint-expression {
background:purple;
background: purple;
}
.type-hint-date {
background:pink;
background: pink;
}
.type-hint-string {
background:#3a87ad;
background: #3a87ad;
}
.type-hint-function {
background:green;
background: green;
}
.type-hint-object {
background:#999;
background: #999;
}
.type-hint-array {
background:#F90;;
background: #F90;;
}
.type-hint-boolean {
background:rgb(18, 131, 39);
background: rgb(18, 131, 39);
}
.type-hint-number {
background:rgb(189, 63, 66);
background: rgb(189, 63, 66);
}
.type-hint-regexp {
@@ -535,19 +552,19 @@ iframe.example {
}
.runnable-example-frame {
width:100%;
height:300px;
width: 100%;
height: 300px;
border: 1px solid #ddd;
border-radius:5px;
border-radius: 5px;
}
.runnable-example-tabs {
margin-top:10px;
margin-bottom:20px;
margin-top: 10px;
margin-bottom: 20px;
}
.tutorial-nav {
display:block;
display: block;
}
h1 + ul, h1 + ul > li,
@@ -556,23 +573,23 @@ ul.tutorial-nav, ul.tutorial-nav > li,
.usage > ul, .usage > ul > li,
ul.methods, ul.methods > li,
ul.events, ul.events > li {
list-style:none;
padding:0;
list-style: none;
padding: 0;
}
h2 {
border-top:1px solid #eee;
margin-top:30px;
padding-top:30px;
border-top: 1px solid #eee;
margin-top: 30px;
padding-top: 30px;
}
h4 {
margin-top:20px;
padding-top:20px;
margin-top: 20px;
padding-top: 20px;
}
.btn {
color:#428bca;
color: #428bca;
position: relative;
width: auto;
display: inline-block;
@@ -595,26 +612,26 @@ h4 {
}
.btn + .btn {
margin-left:10px;
margin-left: 10px;
}
.btn:hover, .btn:focus {
color: black!important;
border: 1px solid #ddd!important;
background: white!important;
color: black !important;
border: 1px solid #ddd !important;
background: white !important;
}
.view-source, .improve-docs {
position:relative;
z-index:100;
position: relative;
z-index: 100;
}
.view-source {
margin-right:10px;
margin-right: 10px;
}
.improve-docs {
float:right;
float: right;
}
.return-arguments,
@@ -622,17 +639,17 @@ h4 {
.return-arguments th + th,
.return-arguments td,
.return-arguments td + td {
border-radius:0;
border:0;
border-radius: 0;
border: 0;
}
.return-arguments td:first-child {
width:100px;
width: 100px;
}
ul.methods > li,
ul.events > li {
margin-bottom:40px;
margin-bottom: 40px;
}
.definition-table td {
@@ -647,6 +664,28 @@ ul.events > li {
padding-top: 50px;
}
.diagram {
margin-bottom: 10px;
margin-top: 30px;
max-width: 100%;
}
.deprecation {
margin-top: 15px;
}
.deprecation .title {
float: left;
margin-right: 5px;
}
@media only screen and (min-width: 769px) {
[ng-include="partialPath"].ng-hide {
display: block !important;
visibility: hidden;
}
}
@media only screen and (min-width: 769px) and (max-width: 991px) {
.main-body-grid {
margin-top: 160px;
@@ -658,66 +697,66 @@ ul.events > li {
@media only screen and (max-width : 768px) {
.picker, .picker select {
width:auto;
display:block;
margin-bottom:10px;
width: auto;
display: block;
margin-bottom: 10px;
}
.docs-navbar-primary {
text-align:center;
text-align: center;
}
.main-body-grid {
margin-top:0;
margin-top: 0;
}
.main-header-grid > .grid-left,
.main-body-grid > .grid-left,
.main-header-grid > .grid-right,
.main-body-grid > .grid-right {
display:block;
float:none;
width:auto!important;
margin-left:0;
display: block;
float: none;
width: auto !important;
margin-left: 0;
}
.main-body-grid > .grid-left,
.header-fixed, .footer {
position:static!important;
position: static !important;
}
.main-body-grid > .grid-left {
background:#efefef;
margin-left:-1em;
margin-right:-1em;
padding:1em;
width:auto!important;
overflow:visible;
background: #efefef;
margin-left: -1em;
margin-right: -1em;
padding: 1em;
width: auto !important;
overflow: visible;
}
.main-header-grid > .grid-right,
.main-body-grid > .grid-right {
margin-left:0;
margin-left: 0;
}
.main-body-grid .side-navigation {
display:block!important;
padding-bottom:50px;
display: block !important;
padding-bottom: 50px;
}
.main-body-grid .side-navigation.ng-hide {
display:none!important;
display: none !important;
}
.nav-index-group .nav-index-listing {
display:inline-block;
padding:3px 0;
display: inline-block;
padding: 3px 0;
}
.nav-index-group .nav-index-listing:not(.nav-index-section):after {
padding-right:5px;
margin-left:-3px;
content:", ";
padding-right: 5px;
margin-left: -3px;
content: ", ";
}
.nav-index-group .nav-index-listing:last-child:after {
content:"";
display:inline-block;
content: "";
display: inline-block;
}
.nav-index-group .nav-index-section {
display:block;
display: block;
}
.toc-toggle {
margin-bottom:20px;
margin-bottom: 20px;
}
.toc-close {
position: absolute;
@@ -729,16 +768,16 @@ ul.events > li {
background: #eee;
border-radius: 5px;
width: 100%;
border:1px solid #ddd;
box-shadow:0 0 10px #bbb;
border: 1px solid #ddd;
box-shadow: 0 0 10px #bbb;
}
.navbar-brand {
float:none;
text-align:center;
float: none;
text-align: center;
}
.search-results-container {
padding-bottom:60px;
text-align:left;
padding-bottom: 60px;
text-align: left;
}
.search-results-frame > .search-results-group:first-child > .search-results {
@@ -746,11 +785,11 @@ ul.events > li {
}
.search-results-group {
float:none!important;
display:block!important;
width:auto!important;
border:0!important;
padding:0!important;
float: none !important;
display: block !important;
width: auto !important;
border: 0! important;
padding: 0! important;
}
@supports ((column-count: 2) or (-moz-column-count: 2) or (-ms-column-count: 2) or (-webkit-column-count: 2)) {
@@ -763,15 +802,15 @@ ul.events > li {
}
.search-results-group .search-result {
display:inline-block!important;
padding:0 5px;
width:auto!important;
display: inline-block !important;
padding: 0 5px;
width: auto !important;
text-indent: initial;
margin-left: 0;
}
.search-results-group .search-result:after {
content:", ";
content: ", ";
}
.search-results-group .search-result:before {
@@ -789,10 +828,93 @@ ul.events > li {
}
#wrapper {
padding-bottom:0px;
padding-bottom: 0px;
}
}
iframe[name="example-anchoringExample"] {
height:400px;
height: 400px;
}
/*
angular-topnav.css and bootstrap overrides
*/
.navbar .navbar-inner .container {
padding: 0 16px;
width: auto;
height: auto;
}
.navbar .nav > li {
float: left;
}
.navbar-nav .open .dropdown-menu {
position: absolute;
float: left;
}
.navbar-nav .open .dropdown-menu > li > a {
line-height: 48px;
}
#navbar-main .navbar-inner, #navbar-notice .navbar-inner {
box-shadow: none;
}
#navbar-sub .container {
max-width: 970px;
}
.nav .open > a, .nav .open > a:hover, .nav .open > a:focus {
background-color: inherit;
}
@media handheld and (max-width:800px), screen and (max-device-width:800px), screen and (max-width:800px) {
.navbar {
min-height: auto;
}
.search-results-container {
top: 32px;
overflow: auto;
max-height: 85vh;
padding-bottom: 0;
position: static;
}
.search-close {
right: 1px;
margin-left: 0;
top: 41px;
padding: 5px 10px;
border-top-right-radius: 0;
border-top-left-radius: 0;
box-shadow: none;
width: auto;
bottom: auto;
left: auto;
}
.navbar-nav .open .dropdown-menu > li > a, .navbar-nav .open .dropdown-menu .dropdown-header {
padding: 0 8px;
}
.homepage #navbar-notice {
top: 72px;
}
#navbar-notice .navbar-inner {
box-shadow: 0 0 3px rgba(0, 0, 0, .12), 0 3px 3px rgba(0, 0, 0, .24)
}
#navbar-sub {
position: relative;
top: 17px;
margin-top: 80px;
padding-bottom: 0;
margin-bottom: 0;
}
}
Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 212 B

-442
View File
@@ -1,442 +0,0 @@
'use strict';
var directive = {};
directive.runnableExample = ['$templateCache', '$document', function($templateCache, $document) {
var exampleClassNameSelector = '.runnable-example-file';
var doc = $document[0];
var tpl =
'<nav class="runnable-example-tabs" ng-if="tabs">' +
' <a ng-class="{active:$index==activeTabIndex}"' +
'ng-repeat="tab in tabs track by $index" ' +
'href="" ' +
'class="btn"' +
'ng-click="setTab($index)">' +
' {{ tab }}' +
' </a>' +
'</nav>';
return {
restrict: 'C',
scope : true,
controller : ['$scope', function($scope) {
$scope.setTab = function(index) {
var tab = $scope.tabs[index];
$scope.activeTabIndex = index;
$scope.$broadcast('tabChange', index, tab);
};
}],
compile : function(element) {
element.html(tpl + element.html());
return function(scope, element) {
var node = element[0];
var examples = node.querySelectorAll(exampleClassNameSelector);
var tabs = [], now = Date.now();
angular.forEach(examples, function(child, index) {
tabs.push(child.getAttribute('name'));
});
if(tabs.length > 0) {
scope.tabs = tabs;
scope.$on('tabChange', function(e, index, title) {
angular.forEach(examples, function(child) {
child.style.display = 'none';
});
var selected = examples[index];
selected.style.display = 'block';
});
scope.setTab(0);
}
}
}
};
}];
directive.dropdownToggle =
['$document', '$location', '$window',
function ($document, $location, $window) {
var openElement = null, close;
return {
restrict: 'C',
link: function(scope, element, attrs) {
scope.$watch(function dropdownTogglePathWatch(){return $location.path();}, function dropdownTogglePathWatchAction() {
close && close();
});
element.parent().on('click', function(event) {
close && close();
});
element.on('click', function(event) {
event.preventDefault();
event.stopPropagation();
var iWasOpen = false;
if (openElement) {
iWasOpen = openElement === element;
close();
}
if (!iWasOpen){
element.parent().addClass('open');
openElement = element;
close = function (event) {
event && event.preventDefault();
event && event.stopPropagation();
$document.off('click', close);
element.parent().removeClass('open');
close = null;
openElement = null;
}
$document.on('click', close);
}
});
}
};
}];
directive.syntax = function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
function makeLink(type, text, link, icon) {
return '<a href="' + link + '" class="btn syntax-' + type + '" target="_blank" rel="nofollow">' +
'<span class="' + icon + '"></span> ' + text +
'</a>';
};
var html = '';
var types = {
'github' : {
text : 'View on Github',
key : 'syntaxGithub',
icon : 'icon-github'
},
'plunkr' : {
text : 'View on Plunkr',
key : 'syntaxPlunkr',
icon : 'icon-arrow-down'
},
'jsfiddle' : {
text : 'View on JSFiddle',
key : 'syntaxFiddle',
icon : 'icon-cloud'
}
};
for(var type in types) {
var data = types[type];
var link = attrs[data.key];
if(link) {
html += makeLink(type, data.text, link, data.icon);
}
};
var nav = document.createElement('nav');
nav.className = 'syntax-links';
nav.innerHTML = html;
var node = element[0];
var par = node.parentNode;
par.insertBefore(nav, node);
}
}
}
directive.tabbable = function() {
return {
restrict: 'C',
compile: function(element) {
var navTabs = angular.element('<ul class="nav nav-tabs"></ul>'),
tabContent = angular.element('<div class="tab-content"></div>');
tabContent.append(element.contents());
element.append(navTabs).append(tabContent);
},
controller: ['$scope', '$element', function($scope, $element) {
var navTabs = $element.contents().eq(0),
ngModel = $element.controller('ngModel') || {},
tabs = [],
selectedTab;
ngModel.$render = function() {
var $viewValue = this.$viewValue;
if (selectedTab ? (selectedTab.value != $viewValue) : $viewValue) {
if(selectedTab) {
selectedTab.paneElement.removeClass('active');
selectedTab.tabElement.removeClass('active');
selectedTab = null;
}
if($viewValue) {
for(var i = 0, ii = tabs.length; i < ii; i++) {
if ($viewValue == tabs[i].value) {
selectedTab = tabs[i];
break;
}
}
if (selectedTab) {
selectedTab.paneElement.addClass('active');
selectedTab.tabElement.addClass('active');
}
}
}
};
this.addPane = function(element, attr) {
var li = angular.element('<li><a href></a></li>'),
a = li.find('a'),
tab = {
paneElement: element,
paneAttrs: attr,
tabElement: li
};
tabs.push(tab);
attr.$observe('value', update)();
attr.$observe('title', function(){ update(); a.text(tab.title); })();
function update() {
tab.title = attr.title;
tab.value = attr.value || attr.title;
if (!ngModel.$setViewValue && (!ngModel.$viewValue || tab == selectedTab)) {
// we are not part of angular
ngModel.$viewValue = tab.value;
}
ngModel.$render();
}
navTabs.append(li);
li.on('click', function(event) {
event.preventDefault();
event.stopPropagation();
if (ngModel.$setViewValue) {
$scope.$apply(function() {
ngModel.$setViewValue(tab.value);
ngModel.$render();
});
} else {
// we are not part of angular
ngModel.$viewValue = tab.value;
ngModel.$render();
}
});
return function() {
tab.tabElement.remove();
for(var i = 0, ii = tabs.length; i < ii; i++ ) {
if (tab == tabs[i]) {
tabs.splice(i, 1);
}
}
};
}
}]
};
};
directive.table = function() {
return {
restrict: 'E',
link: function(scope, element, attrs) {
if (!attrs['class']) {
element.addClass('table table-bordered table-striped code-table');
}
}
};
};
var popoverElement = function() {
var object = {
init : function() {
this.element = angular.element(
'<div class="popover popover-incode top">' +
'<div class="arrow"></div>' +
'<div class="popover-inner">' +
'<div class="popover-title"><code></code></div>' +
'<div class="popover-content"></div>' +
'</div>' +
'</div>'
);
this.node = this.element[0];
this.element.css({
'display':'block',
'position':'absolute'
});
angular.element(document.body).append(this.element);
var inner = this.element.children()[1];
this.titleElement = angular.element(inner.childNodes[0].firstChild);
this.contentElement = angular.element(inner.childNodes[1]);
//stop the click on the tooltip
this.element.on('click', function(event) {
event.preventDefault();
event.stopPropagation();
});
var self = this;
angular.element(document.body).on('click',function(event) {
if(self.visible()) self.hide();
});
},
show : function(x,y) {
this.element.addClass('visible');
this.position(x || 0, y || 0);
},
hide : function() {
this.element.removeClass('visible');
this.position(-9999,-9999);
},
visible : function() {
return this.position().y >= 0;
},
isSituatedAt : function(element) {
return this.besideElement ? element[0] == this.besideElement[0] : false;
},
title : function(value) {
return this.titleElement.html(value);
},
content : function(value) {
if(value && value.length > 0) {
value = marked(value);
}
return this.contentElement.html(value);
},
positionArrow : function(position) {
this.node.className = 'popover ' + position;
},
positionAway : function() {
this.besideElement = null;
this.hide();
},
positionBeside : function(element) {
this.besideElement = element;
var elm = element[0];
var x = elm.offsetLeft;
var y = elm.offsetTop;
x -= 30;
y -= this.node.offsetHeight + 10;
this.show(x,y);
},
position : function(x,y) {
if(x != null && y != null) {
this.element.css('left',x + 'px');
this.element.css('top', y + 'px');
}
else {
return {
x : this.node.offsetLeft,
y : this.node.offsetTop
};
}
}
};
object.init();
object.hide();
return object;
};
directive.popover = ['popoverElement', function(popover) {
return {
restrict: 'A',
priority : 500,
link: function(scope, element, attrs) {
element.on('click',function(event) {
event.preventDefault();
event.stopPropagation();
if(popover.isSituatedAt(element) && popover.visible()) {
popover.title('');
popover.content('');
popover.positionAway();
}
else {
popover.title(attrs.title);
popover.content(attrs.content);
popover.positionBeside(element);
}
});
}
}
}];
directive.tabPane = function() {
return {
require: '^tabbable',
restrict: 'C',
link: function(scope, element, attrs, tabsCtrl) {
element.on('$remove', tabsCtrl.addPane(element, attrs));
}
};
};
directive.foldout = ['$http', '$animate','$window', function($http, $animate, $window) {
return {
restrict: 'A',
priority : 500,
link: function(scope, element, attrs) {
var container, loading, url = attrs.url;
if(/\/build\//.test($window.location.href)) {
url = '/build/docs' + url;
}
element.on('click',function() {
scope.$apply(function() {
if(!container) {
if(loading) return;
loading = true;
var par = element.parent();
container = angular.element('<div class="foldout">loading...</div>');
$animate.enter(container, null, par);
$http.get(url, { cache : true }).success(function(html) {
loading = false;
html = '<div class="foldout-inner">' +
'<div calss="foldout-arrow"></div>' +
html +
'</div>';
container.html(html);
//avoid showing the element if the user has already closed it
if(container.css('display') == 'block') {
container.css('display','none');
$animate.addClass(container, 'ng-hide');
}
});
}
else {
container.hasClass('ng-hide') ? $animate.removeClass(container, 'ng-hide') : $animate.addClass(container, 'ng-hide');
}
});
});
}
}
}];
angular.module('bootstrap', [])
.directive(directive)
.factory('popoverElement', popoverElement)
.run(function() {
marked.setOptions({
gfm: true,
tables: true
});
});
+3 -1
View File
@@ -54,7 +54,9 @@ angular.module('ui.bootstrap.dropdown', [])
}
};
var closeDropdown = function() {
var closeDropdown = function(evt) {
if (evt && evt.which === 3) return;
openScope.$apply(function() {
openScope.isOpen = false;
});
+12 -11
View File
@@ -1,17 +1,18 @@
"use strict";
/* jshint browser: true */
/* global importScripts, onmessage: true, postMessage, lunr */
'use strict';
/* eslint-env worker */
/* global importScripts, lunr */
// Load up the lunr library
importScripts('../components/lunr.js-0.5.12/lunr.min.js');
importScripts('../components/lunr-0.7.2/lunr.min.js');
// Create the lunr index - the docs should be an array of object, each object containing
// the path and search terms for a page
var index = lunr(function() {
var index = lunr(/** @this */function() {
this.ref('path');
this.field('titleWords', {boost: 50});
this.field('members', { boost: 40});
this.field('keywords', { boost : 20 });
this.field('members', {boost: 40});
this.field('keywords', {boost: 20});
});
// Retrieve the searchData which contains the information about each page to be indexed
@@ -25,13 +26,13 @@ searchDataRequest.onload = function() {
searchData.forEach(function(page) {
index.add(page);
});
postMessage({ e: 'index-ready' });
self.postMessage({e: 'index-ready'});
};
searchDataRequest.open('GET', 'search-data.json');
searchDataRequest.send();
// The worker receives a message everytime the web app wants to query the index
onmessage = function(oEvent) {
self.onmessage = function(oEvent) {
var q = oEvent.data.q;
var hits = index.search(q);
var results = [];
@@ -40,5 +41,5 @@ onmessage = function(oEvent) {
results.push(hit.ref);
});
// The results of the query are sent back to the web app via a new message
postMessage({ e: 'query-ready', q: q, d: results });
};
self.postMessage({e: 'query-ready', q: q, d: results});
};
@@ -1,28 +1,14 @@
{
"extends": "../../../.jshintrc-base",
"root": true,
"extends": "../../../.eslintrc-node.json",
"env": {
"jasmine": true,
"protractor": true
},
"globals": {
/* jasmine / karma */
"it": false,
"iit": false,
"describe": false,
"ddescribe": false,
"beforeEach": false,
"afterEach": false,
"expect": false,
"jasmine": false,
"spyOn": false,
"waits": false,
"waitsFor": false,
"runs": false,
"dump": false,
/* e2e */
"browser": false,
"element": false,
"by": false,
/* testabilityPatch / matchers */
"inject": false,
"module": false,
@@ -39,4 +25,4 @@
"browserTrigger": false,
"jqLiteCacheSize": false
}
}
}
+9 -9
View File
@@ -1,10 +1,10 @@
'use strict';
describe("doc.angularjs.org", function() {
describe('doc.angularjs.org', function() {
describe("API pages", function() {
describe('API pages', function() {
it("should display links to code on GitHub", function() {
it('should display links to code on GitHub', function() {
browser.get('build/docs/index.html#!/api/ng/service/$http');
expect(element(by.css('.improve-docs')).getAttribute('href')).toMatch(/https?:\/\/github\.com\/angular\/angular\.js\/edit\/.+\/src\/ng\/http\.js/);
@@ -12,18 +12,18 @@ describe("doc.angularjs.org", function() {
expect(element(by.css('.view-source')).getAttribute('href')).toMatch(/https?:\/\/github\.com\/angular\/angular\.js\/tree\/.+\/src\/ng\/http\.js#L\d+/);
});
it('should change the page content when clicking a link to a service', function () {
it('should change the page content when clicking a link to a service', function() {
browser.get('build/docs/index.html');
var ngBindLink = element(by.css('.definition-table td a[href="api/ng/directive/ngClick"]'));
ngBindLink.click();
var pageBody = element(by.css('h1'));
expect(pageBody.getText()).toEqual('ngClick');
var mainHeader = element(by.css('.main-body h1 '));
expect(mainHeader.getText()).toEqual('ngClick');
});
it('should show the functioning input directive example', function () {
it('should show the functioning input directive example', function() {
browser.get('build/docs/index.html#!/api/ng/directive/input');
// Ensure that the page is loaded before trying to switch frames.
@@ -38,7 +38,7 @@ describe("doc.angularjs.org", function() {
expect(code.getText()).toContain('guest!!!');
});
it("should trim indentation from code blocks", function() {
it('should trim indentation from code blocks', function() {
browser.get('build/docs/index.html#!/api/ng/type/$rootScope.Scope');
var codeBlocks = element.all(by.css('pre > code.lang-js'));
@@ -48,4 +48,4 @@ describe("doc.angularjs.org", function() {
});
});
});
});
});
@@ -1,12 +1,12 @@
'use strict';
describe("provider pages", function() {
describe('provider pages', function() {
it("should show the related service", function() {
it('should show the related service', function() {
browser.get('build/docs/index.html#!/api/ng/provider/$compileProvider');
var serviceLink = element.all(by.css('ol.api-profile-header-structure li a')).first();
expect(serviceLink.getText()).toEqual('- $compile');
expect(serviceLink.getAttribute('href')).toMatch(/api\/ng\/service\/\$compile/);
});
});
});
@@ -1,8 +1,8 @@
'use strict';
describe("service pages", function() {
describe('service pages', function() {
it("should show the related provider if there is one", function() {
it('should show the related provider if there is one', function() {
browser.get('build/docs/index.html#!/api/ng/service/$compile');
var providerLink = element.all(by.css('ol.api-profile-header-structure li a')).first();
expect(providerLink.getText()).toEqual('- $compileProvider');
@@ -10,13 +10,13 @@ describe("service pages", function() {
browser.get('build/docs/index.html#!/api/ng/service/$q');
providerLink = element.all(by.css('ol.api-profile-header-structure li a')).first();
expect(providerLink.getText()).not.toEqual('- $qProvider');
expect(providerLink.getText()).not.toEqual('- $compileProvider');
expect(providerLink.getAttribute('href')).not.toMatch(/api\/ng\/provider\/\$compileProvider/);
});
it("should show parameter defaults", function() {
it('should show parameter defaults', function() {
browser.get('build/docs/index.html#!/api/ng/service/$timeout');
expect(element.all(by.css('.input-arguments p em')).first().getText()).toContain('(default: 0)');
});
});
});
+24 -22
View File
@@ -1,8 +1,8 @@
'use strict';
var webdriver = require('protractor/node_modules/selenium-webdriver');
var webdriver = require('selenium-webdriver');
describe('docs.angularjs.org', function () {
describe('docs.angularjs.org', function() {
beforeEach(function() {
// read and clear logs from previous tests
@@ -24,7 +24,7 @@ describe('docs.angularjs.org', function () {
});
describe('App', function () {
describe('App', function() {
// it('should filter the module list when searching', function () {
// browser.get();
// browser.waitForAngular();
@@ -38,49 +38,51 @@ describe('docs.angularjs.org', function () {
// });
it('should change the page content when clicking a link to a service', function () {
browser.get('build/docs/index.html');
it('should change the page content when clicking a link to a service', function() {
browser.get('build/docs/index-production.html');
var ngBindLink = element(by.css('.definition-table td a[href="api/ng/directive/ngClick"]'));
ngBindLink.click();
var pageBody = element(by.css('h1'));
expect(pageBody.getText()).toEqual('ngClick');
var mainHeader = element(by.css('.main-body h1 '));
expect(mainHeader.getText()).toEqual('ngClick');
});
it('should be resilient to trailing slashes', function() {
browser.get('build/docs/index.html#!/api/ng/function/angular.noop/');
var pageBody = element(by.css('h1'));
expect(pageBody.getText()).toEqual('angular.noop');
browser.get('build/docs/index-production.html#!/api/ng/function/angular.noop/');
var mainHeader = element(by.css('.main-body h1 '));
expect(mainHeader.getText()).toEqual('angular.noop');
});
it('should be resilient to trailing "index"', function() {
browser.get('build/docs/index.html#!/api/ng/function/angular.noop/index');
var pageBody = element(by.css('h1'));
expect(pageBody.getText()).toEqual('angular.noop');
browser.get('build/docs/index-production.html#!/api/ng/function/angular.noop/index');
var mainHeader = element(by.css('.main-body h1 '));
expect(mainHeader.getText()).toEqual('angular.noop');
});
it('should be resilient to trailing "index/"', function() {
browser.get('build/docs/index.html#!/api/ng/function/angular.noop/index/');
var pageBody = element(by.css('h1'));
expect(pageBody.getText()).toEqual('angular.noop');
browser.get('build/docs/index-production.html#!/api/ng/function/angular.noop/index/');
var mainHeader = element(by.css('.main-body h1 '));
expect(mainHeader.getText()).toEqual('angular.noop');
});
it('should display formatted error messages on error doc pages', function() {
browser.get('build/docs/index.html#!error/ng/areq?p0=Missing&p1=not%20a%20function,%20got%20undefined');
expect(element(by.css('.minerr-errmsg')).getText()).toEqual("Argument 'Missing' is not a function, got undefined");
browser.get('build/docs/index-production.html#!error/ng/areq?p0=Missing&p1=not%20a%20function,%20got%20undefined');
expect(element(by.css('.minerr-errmsg')).getText()).toEqual('Argument \'Missing\' is not a function, got undefined');
});
it("should display an error if the page does not exist", function() {
browser.get('build/docs/index.html#!/api/does/not/exist');
expect(element(by.css('h1')).getText()).toBe('Oops!');
it('should display an error if the page does not exist', function() {
browser.get('build/docs/index-production.html#!/api/does/not/exist');
var mainHeader = element(by.css('.main-body h1 '));
expect(mainHeader.getText()).toEqual('Oops!');
});
});
});
});
+8
View File
@@ -0,0 +1,8 @@
{
"root": true,
"extends": "../../../.eslintrc-browser.json",
"globals": {
"lunr": false
}
}
+2 -2
View File
@@ -1,10 +1,11 @@
'use strict';
angular.module('docsApp', [
'ngRoute',
'ngCookies',
'ngSanitize',
'ngAnimate',
'DocsController',
'versionsData',
'pagesData',
'navData',
'directives',
@@ -13,7 +14,6 @@ angular.module('docsApp', [
'search',
'tutorials',
'versions',
'bootstrap',
'ui.bootstrap.dropdown'
])
+14 -1
View File
@@ -1,3 +1,5 @@
'use strict';
angular.module('directives', [])
/**
@@ -34,4 +36,15 @@ angular.module('directives', [])
return function(scope, element) {
$anchorScroll.yOffset = element;
};
}]);
}])
.directive('table', function() {
return {
restrict: 'E',
link: function(scope, element, attrs) {
if (!attrs['class']) {
element.addClass('table table-bordered table-striped code-table');
}
}
};
});
+20 -15
View File
@@ -1,14 +1,12 @@
angular.module('DocsController', [])
'use strict';
angular.module('DocsController', ['currentVersionData'])
.controller('DocsController', [
'$scope', '$rootScope', '$location', '$window', '$cookies', 'openPlunkr',
'NG_PAGES', 'NG_NAVIGATION', 'NG_VERSION',
function($scope, $rootScope, $location, $window, $cookies, openPlunkr,
NG_PAGES, NG_NAVIGATION, NG_VERSION) {
$scope.openPlunkr = openPlunkr;
$scope.docsVersion = NG_VERSION.isSnapshot ? 'snapshot' : NG_VERSION.version;
'$scope', '$rootScope', '$location', '$window', '$cookies',
'NG_PAGES', 'NG_NAVIGATION', 'CURRENT_NG_VERSION',
function($scope, $rootScope, $location, $window, $cookies,
NG_PAGES, NG_NAVIGATION, CURRENT_NG_VERSION) {
$scope.navClass = function(navItem) {
return {
@@ -23,15 +21,22 @@ angular.module('DocsController', [])
$scope.$on('$includeContentLoaded', function() {
var pagePath = $scope.currentPage ? $scope.currentPage.path : $location.path();
$window._gaq.push(['_trackPageview', pagePath]);
$scope.loading = false;
});
$scope.$on('$includeContentError', function() {
$scope.loading = false;
});
$scope.$watch(function docsPathWatch() {return $location.path(); }, function docsPathWatchAction(path) {
path = path.replace(/^\/?(.+?)(\/index)?\/?$/, '$1');
currentPage = $scope.currentPage = NG_PAGES[path];
var currentPage = $scope.currentPage = NG_PAGES[path];
if ( currentPage ) {
$scope.loading = true;
if (currentPage) {
$scope.partialPath = 'partials/' + path + '.html';
$scope.currentArea = NG_NAVIGATION[currentPage.area];
var pathParts = currentPage.path.split('/');
@@ -39,7 +44,7 @@ angular.module('DocsController', [])
var breadcrumbPath = '';
angular.forEach(pathParts, function(part) {
breadcrumbPath += part;
breadcrumb.push({ name: (NG_PAGES[breadcrumbPath]&&NG_PAGES[breadcrumbPath].name) || part, url: breadcrumbPath });
breadcrumb.push({ name: (NG_PAGES[breadcrumbPath] && NG_PAGES[breadcrumbPath].name) || part, url: breadcrumbPath });
breadcrumbPath += '/';
});
} else {
@@ -53,12 +58,12 @@ angular.module('DocsController', [])
Initialize
***********************************/
$scope.versionNumber = angular.version.full;
$scope.version = angular.version.full + " " + angular.version.codeName;
$scope.versionNumber = CURRENT_NG_VERSION.full;
$scope.version = CURRENT_NG_VERSION.full + ' ' + CURRENT_NG_VERSION.codeName;
$scope.loading = 0;
var INDEX_PATH = /^(\/|\/index[^\.]*.html)$/;
var INDEX_PATH = /^(\/|\/index[^.]*.html)$/;
if (!$location.path() || INDEX_PATH.test($location.path())) {
$location.path('/api').replace();
}
+25 -16
View File
@@ -1,23 +1,25 @@
'use strict';
angular.module('errors', ['ngSanitize'])
.filter('errorLink', ['$sanitize', function ($sanitize) {
var LINKY_URL_REGEXP = /((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s\.\;\,\(\)\{\}<>]/g,
.filter('errorLink', ['$sanitize', function($sanitize) {
var LINKY_URL_REGEXP = /((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>]/g,
MAILTO_REGEXP = /^mailto:/,
STACK_TRACE_REGEXP = /:\d+:\d+$/;
var truncate = function (text, nchars) {
var truncate = function(text, nchars) {
if (text.length > nchars) {
return text.substr(0, nchars - 3) + '...';
}
return text;
};
return function (text, target) {
var targetHtml = target ? ' target="' + target + '"' : '';
return function(text, target) {
if (!text) return text;
return $sanitize(text.replace(LINKY_URL_REGEXP, function (url) {
var targetHtml = target ? ' target="' + target + '"' : '';
return $sanitize(text.replace(LINKY_URL_REGEXP, function(url) {
if (STACK_TRACE_REGEXP.test(url)) {
return url;
}
@@ -25,7 +27,7 @@ angular.module('errors', ['ngSanitize'])
// if we did not match ftp/http/mailto then assume mailto
if (!/^((ftp|https?):\/\/|mailto:)/.test(url)) url = 'mailto:' + url;
return '<a' + targetHtml + ' href="' + url +'">' +
return '<a' + targetHtml + ' href="' + url + '">' +
truncate(url.replace(MAILTO_REGEXP, ''), 60) +
'</a>';
}));
@@ -33,30 +35,37 @@ angular.module('errors', ['ngSanitize'])
}])
.directive('errorDisplay', ['$location', 'errorLinkFilter', function ($location, errorLinkFilter) {
var interpolate = function (formatString) {
.directive('errorDisplay', ['$location', 'errorLinkFilter', function($location, errorLinkFilter) {
var encodeAngleBrackets = function(text) {
return text.replace(/</g, '&lt;').replace(/>/g, '&gt;');
};
var interpolate = function(formatString) {
var formatArgs = arguments;
return formatString.replace(/\{\d+\}/g, function (match) {
return formatString.replace(/\{\d+\}/g, function(match) {
// Drop the braces and use the unary plus to convert to an integer.
// The index will be off by one because of the formatString.
var index = +match.slice(1, -1);
if (index + 1 >= formatArgs.length) {
return match;
}
return formatArgs[index+1];
return formatArgs[index + 1];
});
};
return {
link: function (scope, element, attrs) {
link: function(scope, element, attrs) {
var search = $location.search(),
formatArgs = [attrs.errorDisplay],
formattedText,
i;
for (i = 0; angular.isDefined(search['p'+i]); i++) {
formatArgs.push(search['p'+i]);
for (i = 0; angular.isDefined(search['p' + i]); i++) {
formatArgs.push(search['p' + i]);
}
element.html(errorLinkFilter(interpolate.apply(null, formatArgs), '_blank'));
formattedText = encodeAngleBrackets(interpolate.apply(null, formatArgs));
element.html(errorLinkFilter(formattedText, '_blank'));
}
};
}]);
+136 -32
View File
@@ -1,5 +1,56 @@
'use strict';
angular.module('examples', [])
.directive('runnableExample', [function() {
var exampleClassNameSelector = '.runnable-example-file';
var tpl =
'<nav class="runnable-example-tabs" ng-if="tabs">' +
' <a ng-class="{active:$index==activeTabIndex}"' +
'ng-repeat="tab in tabs track by $index" ' +
'href="" ' +
'class="btn"' +
'ng-click="setTab($index)">' +
' {{ tab }}' +
' </a>' +
'</nav>';
return {
restrict: 'C',
scope : true,
controller : ['$scope', function($scope) {
$scope.setTab = function(index) {
var tab = $scope.tabs[index];
$scope.activeTabIndex = index;
$scope.$broadcast('tabChange', index, tab);
};
}],
compile : function(element) {
element.html(tpl + element.html());
return function(scope, element) {
var node = element[0];
var examples = node.querySelectorAll(exampleClassNameSelector);
var tabs = [];
angular.forEach(examples, function(child, index) {
tabs.push(child.getAttribute('name'));
});
if (tabs.length > 0) {
scope.tabs = tabs;
scope.$on('tabChange', function(e, index, title) {
angular.forEach(examples, function(child) {
child.style.display = 'none';
});
var selected = examples[index];
selected.style.display = 'block';
});
scope.setTab(0);
}
};
}
};
}])
.factory('formPostData', ['$document', function($document) {
return function(url, newWindow, fields) {
/**
@@ -22,15 +73,14 @@ angular.module('examples', [])
};
}])
.factory('openPlunkr', ['formPostData', '$http', '$q', function(formPostData, $http, $q) {
.factory('createCopyrightNotice', function() {
var COPYRIGHT = 'Copyright ' + (new Date()).getFullYear() + ' Google Inc. All Rights Reserved.\n'
+ 'Use of this source code is governed by an MIT-style license that\n'
+ 'can be found in the LICENSE file at http://angular.io/license';
var COPYRIGHT_JS_CSS = '\n\n/*\n' + COPYRIGHT + '\n*/';
var COPYRIGHT_HTML = '\n\n<!-- \n' + COPYRIGHT + '\n-->';
function getCopyright(filename) {
return function getCopyright(filename) {
switch (filename.substr(filename.lastIndexOf('.'))) {
case '.html':
return COPYRIGHT_HTML;
@@ -41,37 +91,101 @@ angular.module('examples', [])
return COPYRIGHT;
}
return '';
}
};
})
return function(exampleFolder, clickEvent) {
.directive('plnkrOpener', ['$q', 'getExampleData', 'formPostData', 'createCopyrightNotice', function($q, getExampleData, formPostData, createCopyrightNotice) {
return {
scope: {},
bindToController: {
'examplePath': '@'
},
controllerAs: 'plnkr',
template: '<button ng-click="plnkr.open($event)" class="btn pull-right"> <i class="glyphicon glyphicon-edit">&nbsp;</i> Edit in Plunker</button> ',
controller: [function PlnkrOpenerCtrl() {
var ctrl = this;
var exampleName = 'AngularJS Example';
var newWindow = clickEvent.ctrlKey || clickEvent.metaKey;
ctrl.example = {
path: ctrl.examplePath,
manifest: undefined,
files: undefined,
name: 'AngularJS Example'
};
ctrl.prepareExampleData = function() {
if (ctrl.example.manifest) {
return $q.resolve(ctrl.example);
}
return getExampleData(ctrl.examplePath).then(function(data) {
ctrl.example.files = data.files;
ctrl.example.manifest = data.manifest;
// Build a pretty title for the Plunkr
var exampleNameParts = data.manifest.name.split('-');
exampleNameParts.unshift('AngularJS');
angular.forEach(exampleNameParts, function(part, index) {
exampleNameParts[index] = part.charAt(0).toUpperCase() + part.substr(1);
});
ctrl.example.name = exampleNameParts.join(' - ');
return ctrl.example;
});
};
ctrl.open = function(clickEvent) {
var newWindow = clickEvent.ctrlKey || clickEvent.metaKey;
var postData = {
'tags[0]': 'angularjs',
'tags[1]': 'example',
'private': true
};
// Make sure the example data is available.
// If an XHR must be made, this might break some pop-up blockers when
// new window is requested
ctrl.prepareExampleData()
.then(function() {
angular.forEach(ctrl.example.files, function(file) {
postData['files[' + file.name + ']'] = file.content + createCopyrightNotice(file.name);
});
postData.description = ctrl.example.name;
formPostData('https://plnkr.co/edit/?p=preview', newWindow, postData);
});
};
ctrl.$onInit = function() {
// Initialize the example data, so it's ready when clicking the open button.
// Otherwise pop-up blockers will prevent a new window from opening
ctrl.prepareExampleData(ctrl.example.path);
};
}]
};
}])
.factory('getExampleData', ['$http', '$q', function($http, $q) {
return function(exampleFolder) {
// Load the manifest for the example
$http.get(exampleFolder + '/manifest.json')
return $http.get(exampleFolder + '/manifest.json')
.then(function(response) {
return response.data;
})
.then(function(manifest) {
var filePromises = [];
// Build a pretty title for the Plunkr
var exampleNameParts = manifest.name.split('-');
exampleNameParts.unshift('AngularJS');
angular.forEach(exampleNameParts, function(part, index) {
exampleNameParts[index] = part.charAt(0).toUpperCase() + part.substr(1);
});
exampleName = exampleNameParts.join(' - ');
angular.forEach(manifest.files, function(filename) {
filePromises.push($http.get(exampleFolder + '/' + filename, { transformResponse: [] })
.then(function(response) {
// The manifests provide the production index file but Plunkr wants
// a straight index.html
if (filename === "index-production.html") {
filename = "index.html"
if (filename === 'index-production.html') {
filename = 'index.html';
}
return {
@@ -80,21 +194,11 @@ angular.module('examples', [])
};
}));
});
return $q.all(filePromises);
})
.then(function(files) {
var postData = {};
angular.forEach(files, function(file) {
postData['files[' + file.name + ']'] = file.content + getCopyright(file.name);
return $q.all({
manifest: manifest,
files: $q.all(filePromises)
});
postData['tags[0]'] = "angularjs";
postData['tags[1]'] = "example";
postData.private = true;
postData.description = exampleName;
formPostData('http://plnkr.co/edit/?p=preview', newWindow, postData);
});
};
}]);
+25 -23
View File
@@ -1,3 +1,5 @@
'use strict';
angular.module('search', [])
.controller('DocsSearchCtrl', ['$scope', '$location', 'docsSearch', function($scope, $location, docsSearch) {
@@ -9,7 +11,7 @@ angular.module('search', [])
$scope.search = function(q) {
var MIN_SEARCH_LENGTH = 2;
if(q.length >= MIN_SEARCH_LENGTH) {
if (q.length >= MIN_SEARCH_LENGTH) {
docsSearch(q).then(function(hits) {
// Make sure the areas are always in the same order
var results = {
@@ -23,28 +25,24 @@ angular.module('search', [])
angular.forEach(hits, function(hit) {
var area = hit.area;
var limit = (area == 'api') ? 40 : 14;
var limit = (area === 'api') ? 40 : 14;
results[area] = results[area] || [];
if(results[area].length < limit) {
if (results[area].length < limit) {
results[area].push(hit);
}
});
var totalAreas = 0;
for(var i in results) {
++totalAreas;
}
if(totalAreas > 0) {
var totalAreas = Object.keys(results).length;
if (totalAreas > 0) {
$scope.colClassName = 'cols-' + totalAreas;
}
$scope.hasResults = totalAreas > 0;
$scope.results = results;
});
}
else {
} else {
clearResults();
}
if(!$scope.$$phase) $scope.$apply();
if (!$scope.$$phase) $scope.$apply();
};
$scope.submit = function() {
@@ -52,14 +50,14 @@ angular.module('search', [])
if ($scope.results.api) {
result = $scope.results.api[0];
} else {
for(var i in $scope.results) {
for (var i in $scope.results) {
result = $scope.results[i][0];
if(result) {
if (result) {
break;
}
}
}
if(result) {
if (result) {
$location.path(result.path);
$scope.hideResults();
}
@@ -74,7 +72,7 @@ angular.module('search', [])
.controller('Error404SearchCtrl', ['$scope', '$location', 'docsSearch',
function($scope, $location, docsSearch) {
docsSearch($location.path().split(/[\/\.:]/).pop()).then(function(results) {
docsSearch($location.path().split(/[/.:]/).pop()).then(function(results) {
$scope.results = {};
angular.forEach(results, function(result) {
var area = $scope.results[result.area] || [];
@@ -92,10 +90,12 @@ angular.module('search', [])
// It should only be used where the browser does not support WebWorkers
function localSearchFactory($http, $timeout, NG_PAGES) {
console.log('Using Local Search Index');
if (window.console && window.console.log) {
window.console.log('Using Local Search Index');
}
// Create the lunr index
var index = lunr(function() {
var index = lunr(/** @this */ function() {
this.ref('path');
this.field('titleWords', {boost: 50});
this.field('members', { boost: 40});
@@ -136,12 +136,14 @@ angular.module('search', [])
// It should only be used where the browser does support WebWorkers
function webWorkerSearchFactory($q, $rootScope, NG_PAGES) {
console.log('Using WebWorker Search Index')
if (window.console && window.console.log) {
window.console.log('Using WebWorker Search Index');
}
var searchIndex = $q.defer();
var results;
var worker = new Worker('js/search-worker.js');
var worker = new window.Worker('js/search-worker.js');
// The worker will send us a message in two situations:
// - when the index has been built, ready to run a query
@@ -149,7 +151,7 @@ angular.module('search', [])
worker.onmessage = function(oEvent) {
$rootScope.$apply(function() {
switch(oEvent.data.e) {
switch (oEvent.data.e) {
case 'index-ready':
searchIndex.resolve();
break;
@@ -200,13 +202,13 @@ angular.module('search', [])
};
})
.directive('docsSearchInput', ['$document',function($document) {
.directive('docsSearchInput', ['$document', function($document) {
return function(scope, element, attrs) {
var ESCAPE_KEY_KEYCODE = 27,
FORWARD_SLASH_KEYCODE = 191;
angular.element($document[0].body).on('keydown', function(event) {
var input = element[0];
if(event.keyCode == FORWARD_SLASH_KEYCODE && document.activeElement != input) {
if (event.keyCode === FORWARD_SLASH_KEYCODE && $document[0].activeElement !== input) {
event.stopPropagation();
event.preventDefault();
input.focus();
@@ -214,7 +216,7 @@ angular.module('search', [])
});
element.on('keydown', function(event) {
if(event.keyCode == ESCAPE_KEY_KEYCODE) {
if (event.keyCode === ESCAPE_KEY_KEYCODE) {
event.stopPropagation();
event.preventDefault();
scope.$apply(function() {
+8 -5
View File
@@ -1,3 +1,5 @@
'use strict';
angular.module('tutorials', [])
.directive('docTutorialNav', function() {
@@ -5,7 +7,8 @@ angular.module('tutorials', [])
'',
'step_00', 'step_01', 'step_02', 'step_03', 'step_04',
'step_05', 'step_06', 'step_07', 'step_08', 'step_09',
'step_10', 'step_11', 'step_12', 'the_end'
'step_10', 'step_11', 'step_12', 'step_13', 'step_14',
'the_end'
];
return {
scope: {},
@@ -19,7 +22,7 @@ angular.module('tutorials', [])
scope.seq = seq;
scope.prev = pages[seq];
scope.next = pages[2 + seq];
scope.diffLo = seq ? (seq - 1): '0~1';
scope.diffLo = seq ? (seq - 1) : '0~1';
scope.diffHi = seq;
element.addClass('btn-group');
@@ -39,11 +42,11 @@ angular.module('tutorials', [])
'<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' +
' <p>Refresh your browser or check out this step online: '+
' <p>Refresh your browser or check out this step online: ' +
'<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}}" title="See diff on Github">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>'
};
});
});
+37 -28
View File
@@ -1,33 +1,42 @@
"use strict";
'use strict';
/* global console */
angular.module('versions', [])
angular.module('versions', ['currentVersionData', 'allVersionsData'])
.controller('DocsVersionsCtrl', ['$scope', '$location', '$window', 'NG_VERSIONS', function($scope, $location, $window, NG_VERSIONS) {
$scope.docs_version = NG_VERSIONS[0];
$scope.docs_versions = NG_VERSIONS;
.directive('versionPicker', function() {
return {
restrict: 'E',
scope: true,
controllerAs: '$ctrl',
controller: ['$location', '$window', 'CURRENT_NG_VERSION', 'ALL_NG_VERSIONS',
/** @this VersionPickerController */
function VersionPickerController($location, $window, CURRENT_NG_VERSION, ALL_NG_VERSIONS) {
for(var i=0, minor = NaN; i < NG_VERSIONS.length; i++) {
var version = NG_VERSIONS[i];
// NaN will give false here
if (minor <= version.minor) {
continue;
var versionStr = CURRENT_NG_VERSION.isSnapshot ? 'snapshot' : CURRENT_NG_VERSION.version;
this.versions = ALL_NG_VERSIONS;
this.selectedVersion = find(ALL_NG_VERSIONS, function(value) { return value.version.version === versionStr; });
this.jumpToDocsVersion = function(value) {
var currentPagePath = $location.path().replace(/\/$/, '');
$window.location = value.docsUrl + currentPagePath;
};
}],
template:
'<div class="picker version-picker">' +
' <select ng-options="v as v.label group by v.group for v in $ctrl.versions"' +
' ng-model="$ctrl.selectedVersion"' +
' ng-change="$ctrl.jumpToDocsVersion($ctrl.selectedVersion)"' +
' class="docs-version-jump">' +
' </select>' +
'</div>'
};
function find(collection, matcherFn) {
for (var i = 0, ii = collection.length; i < ii; ++i) {
if (matcherFn(collection[i])) {
return collection[i];
}
}
version.isLatest = true;
minor = version.minor;
}
$scope.getGroupName = function(v) {
return v.isLatest ? 'Latest' : ('v' + v.major + '.' + v.minor + '.x');
};
$scope.jumpToDocsVersion = function(version) {
var currentPagePath = $location.path().replace(/\/$/, ''),
url = '';
if (version.isOldDocsUrl) {
url = version.docsUrl;
}else{
url = version.docsUrl + currentPagePath;
}
$window.location = url;
};
}]);
});
+23
View File
@@ -0,0 +1,23 @@
{
"root": true,
"extends": "../../../.eslintrc-browser.json",
"env": {
"jasmine": true
},
"rules": {
// Some rules are not that important in tests and conflict with
// Jasmine or would make it easier to write some tests; we disable
// those ones here.
"no-invalid-this": "off",
"no-throw-literal": "off",
"no-unused-vars": "off"
},
"globals": {
// ngMocks
"module": false,
"inject": true
}
}
+3 -1
View File
@@ -1,4 +1,6 @@
describe("code", function() {
'use strict';
describe('code', function() {
var prettyPrintOne, oldPP;
var compile, scope;
+13 -7
View File
@@ -1,12 +1,18 @@
describe("DocsController", function() {
'use strict';
describe('DocsController', function() {
var $scope;
angular.module('fake', [])
.value('$cookies', {})
.value('openPlunkr', function() {})
.value('NG_PAGES', {})
.value('NG_NAVIGATION', {})
.value('NG_VERSION', {});
.value('NG_NAVIGATION', {});
angular.module('currentVersionData', [])
.value('CURRENT_NG_VERSION', {});
angular.module('allVersionsData', [])
.value('ALL_NG_VERSIONS', {});
beforeEach(module('fake', 'DocsController'));
beforeEach(inject(function($rootScope, $controller) {
@@ -16,7 +22,7 @@ describe("DocsController", function() {
describe('afterPartialLoaded', function() {
it("should update the Google Analytics with currentPage path if currentPage exists", inject(function($window) {
it('should update the Google Analytics with currentPage path if currentPage exists', inject(function($window) {
$window._gaq = [];
$scope.currentPage = { path: 'a/b/c' };
$scope.$broadcast('$includeContentLoaded');
@@ -24,9 +30,9 @@ describe("DocsController", function() {
}));
it("should update the Google Analytics with $location.path if currentPage is missing", inject(function($window, $location) {
it('should update the Google Analytics with $location.path if currentPage is missing', inject(function($window, $location) {
$window._gaq = [];
spyOn($location, 'path').andReturn('x/y/z');
spyOn($location, 'path').and.returnValue('x/y/z');
$scope.$broadcast('$includeContentLoaded');
expect($window._gaq.pop()).toEqual(['_trackPageview', 'x/y/z']);
}));
+166
View File
@@ -0,0 +1,166 @@
'use strict';
describe('errors', function() {
// Mock `ngSanitize` module
angular.
module('ngSanitize', []).
value('$sanitize', jasmine.createSpy('$sanitize').and.callFake(angular.identity));
beforeEach(module('errors'));
describe('errorDisplay', function() {
var $sanitize;
var errorLinkFilter;
beforeEach(inject(function(_$sanitize_, _errorLinkFilter_) {
$sanitize = _$sanitize_;
errorLinkFilter = _errorLinkFilter_;
}));
it('should return empty input unchanged', function() {
var inputs = [undefined, null, false, 0, ''];
var remaining = inputs.length;
inputs.forEach(function(falsyValue) {
expect(errorLinkFilter(falsyValue)).toBe(falsyValue);
remaining--;
});
expect(remaining).toBe(0);
});
it('should recognize URLs and convert them to `<a>`', function() {
var urls = [
['ftp://foo/bar?baz#qux'],
['http://foo/bar?baz#qux'],
['https://foo/bar?baz#qux'],
['mailto:foo_bar@baz.qux', null, 'foo_bar@baz.qux'],
['foo_bar@baz.qux', 'mailto:foo_bar@baz.qux', 'foo_bar@baz.qux']
];
var remaining = urls.length;
urls.forEach(function(values) {
var actualUrl = values[0];
var expectedUrl = values[1] || actualUrl;
var expectedText = values[2] || expectedUrl;
var anchor = '<a href="' + expectedUrl + '">' + expectedText + '</a>';
var input = 'start ' + actualUrl + ' end';
var output = 'start ' + anchor + ' end';
expect(errorLinkFilter(input)).toBe(output);
remaining--;
});
expect(remaining).toBe(0);
});
it('should not recognize stack-traces as URLs', function() {
var urls = [
'ftp://foo/bar?baz#qux:4:2',
'http://foo/bar?baz#qux:4:2',
'https://foo/bar?baz#qux:4:2',
'mailto:foo_bar@baz.qux:4:2',
'foo_bar@baz.qux:4:2'
];
var remaining = urls.length;
urls.forEach(function(url) {
var input = 'start ' + url + ' end';
expect(errorLinkFilter(input)).toBe(input);
remaining--;
});
expect(remaining).toBe(0);
});
it('should should set `[target]` if specified', function() {
var url = 'https://foo/bar?baz#qux';
var target = '_blank';
var outputWithoutTarget = '<a href="' + url + '">' + url + '</a>';
var outputWithTarget = '<a target="' + target + '" href="' + url + '">' + url + '</a>';
expect(errorLinkFilter(url)).toBe(outputWithoutTarget);
expect(errorLinkFilter(url, target)).toBe(outputWithTarget);
});
it('should truncate the contents of the generated `<a>` to 60 characters', function() {
var looongUrl = 'https://foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo';
var truncatedUrl = 'https://foooooooooooooooooooooooooooooooooooooooooooooooo...';
var output = '<a href="' + looongUrl + '">' + truncatedUrl + '</a>';
expect(looongUrl.length).toBeGreaterThan(60);
expect(truncatedUrl.length).toBe(60);
expect(errorLinkFilter(looongUrl)).toBe(output);
});
it('should pass the final string through `$sanitize`', function() {
$sanitize.calls.reset();
var input = 'start https://foo/bar?baz#qux end';
var output = errorLinkFilter(input);
expect($sanitize).toHaveBeenCalledTimes(1);
expect($sanitize).toHaveBeenCalledWith(output);
});
});
describe('errorDisplay', function() {
var $compile;
var $location;
var $rootScope;
var errorLinkFilter;
beforeEach(module(function($provide) {
$provide.decorator('errorLinkFilter', function() {
errorLinkFilter = jasmine.createSpy('errorLinkFilter');
errorLinkFilter.and.callFake(angular.identity);
return errorLinkFilter;
});
}));
beforeEach(inject(function(_$compile_, _$location_, _$rootScope_) {
$compile = _$compile_;
$location = _$location_;
$rootScope = _$rootScope_;
}));
it('should set the element\'s HTML', function() {
var elem = $compile('<span error-display="bar">foo</span>')($rootScope);
expect(elem.html()).toBe('bar');
});
it('should interpolate the contents against `$location.search()`', function() {
spyOn($location, 'search').and.returnValue({p0: 'foo', p1: 'bar'});
var elem = $compile('<span error-display="foo = {0}, bar = {1}"></span>')($rootScope);
expect(elem.html()).toBe('foo = foo, bar = bar');
});
it('should pass the interpolated text through `errorLinkFilter`', function() {
$location.search = jasmine.createSpy('search').and.returnValue({p0: 'foo'});
$compile('<span error-display="foo = {0}"></span>')($rootScope);
expect(errorLinkFilter).toHaveBeenCalledTimes(1);
expect(errorLinkFilter).toHaveBeenCalledWith('foo = foo', '_blank');
});
it('should encode `<` and `>`', function() {
var elem = $compile('<span error-display="&lt;xyz&gt;"></span>')($rootScope);
expect(elem.text()).toBe('<xyz>');
});
});
});
-10
View File
@@ -1,10 +0,0 @@
{
"name": "AngularJS-docs-app",
"dependencies": {
"jquery": "2.1.1",
"lunr.js": "0.5.12",
"open-sans-fontface": "1.0.4",
"google-code-prettify": "1.0.1",
"bootstrap": "3.1.1"
}
}
+14 -6
View File
@@ -1,4 +1,4 @@
"use strict";
'use strict';
var path = require('canonical-path');
var packagePath = __dirname;
@@ -6,7 +6,7 @@ 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 node module.
module.exports = new Package('angularjs', [
require('dgeni-packages/ngdoc'),
require('dgeni-packages/nunjucks'),
@@ -52,8 +52,12 @@ module.exports = new Package('angularjs', [
.config(function(parseTagsProcessor) {
parseTagsProcessor.tagDefinitions.push(require('./tag-defs/deprecated')); // this will override the jsdoc version
parseTagsProcessor.tagDefinitions.push(require('./tag-defs/tutorial-step'));
parseTagsProcessor.tagDefinitions.push(require('./tag-defs/sortOrder'));
parseTagsProcessor.tagDefinitions.push(require('./tag-defs/installation'));
parseTagsProcessor.tagDefinitions.push(require('./tag-defs/this'));
})
@@ -63,7 +67,11 @@ module.exports = new Package('angularjs', [
.config(function(templateFinder, renderDocsProcessor, gitData) {
templateFinder.templateFolders.unshift(path.resolve(packagePath, 'templates'));
// We are completely overwriting the folders
templateFinder.templateFolders.length = 0;
templateFinder.templateFolders.unshift(path.resolve(packagePath, 'templates/examples'));
templateFinder.templateFolders.unshift(path.resolve(packagePath, 'templates/ngdoc'));
templateFinder.templateFolders.unshift(path.resolve(packagePath, 'templates/app'));
renderDocsProcessor.extraData.git = gitData;
})
@@ -86,7 +94,7 @@ module.exports = new Package('angularjs', [
docTypes: ['overview', 'tutorial'],
getPath: function(doc) {
var docPath = path.dirname(doc.fileInfo.relativePath);
if ( doc.fileInfo.baseName !== 'index' ) {
if (doc.fileInfo.baseName !== 'index') {
docPath = path.join(docPath, doc.fileInfo.baseName);
}
return docPath;
@@ -107,12 +115,12 @@ module.exports = new Package('angularjs', [
});
computePathsProcessor.pathTemplates.push({
docTypes: ['module' ],
docTypes: ['module'],
pathTemplate: '${area}/${name}',
outputPathTemplate: 'partials/${area}/${name}.html'
});
computePathsProcessor.pathTemplates.push({
docTypes: ['componentGroup' ],
docTypes: ['componentGroup'],
pathTemplate: '${area}/${moduleName}/${groupType}',
outputPathTemplate: 'partials/${area}/${moduleName}/${groupType}.html'
});
+4 -3
View File
@@ -1,5 +1,6 @@
"use strict";
'use strict';
// eslint-disable-next-line new-cap
var encoder = new require('node-html-encoder').Encoder();
/**
@@ -11,7 +12,7 @@ module.exports = function typeInlineTagDef(getTypeClass) {
return {
name: 'type',
handler: function(doc, tagName, tagDescription) {
return '<a href="" class="' + getTypeClass(tagDescription) + '">'+encoder.htmlEncode(tagDescription) + '</a>';
return '<a href="" class="' + getTypeClass(tagDescription) + '">' + encoder.htmlEncode(tagDescription) + '</a>';
}
};
};
};
+27 -8
View File
@@ -1,24 +1,39 @@
"use strict";
var _ = require('lodash');
var path = require('canonical-path');
'use strict';
/**
* @dgProcessor errorDocsProcessor
* @description
* Process "error" docType docs and generate errorNamespace docs
*/
module.exports = function errorDocsProcessor(errorNamespaceMap, getMinerrInfo) {
module.exports = function errorDocsProcessor(log, errorNamespaceMap, getMinerrInfo) {
return {
$runAfter: ['tags-extracted'],
$runBefore: ['extra-docs-added'],
$process: function(docs) {
// Get the extracted min errors to compare with the error docs, and report any mismatch
var collectedErrors = require('../../../build/errors.json').errors;
var flatErrors = [];
for (var namespace in collectedErrors) {
for (var error in collectedErrors[namespace]) {
flatErrors.push(namespace + ':' + error);
}
}
// Create error namespace docs and attach error docs to each
docs.forEach(function(doc) {
var parts, namespaceDoc;
if ( doc.docType === 'error' ) {
if (doc.docType === 'error') {
var matchingMinErr = flatErrors.indexOf(doc.name);
if (matchingMinErr === -1) {
log.warn('Error doc: ' + doc.name + ' has no matching min error');
} else {
flatErrors.splice(matchingMinErr, 1);
}
// Parse out the error info from the id
parts = doc.name.split(':');
@@ -27,7 +42,7 @@ module.exports = function errorDocsProcessor(errorNamespaceMap, getMinerrInfo) {
// Get or create the relevant errorNamespace doc
namespaceDoc = errorNamespaceMap.get(doc.namespace);
if ( !namespaceDoc ) {
if (!namespaceDoc) {
namespaceDoc = {
area: 'error',
name: doc.namespace,
@@ -44,9 +59,13 @@ module.exports = function errorDocsProcessor(errorNamespaceMap, getMinerrInfo) {
}
});
flatErrors.forEach(function(value) {
log.warn('No error doc exists for min error: ' + value);
});
errorNamespaceMap.forEach(function(errorNamespace) {
docs.push(errorNamespace);
});
}
};
};
};
+3 -4
View File
@@ -1,7 +1,6 @@
"use strict";
'use strict';
var _ = require('lodash');
var path = require('canonical-path');
/**
* @dgProcessor generateIndexPagesProcessor
@@ -21,7 +20,7 @@ module.exports = function generateIndexPagesProcessor() {
// Collect up all the areas in the docs
var areas = {};
docs.forEach(function(doc) {
if ( doc.area ) {
if (doc.area) {
areas[doc.area] = doc.area;
}
});
@@ -40,4 +39,4 @@ module.exports = function generateIndexPagesProcessor() {
});
}
};
};
};
+10 -10
View File
@@ -1,4 +1,4 @@
"use strict";
'use strict';
var _ = require('lodash');
var fs = require('fs');
@@ -34,10 +34,10 @@ module.exports = function generateKeywordsProcessor(log, readFilesProcessor) {
var areasToSearch;
// Keywords start with "ng:" or one of $, _ or a letter
var KEYWORD_REGEX = /^((ng:|[\$_a-z])[\w\-_]+)/;
var KEYWORD_REGEX = /^((ng:|[$_a-z])[\w\-_]+)/;
// Load up the keywords to ignore, if specified in the config
if ( this.ignoreWordsFile ) {
if (this.ignoreWordsFile) {
var ignoreWordsPath = path.resolve(readFilesProcessor.basePath, this.ignoreWordsFile);
wordsToIgnore = fs.readFileSync(ignoreWordsPath, 'utf8').toString().split(/[,\s\n\r]+/gm);
@@ -59,7 +59,7 @@ module.exports = function generateKeywordsProcessor(log, readFilesProcessor) {
// without the ng to the title text, e.g. "controller".
function extractTitleWords(title) {
var match = /ng([A-Z]\w*)/.exec(title);
if ( match ) {
if (match) {
title = title + ' ' + match[1].toLowerCase();
}
return title;
@@ -67,12 +67,12 @@ module.exports = function generateKeywordsProcessor(log, readFilesProcessor) {
function extractWords(text, words, keywordMap) {
var tokens = text.toLowerCase().split(/[\.\s,`'"#]+/mg);
_.forEach(tokens, function(token){
var tokens = text.toLowerCase().split(/[.\s,`'"#]+/mg);
_.forEach(tokens, function(token) {
var match = token.match(KEYWORD_REGEX);
if (match){
if (match) {
var key = match[1];
if ( !keywordMap[key]) {
if (!keywordMap[key]) {
keywordMap[key] = true;
words.push(key);
}
@@ -96,11 +96,11 @@ module.exports = function generateKeywordsProcessor(log, readFilesProcessor) {
// Search each top level property of the document for search terms
_.forEach(doc, function(value, key) {
if ( _.isString(value) && !propertiesToIgnore[key] ) {
if (_.isString(value) && !propertiesToIgnore[key]) {
extractWords(value, words, keywordMap);
}
if ( key === 'methods' || key === 'properties' || key === 'events' ) {
if (key === 'methods' || key === 'properties' || key === 'events') {
_.forEach(value, function(member) {
extractWords(member.name, members, membersMap);
});
+4 -4
View File
@@ -1,4 +1,4 @@
"use strict";
'use strict';
var _ = require('lodash');
var path = require('canonical-path');
@@ -67,7 +67,7 @@ module.exports = function generatePagesDataProcessor(log) {
})
.tap(function(docTypes) {
if ( docTypes.input ) {
if (docTypes.input) {
docTypes.directive = docTypes.directive || [];
// Combine input docTypes into directive docTypes
docTypes.directive = docTypes.directive.concat(docTypes.input);
@@ -79,7 +79,7 @@ module.exports = function generatePagesDataProcessor(log) {
sectionPages = _.sortBy(sectionPages, 'name');
if ( sectionPages.length > 0 ) {
if (sectionPages.length > 0) {
// Push a navItem for this section
navItems.push({
name: sectionName,
@@ -158,7 +158,7 @@ module.exports = function generatePagesDataProcessor(log) {
// We are only interested in pages that are not landing pages
var navPages = _.filter(pages, function(page) {
return page.docType != 'componentGroup';
return page.docType !== 'componentGroup';
});
// Generate an object collection of pages that is grouped by area e.g.
+90 -16
View File
@@ -1,6 +1,7 @@
"use strict";
'use strict';
var _ = require('lodash');
var exec = require('shelljs').exec;
var semver = require('semver');
/**
* @dgProcessor generateVersionDocProcessor
@@ -12,23 +13,96 @@ module.exports = function generateVersionDocProcessor(gitData) {
return {
$runAfter: ['generatePagesDataProcessor'],
$runBefore: ['rendering-docs'],
// the blacklist is to remove rogue builds that are in the npm repository but not on code.angularjs.org
blacklist: ['1.3.4-build.3588'],
$process: function(docs) {
var versionDoc = {
docType: 'versions-data',
id: 'versions-data',
template: 'versions-data.template.js',
outputPath: 'js/versions-data.js',
currentVersion: gitData.version
};
var blacklist = this.blacklist;
var currentVersion = require('../../../build/version.json');
var output = exec('yarn info angular versions --json', { silent: true }).stdout.split('\n')[0];
var allVersions = processAllVersionsResponse(JSON.parse(output).data);
versionDoc.versions = _(gitData.versions)
.filter(function(version) { return version.major > 0; })
.push(gitData.version)
.reverse()
.value();
docs.push({
docType: 'current-version-data',
id: 'current-version-data',
template: 'angular-service.template.js',
outputPath: 'js/current-version-data.js',
ngModuleName: 'currentVersionData',
serviceName: 'CURRENT_NG_VERSION',
serviceValue: currentVersion
});
docs.push(versionDoc);
docs.push({
docType: 'allversions-data',
id: 'allversions-data',
template: 'angular-service.template.js',
outputPath: 'js/all-versions-data.js',
ngModuleName: 'allVersionsData',
serviceName: 'ALL_NG_VERSIONS',
serviceValue: allVersions
});
function processAllVersionsResponse(versions) {
var latestMap = {};
versions = versions
.filter(function(versionStr) {
return blacklist.indexOf(versionStr) === -1;
})
.map(function(versionStr) {
return semver.parse(versionStr);
})
.filter(function(version) {
return version && version.major > 0;
})
.map(function(version) {
var key = version.major + '.' + version.minor;
var latest = latestMap[key];
if (!latest || version.compare(latest) > 0) {
latestMap[key] = version;
}
return version;
})
.map(function(version) {
return makeOption(version);
})
.reverse();
var latest = sortObject(latestMap, reverse(semver.compare))
.map(function(version) { return makeOption(version, 'Latest'); });
return [makeOption({version: 'snapshot'}, 'Latest', 'master')]
.concat(latest)
.concat(versions);
}
function makeOption(version, group, label) {
return {
version: version,
label: label || 'v' + version.raw,
group: group || 'v' + version.major + '.' + version.minor,
docsUrl: createDocsUrl(version)
};
}
function createDocsUrl(version) {
var url = 'https://code.angularjs.org/' + version.version + '/docs';
// Versions before 1.0.2 had a different docs folder name
if (version.major === 1 && version.minor === 0 && version.patch < 2) {
url += '-' + version.version;
}
return url;
}
function reverse(fn) {
return function(left, right) { return -fn(left, right); };
}
function sortObject(obj, cmp) {
return Object.keys(obj).map(function(key) { return obj[key]; }).sort(cmp);
}
}
};
};
};
+8 -7
View File
@@ -1,11 +1,11 @@
"use strict";
'use strict';
module.exports = function debugDeployment(getVersion) {
return {
name: 'debug',
examples: {
commonFiles: {
scripts: [ '../../../angular.js' ]
scripts: ['../../../angular.js']
},
dependencyPath: '../../../'
},
@@ -17,13 +17,13 @@ module.exports = function debugDeployment(getVersion) {
'../angular-sanitize.js',
'../angular-touch.js',
'../angular-animate.js',
'components/marked-' + getVersion('marked', 'node_modules', 'package.json') + '/lib/marked.js',
'js/angular-bootstrap/bootstrap.js',
'components/marked-' + getVersion('marked') + '/lib/marked.js',
'js/angular-bootstrap/dropdown-toggle.js',
'components/lunr.js-' + getVersion('lunr.js') + '/lunr.js',
'components/lunr-' + getVersion('lunr') + '/lunr.js',
'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/prettify.js',
'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/lang-css.js',
'js/versions-data.js',
'js/current-version-data.js',
'js/all-versions-data.js',
'js/pages-data.js',
'js/nav-data.js',
'js/docs.js'
@@ -32,8 +32,9 @@ module.exports = function debugDeployment(getVersion) {
'components/bootstrap-' + getVersion('bootstrap') + '/css/bootstrap.css',
'components/open-sans-fontface-' + getVersion('open-sans-fontface') + '/open-sans.css',
'css/prettify-theme.css',
'css/angular-topnav.css',
'css/docs.css',
'css/animations.css'
]
};
};
};
+8 -7
View File
@@ -1,11 +1,11 @@
"use strict";
'use strict';
module.exports = function defaultDeployment(getVersion) {
return {
name: 'default',
examples: {
commonFiles: {
scripts: [ '../../../angular.min.js' ]
scripts: ['../../../angular.min.js']
},
dependencyPath: '../../../'
},
@@ -17,13 +17,13 @@ module.exports = function defaultDeployment(getVersion) {
'../angular-sanitize.min.js',
'../angular-touch.min.js',
'../angular-animate.min.js',
'components/marked-' + getVersion('marked', 'node_modules', 'package.json') + '/lib/marked.js',
'js/angular-bootstrap/bootstrap.min.js',
'components/marked-' + getVersion('marked') + '/lib/marked.js',
'js/angular-bootstrap/dropdown-toggle.min.js',
'components/lunr.js-' + getVersion('lunr.js') + '/lunr.min.js',
'components/lunr-' + getVersion('lunr') + '/lunr.min.js',
'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/prettify.js',
'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/lang-css.js',
'js/versions-data.js',
'js/current-version-data.js',
'js/all-versions-data.js',
'js/pages-data.js',
'js/nav-data.js',
'js/docs.min.js'
@@ -32,8 +32,9 @@ module.exports = function defaultDeployment(getVersion) {
'components/bootstrap-' + getVersion('bootstrap') + '/css/bootstrap.min.css',
'components/open-sans-fontface-' + getVersion('open-sans-fontface') + '/open-sans.css',
'css/prettify-theme.css',
'css/angular-topnav.css',
'css/docs.css',
'css/animations.css'
]
};
};
};
+7 -6
View File
@@ -1,4 +1,4 @@
"use strict";
'use strict';
module.exports = function jqueryDeployment(getVersion) {
return {
@@ -21,13 +21,13 @@ module.exports = function jqueryDeployment(getVersion) {
'../angular-sanitize.min.js',
'../angular-touch.min.js',
'../angular-animate.min.js',
'components/marked-' + getVersion('marked', 'node_modules', 'package.json') + '/lib/marked.js',
'js/angular-bootstrap/bootstrap.min.js',
'components/marked-' + getVersion('marked') + '/lib/marked.js',
'js/angular-bootstrap/dropdown-toggle.min.js',
'components/lunr.js-' + getVersion('lunr.js') + '/lunr.min.js',
'components/lunr-' + getVersion('lunr') + '/lunr.min.js',
'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/prettify.js',
'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/lang-css.js',
'js/versions-data.js',
'js/current-version-data.js',
'js/all-versions-data.js',
'js/pages-data.js',
'js/nav-data.js',
'js/docs.min.js'
@@ -36,8 +36,9 @@ module.exports = function jqueryDeployment(getVersion) {
'components/bootstrap-' + getVersion('bootstrap') + '/css/bootstrap.min.css',
'components/open-sans-fontface-' + getVersion('open-sans-fontface') + '/open-sans.css',
'css/prettify-theme.css',
'css/angular-topnav.css',
'css/docs.css',
'css/animations.css'
]
};
};
};
+24 -9
View File
@@ -1,16 +1,30 @@
"use strict";
'use strict';
var versionInfo = require('../../../../lib/versions/version-info');
var cdnUrl = "//ajax.googleapis.com/ajax/libs/angularjs/" + versionInfo.cdnVersion;
var googleCdnUrl = '//ajax.googleapis.com/ajax/libs/angularjs/';
var angularCodeUrl = '//code.angularjs.org/';
var cdnUrl = googleCdnUrl + versionInfo.cdnVersion;
// The plnkr examples must use the code.angularjs.org repo for the snapshot,
// and the cdn for the tagged version and, if the build is not tagged, the currentVersion.
//
// The currentVersion may not be available on the cdn (e.g. if built locally, or hasn't been pushed
// yet). This will lead to a 404, but this is preferable to loading a version with which the example
// might not work (possibly in subtle ways).
var examplesCdnUrl = versionInfo.currentVersion.isSnapshot ?
(angularCodeUrl + 'snapshot') :
(googleCdnUrl + (versionInfo.currentVersion.version || versionInfo.currentVersion));
module.exports = function productionDeployment(getVersion) {
return {
name: 'production',
examples: {
commonFiles: {
scripts: [ cdnUrl + '/angular.min.js' ]
scripts: [examplesCdnUrl + '/angular.min.js']
},
dependencyPath: cdnUrl + '/'
dependencyPath: examplesCdnUrl + '/'
},
scripts: [
cdnUrl + '/angular.min.js',
@@ -20,13 +34,13 @@ module.exports = function productionDeployment(getVersion) {
cdnUrl + '/angular-sanitize.min.js',
cdnUrl + '/angular-touch.min.js',
cdnUrl + '/angular-animate.min.js',
'components/marked-' + getVersion('marked', 'node_modules', 'package.json') + '/lib/marked.js',
'js/angular-bootstrap/bootstrap.min.js',
'components/marked-' + getVersion('marked') + '/lib/marked.js',
'js/angular-bootstrap/dropdown-toggle.min.js',
'components/lunr.js-' + getVersion('lunr.js') + '/lunr.min.js',
'components/lunr-' + getVersion('lunr') + '/lunr.min.js',
'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/prettify.js',
'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/lang-css.js',
'js/versions-data.js',
'js/current-version-data.js',
'https://code.angularjs.org/snapshot/docs/js/all-versions-data.js',
'js/pages-data.js',
'js/nav-data.js',
'js/docs.min.js'
@@ -35,8 +49,9 @@ module.exports = function productionDeployment(getVersion) {
'components/bootstrap-' + getVersion('bootstrap') + '/css/bootstrap.min.css',
'components/open-sans-fontface-' + getVersion('open-sans-fontface') + '/open-sans.css',
'css/prettify-theme.css',
'css/angular-topnav.css',
'css/docs.css',
'css/animations.css'
]
};
};
};
+2 -2
View File
@@ -1,4 +1,4 @@
"use strict";
'use strict';
var StringMap = require('stringmap');
/**
@@ -7,4 +7,4 @@ var StringMap = require('stringmap');
*/
module.exports = function errorNamespaceMap() {
return new StringMap();
};
};
+1 -1
View File
@@ -1,4 +1,4 @@
"use strict";
'use strict';
var path = require('canonical-path');
+5 -5
View File
@@ -1,17 +1,17 @@
"use strict";
'use strict';
var path = require('canonical-path');
/**
* dgService getVersion
* @description
* Find the current version of the bower component (or npm module)
* Find the current version of the bower component (or node module)
*/
module.exports = function getVersion(readFilesProcessor) {
var basePath = readFilesProcessor.basePath;
return function(component, sourceFolder, packageFile) {
sourceFolder = path.resolve(basePath, sourceFolder || 'docs/bower_components');
packageFile = packageFile || 'bower.json';
sourceFolder = path.resolve(basePath, sourceFolder || 'node_modules');
packageFile = packageFile || 'package.json';
return require(path.join(sourceFolder,component,packageFile)).version;
};
};
};
+42
View File
@@ -0,0 +1,42 @@
'use strict';
var OPTION_MATCHER = /^\s*([\w-]+)="([^"]+)"\s+([\s\S]*)/;
var VALID_OPTIONS = ['sinceVersion', 'removeVersion'];
module.exports = {
name: 'deprecated',
transforms: function(doc, tag, value) {
var result = {};
var invalidOptions = [];
value = value.trim();
while (OPTION_MATCHER.test(value)) {
value = value.replace(OPTION_MATCHER, function(_, key, value, rest) {
if (VALID_OPTIONS.indexOf(key) !== -1) {
result[key] = value;
} else {
invalidOptions.push(key);
}
return rest;
});
}
if (invalidOptions.length > 0) {
throw new Error('Invalid options: ' + humanList(invalidOptions) + '. Value options are: ' + humanList(VALID_OPTIONS));
}
result.description = value;
return result;
}
};
function humanList(values, sep, lastSep) {
if (sep === undefined) sep = ', ';
if (lastSep === undefined) lastSep = ' and ';
return values.reduce(function(output, value, index, list) {
output += '"' + value + '"';
switch (list.length - index) {
case 1: return output;
case 2: return output + lastSep;
default: return output + sep;
}
}, '');
}
+33
View File
@@ -0,0 +1,33 @@
'use strict';
/* globals describe, it, expect */
var tagDef = require('./deprecated');
describe('deprecated tag', function() {
describe('transforms', function() {
it('should return the trimmed value if no options', function() {
var tag = tagDef.transforms({}, {}, 'This is the description');
expect(tag.description).toEqual('This is the description');
});
it('should read options', function() {
var tag = tagDef.transforms({}, {}, ' sinceVersion="v1.3.4" removeVersion="v1.4.5" what is left is description');
expect(tag.description).toEqual('what is left is description');
expect(tag.sinceVersion).toEqual('v1.3.4');
expect(tag.removeVersion).toEqual('v1.4.5');
});
it('should cope with carriage returns', function() {
var tag = tagDef.transforms({}, {}, '\nsinceVersion="v1.3.4"\nremoveVersion="v1.4.5"\nwhat is left is description');
expect(tag.description).toEqual('what is left is description');
expect(tag.sinceVersion).toEqual('v1.3.4');
expect(tag.removeVersion).toEqual('v1.4.5');
});
it('should error if there is an invalid option', function() {
expect(function() {
tagDef.transforms({}, {}, ' fromVersion="v1.3.4" toVersion="v1.4.5" what is left is description');
}).toThrowError('Invalid options: "fromVersion" and "toVersion". Value options are: "sinceVersion" and "removeVersion"');
});
});
});
+5
View File
@@ -0,0 +1,5 @@
'use strict';
module.exports = {
name: 'installation'
};

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