Commit graph

42 commits

Author SHA1 Message Date
Matt Ginzton
186a591228 fix($injector): remove INSTANTIATING entry when done
getService flags services as INSTANTIATING while it calls their
provider factory, in order to detect circular dependencies. If
the service is instantiated correctly, the INSTANTIATING flag is
overwritten with the actual service. However, if the service is
not instantiated correctly, the INSTANTIATING flag should still
be removed, or all further requests for this service will be
mis-detected as a circular dependency.

Closes #4361
Closes #5577
2013-12-31 01:17:43 -08:00
mkolodny
14d3e559d4 docs($injector): use correct spacing convention for CoffeeScript functions
This convention is exhibited by http://coffeescript.org/ and https://github.com/polarmobile/coffeescript-style-guide#functions.

Closes #5354
2013-12-19 13:05:15 +00:00
Igor Minar
a0ed371389 style($injector): remove ws 2013-12-12 23:51:45 -08:00
Ben Wiklund
05e4fd3488 perf($injector): remove invoke optimization that doesn't work
Closes #5388
2013-12-12 23:49:03 -08:00
Joscha Feth
b4d44e1298 docs($injector): add example on how to use the element.injector
Closes #5188
2013-12-09 16:32:09 +00:00
Pete Bacon Darwin
1014e52349 docs($injector): use square bracket notation for $inject annotation
Closes #5104
2013-11-27 22:52:10 +00:00
jbnizet
c0e10683a6 docs(api): example for $provide.value() uses $provide.value()
The example code for `$provide.value()` actually used `$provide.constant()`.
It now uses `$provide.value()`.

Closes #4983
Closes #4990
2013-11-20 11:21:09 +00:00
Pete Bacon Darwin
cf54510b2c docs($provide): fix link to factory section 2013-10-28 21:27:28 +00:00
Pete Bacon Darwin
e690eaae53 docs($provide): Fix typo
Closes #4420
2013-10-24 20:54:26 +01:00
Vojta Jina
f2fab49830 style: make jshint happy 2013-10-22 15:32:41 -07:00
Vojta Jina
14438058da docs: correct broken links
This also contains some whitespace corrections by my editor.
2013-10-18 15:35:41 -07:00
Vojta Jina
c22adbf160 fix($injector): allow a constructor function to return a function
This change makes `$injector.instantiate` (and thus `$provide.service`) to behave the same as native
`new` operator.
2013-10-18 15:26:51 -07:00
Pete Bacon Darwin
74ef7f14a4 docs($provide): improve docs and examples further
Improve the "tracking" service example by adding a configuration option.
Get better formatting of the generated code samples using <pre> tags.
Move the detailed explanations into each function's documentation block.
Improve the overview and list the constituent functions by significance.

Closes #4302
2013-10-10 16:46:59 +01:00
Tim Ruffles
3eb2fbf745 docs($provide): improve examples and explanations
$provide's example seems awkward. Replace with more real-world example,
using an injected service, where the service defined has a good reason to
be a singleton.

There's quite a lot of confusion around $provide:
http://stackoverflow.com/search?q=angularjs+service+vs+factory
Tests for example at: http://jsbin.com/EMabAv/1/edit?js,output
2013-10-10 16:43:12 +01:00
Peter Bacon Darwin
7a586e5c19 fix(*): protect calls to hasOwnProperty in public API
Objects received from outside AngularJS may have had their `hasOwnProperty`
method overridden with something else. In cases where we can do this without
incurring a performance penalty we call directly on Object.prototype.hasOwnProperty
to ensure that we use the correct method.

Also, we have some internal hash objects, where the keys for the map are provided
from outside AngularJS. In such cases we either prevent `hasOwnProperty` from
being used as a key or provide some other way of preventing our objects from
having their `hasOwnProperty` overridden.

BREAKING CHANGE: Inputs with name equal to "hasOwnProperty" are not allowed inside
form or ngForm directives.

Before, inputs whose name was "hasOwnProperty" were quietly ignored and not added
to the scope.  Now a badname exception is thrown.

Using "hasOwnProperty" for an input name would be very unusual and bad practice.
Either do not include such an input in a `form` or `ngForm` directive or change
the name of the input.

Closes #3331
2013-10-07 09:01:13 -07:00
Caitlin Potter
ba38de2212 docs($injector): Reword fn param docs and link to DI information 2013-09-30 17:26:00 -07:00
Igor Minar
44b6b72e5e fix($injector): don't parse fns with no args
When annotating a fn, it is wasteful to try to parse a fn that has no arguments
as such fn has no injectable dependencies
2013-08-16 11:01:51 -07:00
Carl Danley
258e986284 docs(*): fixed typos and ngdoc parameter names 2013-07-27 20:53:41 +02:00
Igor Minar
4f0f243771 fix($injector): refactor module loading code and use minErr 2013-07-02 11:05:30 -07:00
Ken Sheedlo
003861d2fd chore(minErr): replace ngError with minErr 2013-06-17 13:29:30 -07:00
Igor Minar
b8ea7f6aba feat(ngError): add error message compression and better error messages
- add toThrowNg matcher
2013-05-24 17:03:21 -07:00
Misko Hevery
c575a56fc5 docs(injector): add docs for $injector.has 2013-05-06 21:52:53 -07:00
Misko Hevery
80341cb9ba feat(injector): add has method for querying
Closes #2556
2013-05-02 15:22:16 -04:00
Siddique Hameed
89c0b5d096 docs(injector): fix typo
Closes: #2551
2013-05-01 13:14:54 +01:00
Robin Böhm
d6984db4d5 style($injector): add a comment to explain the distinction with isArray 2013-04-30 10:39:33 +01:00
Eugene Wolfson
ef7ba7b212 docs($provide): fix parentheses in example 2013-04-30 10:16:24 +01:00
@fbiville
9f2aaca65b docs(injector): fix typo in inlining example
The actual invoke call in the documentation was referring to the non-existent tempFn instead of tmpFn
2013-04-17 14:46:13 +01:00
Brent Morrow
16bfb7eea0 docs($inject): wording change 2013-04-11 13:48:04 -07:00
Arlen Christian Mart Cuss
d1b49e25f1 docs($injector): correct misuse of $inject
$inject was used where $injector was appropriate; confusing and
misleading.
2013-03-12 13:00:03 -07:00
Jason Morrison
a248d5a32d docs($injector): remove extranneous 'the' from injector docs 2013-03-08 23:44:44 +01:00
Vineet Kumar
d2177ae312 docs($injector): clarify $inject property description
Section heading about `$inject` property refers to it as `$injector` property.
2013-01-24 00:15:32 -05:00
Igor Minar
b6b7c5a1d6 fix($injector): remove bogus fn arg
getService fn takes only one argument, removing the second one.

Closes #1711
2013-01-08 14:36:03 -08:00
Sudhir Jonathan
2c405f4171 fix($injector): provider can now be defined in the array format
`injector.instantiate` is now called for arrays too, instead of only for functions.

Closes #1452
2012-12-01 18:41:59 +01:00
sqwishy trick
271d2bed3a chore(injector): fix typo in injector documentation 2012-10-31 14:19:05 -07:00
Misko Hevery
d9eff86ef7 fix($injector): more conservative annotation parsing 2012-09-06 16:06:24 -07:00
JP Sugarbroad
e3e8813e3c refactor($injector): move $injector into the providerCache
Better than special-casing '$injector' in createInjector.
2012-07-19 21:56:22 -07:00
Igor Minar
f16150d5f1 docs(*): simplify doc urls
we now have two types of namespaces:

- true namespace: angular.* - used for all global apis
- virtual namespace: ng.*, ngMock.*, ... - used for all DI modules

the virual namespaces have services under the second namespace level (e.g. ng.)
and filters and directives prefixed with filter: and directive: respectively
(e.g. ng.filter:orderBy, ng.directive:ngRepeat)

this simplifies urls and makes them a lot shorter while still avoiding name collisions
2012-06-12 00:10:18 -07:00
Misko Hevery
2e90cdc3d4 docs(dependency injecton): rewrite 2012-06-02 16:02:05 -07:00
Misko Hevery
4361efb03b feat($injector): provide API for retrieving function annotations 2012-06-01 10:57:51 -07:00
Misko Hevery
bbaf9a2870 fix(docs): accept return in addition to returns
documentation used @return but parser expected
@returns, which made the generated documentation
incomplete.
2012-05-24 13:48:42 -07:00
Igor Minar
2cb907a836 fix($injector): properly infer dependencies from fn with no args
Previously if there was a white-space in fn: fn( ) {} we failed to infer no args.

This was originally reported by recht, but I decided to use a different fix.

Closes #829
2012-03-29 11:21:04 -07:00
Misko Hevery
2430f52bb9 chore(module): move files around in preparation for more modules 2012-03-28 11:16:35 -07:00