224 Commits

Author SHA1 Message Date
Victor Berchet
f3b49378e4 feat(Directive): Have a single Directive.host which mimics HTML
fixes #2268

BREAKING CHANGE:

Before

    @Directive({
      hostListeners: {'event': 'statement'},
      hostProperties: {'expression': 'hostProp'},
      hostAttributes: {'attr': 'value'},
      hostActions: {'action': 'statement'}
    })

After

    @Directive({
      host: {
        '(event)': 'statement',
        '[hostProp]': 'expression'  // k & v swapped
        'attr': 'value',
        '@action': 'statement'
      }
    })
2015-06-11 13:11:09 -07:00
Victor Berchet
6ca81fb98c refactor(ProtoViewDto): switch to enum 2015-06-11 17:11:34 +02:00
vsavkin
af35ab56a3 fix(life_cycle): throw when recursively reentering LifeCycle.tick 2015-06-11 07:43:14 -07:00
vsavkin
15dab7c5b2 fix(ng_zone): updated zone not to run onTurnDown when invoking run synchronously from onTurnDone 2015-06-11 07:43:13 -07:00
Victor Berchet
4d338a4f5c test(ElementInjector): test that hostInjector has priority over viewInjector 2015-06-08 20:34:44 +02:00
Victor Berchet
6a6b43de07 feat(ElementInjector): throw if multiple directives define the same host injectable
relates to #2015
2015-06-08 20:34:44 +02:00
Victor Berchet
29c72abcc4 feat(Events): allow a different event vs field name
closes #2272
closes #2344
2015-06-08 19:29:49 +02:00
vsavkin
69b75b7fd8 feat(view): added support for exportAs, so any directive can be assigned to a variable 2015-06-04 14:14:03 -07:00
Rado Kirov
552985e305 fix(types): parametrize QueryList. 2015-06-03 17:08:55 -07:00
Martin Probst
f999d5a156 chore: move to clang-format 1.0.17.
clang-format 1.0.17 substantially improves formatting for fat arrow functions
and array literal detection. It also fixes a number of minor formatting issues.
2015-06-03 15:27:27 -07:00
Tobias Bosch
5030ffb01c feat(view): introduce free embedded views
Free embedded views are view instances that are created
logically in the same was as views of a ViewContainer,
but their dom nodes are not attached.

BREAKING CHANGE:

- `Renderer.detachFreeHostView` was renamed to
  `Renderer.detachFreeView`
- `DomRenderer.getHostElement()` was generalized into
  `DomRenderer.getRootNodes()`
2015-06-03 14:42:00 -07:00
vsavkin
d523613329 test(di): added a test verifying hierarchical injection 2015-05-29 15:52:46 -07:00
Tobias Bosch
f9908cd436 feat(test): add element probe
Usage: bootstrap the app with the special binding
`ELEMENT_PROBE_CONFIG` from `angular2/debug`.
This will provide a global method `ngProbe(element)` that
will expose a `DebugElement` with directive instances, ... on it.

During tests that use Angular's test injector, the probe is
enabled by default. The `DebugElement ` can be retrieved via the
function `inspectDomElement` of `angular2/debug`. Note
that the `TestComponentBuilder` already returns `DebugElement `s.

Closes #1992
2015-05-29 12:44:21 -07:00
Tobias Bosch
75578f41e7 feat(view): add AppViewListener interface
Basic functionality how element probe is hooked into
the system.
2015-05-29 11:33:22 -07:00
Tim Blasi
ffb219fb91 style(dart): Format Dart source with dart_style 0.1.8 2015-05-29 10:42:47 -07:00
Victor Berchet
d7df853bde feat(Directive): convert properties to an array
fixes #2013

BREAKING CHANGE:

Before

    @Directive(properties: {
      'sameName': 'sameName',
      'directiveProp': 'elProp | pipe'
    })

After

    @Directive(properties: [
      'sameName',
      'directiveProp: elProp | pipe'
    ])
2015-05-29 11:44:43 +02:00
vsavkin
c39c8ebcd0 feat(change_detection): added onInit and onCheck hooks 2015-05-28 16:46:22 -07:00
vsavkin
34cfc9f474 feat(di): added optional self parameter to Parent, Ancestor, and Unbounded 2015-05-28 09:53:06 -07:00
vsavkin
30b6542fc8 feat(core): added support for detecting lifecycle events based on interfaces 2015-05-27 16:23:42 -07:00
Marc Laval
c6335c128e feat(test_lib): add method to compare stringified DOM element
Closes #2106
2015-05-27 16:19:39 +02:00
Tobias Bosch
79f564be46 refactor(core): ts’ify tests 2015-05-26 17:01:31 -07:00
yjbanov
d48fae3566 fix(core): resurrect OnChange interface 2015-05-22 16:48:00 -07:00
Martin Probst
15f1eb28a2 fix(deps): Update clang-format to 1.0.14. 2015-05-22 09:39:15 -07:00
Victor Berchet
b1c9bf14b2 feat(ElementInjector): support an arbitrary number of bindings
fixes #1853
2015-05-22 13:42:53 +02:00
Marc Laval
661a04798e fix(test): adds longer timers for NgZone and PromisePipe tests (IE11)
Closes #2055
2015-05-22 13:30:49 +02:00
Tobias Bosch
cc2c8f6b00 refactor(test): ts’if compiler integration tests. 2015-05-21 17:53:53 -07:00
yjbanov
c5996529c3 chore(expressions): add explicit test for map vs property access 2015-05-21 14:41:26 -07:00
vsavkin
705ee46f31 fix(di): changed host and view injector to respect visibility 2015-05-21 09:17:56 -07:00
vsavkin
b6b52e62b2 fix(element_injector): fixed element injector to inject view dependencies into its components 2015-05-20 17:48:04 -07:00
vsavkin
28c2b8f432 fix(element_injector): fixed element injector to resolve dependencies of regular services 2015-05-20 10:56:33 -07:00
Victor Berchet
6ec5d5daaf refactor(async): extract timer related functions into a TimerWrapper 2015-05-20 07:47:46 +02:00
vsavkin
62b1a08f06 refactor(reflection): improved error message 2015-05-19 21:17:52 -07:00
Yegor Jbanov
8ab773538b fix(errors): require passing stack traces explicitly in ng2 own code 2015-05-19 12:48:00 -07:00
vsavkin
b066b8d15a feat(di): added hostInjector and viewInjector to the Directive annotation 2015-05-18 18:30:53 -07:00
vsavkin
7b511462af refactor(core): renamed injectables into appInjector
BREAKING CHANGES

Before:

@Component({injectables: [Type]} class MyCmp{}

After:

@Component({appInjector: [Type]} class MyCmp{}
2015-05-18 18:30:52 -07:00
vsavkin
3a53f67911 feat(di): removed publishAs
BREAKING CHANGES

Removes the publishAs property from the Component annotation.
2015-05-18 18:30:52 -07:00
Jeremy Elbourn
bb2eda2d15 feat(element_injector): allow @Optional for ProtoViewRef 2015-05-18 12:48:33 -07:00
Tim Blasi
3644036693 refactor(proto_view_factory): Move getChangeDetectorDefinitions out of ProtoViewFactory
Move `getChangeDetectorDefinitions` out of `ProtoViewFactory` since it
does not depend on any state in that object.
2015-05-18 08:45:59 -07:00
Misko Hevery
1eea2b254e feat: allow for forward references in injection
It is possible for a class defined first to be referencing a class defined later,
and as a result at the time of the definition it is not possible to access the later's
class reference. This allows to refer to the later defined class through
a closure.Closes #1891
2015-05-15 21:12:57 -07:00
Yegor Jbanov
b6f29b4448 feat(errors): preserve stack traces of user exceptions in Dart 2015-05-15 15:03:31 -07:00
Tobias Bosch
421d8916a6 refactor(view_manager): split inPlace views into root and free host views.
BREAKING CHANGE:
`AppViewManager.createInPlaceHostView` is replaced by
`AppViewManager.createRootHostView` (for bootstrap) and
`AppViewManager.createFreeHostView` (for imperative components).

The later creates new host elements that are not attached anywhere.
To attach them, use `DomRenderer.getHostElement(hostviewRef)`
to get the host element.

Closes #1920
2015-05-15 13:24:53 -07:00
Victor Berchet
25cd6e4321 fix(Compiler): add an error when a directive is null or undefined
fixes #1908
2015-05-15 19:26:06 +02:00
Tobias Bosch
ecb068019b refactor(proto_view_factory): expose data for generating change detectors
Also consolidates metadata handling in `ElementInjector`

BREAKING CHANGE:
- renames `DirectiveMetadataReader` into `DirectiveResolver`
  and removes `src/core/compiler/directive_metadata`.

Fixes #1712
Fixes #1713
2015-05-13 17:11:59 -07:00
vsavkin
685a6507b6 feat(compiler): added support for [()] syntax 2015-05-13 16:08:59 -07:00
Victor Berchet
c20060d259 fix(directives): fix import path 2015-05-13 11:56:50 +02:00
Misko Hevery
111fa60a93 chore: rename for to ng-for
Closes #1598
Closes #1295
Closes #1827

Closes #1827
2015-05-12 15:32:44 -07:00
Misko Hevery
d310a9c0b4 chore: rename if to ng-if 2015-05-12 15:32:44 -07:00
Victor Berchet
e11c20541a refactor(VmTurnZone): renamed to NgZone
BREAKING CHANGE:

VmTurnZone has been renamed to NgZone.

- The public API has not chnanged,
- The "outer" zone is now named "mount" zone (private to NgZone).
2015-05-12 21:03:24 +02:00
Victor Berchet
c75e216871 refactor(VmTurnZone): outer zone = root zone 2015-05-12 21:03:24 +02:00
Victor Berchet
e8a6c95e2a feat(VmTurnZone): Rework the implementation to minimize change detection runs
Before this PR there were only 2 zones: root zone = outer zone > inner
zone.
This PR creates the outer zone as a fork of the root zone: root > outer
> inner.

By doing this it is possible to detected microtasks scheduling in the
outer zone and run the change detection less often (no more than one
time per VM turn).

The PR also introduce a Promise monkey patch for the JS implementation.
It makes Promises aware of microtasks and again allow running the change
detection only once per turn.
2015-05-12 21:03:24 +02:00