Commit Graph

442 Commits

Author SHA1 Message Date
gdi2290 35a83b495a feat(query_list): delegate `toString` to `_results` array
Closes #3004
2015-08-14 03:42:11 +00:00
Misko Hevery b7837389d7 refactor: Remove isDart from public API
BREAKING CHANGE:

- `IS_DARTIUM` no longer exported
2015-08-13 21:18:31 +00:00
Misko Hevery 60af19f0e1 refactor: rename all const to UPPER_CASE
Closes #3573

BREAKING CHANGE

Rename:
- `appComponentTypeToken` => `APP_COMPONENT`
- `coreDirectives` => `CORE_DIRECTIVES`
- `formDirectives` => `FORM_DIRECTIVES`
- `formInjectables` => `FORM_BINDINGS`
- `httpInjectables` => `HTTP_BINDINGS`
- `jsonpInjectables` => `JSONP_BINDINGS`
- `PROTO_CHANGE_DETECTOR_KEY` => `PROTO_CHANGE_DETECTOR`
- `appComponentRefPromiseToken` => `APP_COMPONENT_REF_PROMISE`
- `appComponentTypeToken` => `APP_COMPONENT`
- `undefinedValue` => `UNDEFINED`
- `formDirectives` => `FORM_DIRECTIVES`
- `DOCUMENT_TOKEN` => `DOCUMENT`
- `APP_ID_TOKEN` => `APP_ID`
- `MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN` => `MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE`
- `appBaseHrefToken` => `APP_BASE_HREF`
2015-08-13 21:18:31 +00:00
Pawel Kozlowski a7a1851c0f feat(compiler): allow binding to className using class alias
Closes #2364
2015-08-12 20:08:03 +00:00
Rado Kirov 2150a8f9d1 feat(query): view query is properly updated when dom changes.
Fixes a bug in view manager util where sibling injector is not correctly
calculated.

ViewQuery no longer includes the view's initiating component injector.

Includes some refactoring of view methods and a removal of a polymorphic
map call.

Closes #3033

Closes #3439
2015-08-12 06:16:09 +00:00
Tobias Bosch 585ea5d600 feat(query): allow to query for `TemplateRef`
Part of #1989

Closes #3202
2015-08-12 01:51:18 +00:00
vsavkin 5b5d31fa9a feat(pipe): added the Pipe decorator and the pipe property to View
BREAKING CHANGE:
    Instead of configuring pipes via a Pipes object, now you can configure them by providing the pipes property to the View decorator.

    @Pipe({
      name: 'double'
    })
    class DoublePipe {
      transform(value, args) { return value * 2; }
    }

    @View({
      template: '{{ 10 | double}}'
      pipes: [DoublePipe]
    })
    class CustomComponent {}

Closes #3572
2015-08-12 00:38:40 +00:00
vsavkin 2dcf714d2b refactor(pipes): use Injector instead of pipe factories for pipe instantiation
BREAKING CHANGE
    - Pipe factories have been removed.
    - PIpe names to pipe implementations are 1-to-1  instead of 1-to-*

 Before:
     class DateFormatter {
         transform(date, args){}
     }

     class DateFormatterFactory {
       supporst(obj) { return true; }
       create(cdRef) { return new DateFormatter(); }
     }
     new Pipes({date: [new DateFormatterFactory()]})

After
    class DateFormatter {
      transform(date, args){}
    }
    new Pipes({date: DateFormatter})
2015-08-07 10:02:11 -07:00
Pawel Kozlowski 748c2d6c97 fix(compiler): strip <script> tag from templates
Fixes #2766
Closes #3486
2015-08-07 11:54:33 +00:00
vsavkin 07b9be798c fix(exception_handler): log errors that are thrown by the compiler 2015-08-06 15:26:24 -07:00
Alex Eagle b4a062983b fix(dart): @proxy is a value, not a factory
Previously I added parens everywhere to make this @proxy() because our typing indicated
it was a function that returned a decorator, but this breaks dart. Instead, the typing needs
to be changed.

Fixes #3494
2015-08-06 10:02:49 -07:00
Tim Blasi f11f4e0b45 style(dart): Format with dartfmt v0.2.0
Format all pure Dart code with package:dart_style v0.2.0

Command:
```
find -type f -name "*.dart" | xargs dartformat -w
```
2015-08-05 11:04:29 -07:00
Marc Laval 166688348a chore(browsers): fix failing tests in IE11
Closes #3388
2015-08-04 22:45:46 +02:00
vsavkin 392de4af67 feat(pipes): replaces iterable and key value diffing pipes with services
BREAKING CHANGE:
    Directives that previously injected Pipes to get iterableDiff or keyvalueDiff, now should inject IterableDiffers and KeyValueDiffers.
2015-08-04 10:39:55 -07:00
Marc Laval 8822460858 chore(browsers): fix failing tests in Firefox
Closes #3386
2015-08-03 12:17:44 +02:00
Misko Hevery 39b0286d6b fix: remove unused imports 2015-07-31 20:40:33 +00:00
vsavkin 3437d56904 feat(core): made directives shadow native element properties
BREAKING CHANGE
    Previously, if an element had a property, Angular would update that property even if there was a directive placed on the same element with the same property. Now, the directive would have to explicitly update the native elmement by either using hostProperties or the renderer.
2015-07-31 20:29:57 +00:00
Alex Eagle 3c58878b19 chore(build): Upgrade to TypeScript@1.5.3
This change also makes us compliant with 1.6.0-dev compiler,
so we can do some experiments with apps that use 1.6 features
and compile against Angular.

We should probably add a travis build for 1.6 so we stay compatible
with both versions.
2015-07-31 20:01:27 +00:00
Tobias Bosch dd06a871b7 fix(render): allow to configure when templates are serialized to strings
Introduces the injectable `TemplateCloner` that can be configured via the new token `MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN`.

Also replaces `document.adoptNode` with `document.importNode` as otherwise
custom elements are not triggered in chrome 43.

Closes #3418
Closes #3433
2015-07-31 12:04:32 -07:00
vsavkin 3cda7128d0 cleanup(di): renamed viewInjector and hostInjector
BREAKING CHANGE
    Replace viewInjector with viewBindings
    Replace hostInjector with bindings
2015-07-31 09:49:51 -07:00
Pawel Kozlowski 0a40024995 test(integration): minor tests cleanup
Closes #3329
2015-07-31 10:52:42 +02:00
vsavkin 985627bd65 cleanup(DI): clean up visibility decorators
BREAKING CHANGE:
    Replace @Ancestor() with @Host() @SkipSelf()
    Replace @Unbounded() wwith @SkipSelf()
    Replace @Ancestor({self:true}) with @Host()
    Replace @Unbounded({self:true}) with nothing
    Replace new AncestorMetadata() with [new HostMetadata(), new SkipSelfMetadata()]
    Replace new UnboundedMetadata() with new SkipSelfMetadata()
    Replace new Ancestor({self:true}) with new HostMetadata()
2015-07-31 02:30:26 +00:00
Jeff Cross 4e76cac5b7 fix(core): export LifeCycle at top-level modules
LifeCycle can now be imported via angular2/angular2 or
angular2/core, so that end users can inject it without
having to use the full source path.

Closes #3395
2015-07-30 21:52:29 +00:00
Tobias Bosch 0dbdd5cd3c refactor(render): don’t store DOM nodes but store strings for big ProtoViews.
Also inserts comment nodes before/after projected nodes so that text nodes don’t get merged when we serialize/deserialize them.

Closes #3356
First part of #3364
2015-07-30 14:11:13 -07:00
Rado Kirov 34acef58e7 fix(query): view query should not be updated when subviews are attached. 2015-07-29 22:33:15 +00:00
Jeremy Elbourn f7d7789915 fix(decorators): stop directives inheriting parent class decorators.
Fixes #2291
2015-07-29 21:23:31 +00:00
Tobias Bosch 16e3d7e96e refactor(shadow_dom): remove `ShadowDomStrategy` in favor of `@View(encapsulation)`
BREAKING CHANGES:
- `ShadowDomStrategy` was removed. To specify the encapsulation of a component use `@View(encapsulation: ViewEncapsulation.NONE | ViewEncapsulation.EMULATED | ViewEncapsulation.NATIVE)`
- The default encapsulation strategy is now `ViewEncapsulation.EMULATED` if a component contains styles and `ViewEncapsulation.NONE` if it does not. Before this was always `NONE`.
- `ViewLoader` now returns the template as a string and the styles as a separate array
2015-07-28 22:33:11 -07:00
vsavkin 8543c347a8 feat(core): provide an error context when an exception happens in an error handler 2015-07-28 14:22:15 -07:00
Rado Kirov 1d4502944c fix(query): the view should not be visible to @Query.
@ViewQuery is the correct way to query the view template.
2015-07-28 14:16:14 -07:00
Tim Blasi 2c9951273a style(dart): Run dartfmt v0.1.8+2 on all pure Dart code
Update formatting for all pure Dart code in the repo.
2015-07-28 12:44:03 -07:00
Misko Hevery a2bb81c406 Revert "fix(url_resolver): in Dart make package urls relative to AppRootUrl"
This reverts commit 469afda53e.
2015-07-27 14:15:02 -07:00
Jason Teplitz 7cbaf1076f refactor(Async): Unify TS and Dart PromiseCompleter naming
Also add explicit typing wherever we use PromiseCompleter
2015-07-27 10:28:07 -07:00
Misko Hevery 329a6e00dc chore(API): cleaned up top level imports (render) 2015-07-25 03:20:15 +00:00
Misko Hevery c83a3f3372 chore(docs): added more docs for core.ts 2015-07-25 03:20:12 +00:00
yjbanov 469afda53e fix(url_resolver): in Dart make package urls relative to AppRootUrl 2015-07-24 16:37:01 -07:00
vsavkin c2bbda02a1 feat(change_detection): provide error context for change detection errors 2015-07-24 15:45:26 -07:00
vsavkin e744409cb9 feat(exception_handler): print originalException and originalStack for all exceptions 2015-07-24 15:45:26 -07:00
Rado Kirov 2577f5eebf test(query): adds a test for query in the presense of projection.
Query uses only the logical structure of the application, so it is not
affected by projection, which only the rendering structure.

Closes #3278
2015-07-24 15:30:57 -07:00
Hank Duan a8b75c3d41 feat(testability): hook zone into whenstable api with async support
closes(#428)
2015-07-24 12:46:12 -07:00
Pawel Kozlowski 345fa521dd fix(change_detection): convert interpolated null values to empty strings
Fixes #3007

Closes #3271
2015-07-24 18:05:06 +02:00
Pawel Kozlowski 16493e9769 refactor(integration_test): remove unused imports 2015-07-24 18:05:06 +02:00
Jason Teplitz 771c0170d9 feat(web-workers) Add WebWorker Renderer
Allows angular apps to be rendered from the webworker!
Closes #3052, #3053, and #3097
2015-07-23 18:29:10 -07:00
Tobias Bosch 46502e4d61 fix(projection): allow more bound render elements than app elements.
Fixes #3236
Closes #3247
2015-07-23 15:05:46 -07:00
Tobias Bosch b44b06c2c9 fix(projection): allow to project to a non text node
We already had a test for this, but too low level that it did not catch this null value in `hasNativeShadowRoot`

Fixes #3230
Closes #3241
2015-07-23 14:29:15 -07:00
Tobias Bosch 5ec67ee2a7 fix(compiler): prevent race conditions
Previously, the compiler would detect cycles where there were none just because of other components that were compiled in parallel. Furthermore, the way ProtoView merging was triggered could result into early exits resulting in errors when trying to instantiate ProtoViews.

Fixes #3206
Closes #3211
2015-07-23 14:28:38 -07:00
vsavkin 70792c744d refactor(exception_handler): unified all exception handling
BREAKING CHANGE
    Previously it was possible to pass a custom error reporter to bootstrap, which was used only during the construction of Injector. This had limited utility, so this capability has been removed.
2015-07-23 11:22:04 -07:00
vsavkin fdf226ab69 feat(exception_handler): change ExceptionHandler to output context 2015-07-23 11:22:04 -07:00
vsavkin 5a86f85936 feat(di): added context to runtime DI errors 2015-07-22 14:22:46 -07:00
vsavkin 6f4a39c337 refactor(di): removed @Parent
BREAKING CHANGE
    The @Parent annotation has been removed. Use @Ancestor instead.
    @Parent was used to enforce a particular DOM structure (e.g., a pane component is a direct child of the tabs component).
    DI is not the right mechanism to do it. We should enforce it using schema instead.
2015-07-21 14:39:28 -07:00
Tobias Bosch 078475a082 refactor(compiler): speed up proto view merging
- Don't create intermediate merge results
- Only merge embedded ProtoViews that contain `<ng-content>` tags

Closes #3150
Closes #3177
2015-07-21 13:39:41 -07:00
Alex Eagle de18da2a0d feat(build): require parameter types
Fixes #2833
2015-07-21 06:20:13 -07:00
vsavkin 57496926ca fix(di): fixed dynamic component loading of components created in child injector 2015-07-17 16:18:19 -07:00
vsavkin 13b1d85058 refactor(forms): removed iterableToList 2015-07-17 10:52:23 -07:00
Tobias Bosch f42382db3b refactor(views): split `ViewManager/ViewContainerRef.createView` into 2 methods
BREAKING CHANGES:

`ViewManager.createView` / `ViewContainerRef.create` have been split into 2 methods:

- `createHostView` which takes dynamically created bindings
- `createEmbeddedView` which takes the newly introduced `TemplateRef`

The new type `TemplateRef` is the combination of a `ProtoViewRef` and and `ElementRef`
from the same place. Use `TemplateRef` when working with embedded views in
`ng-if`, `ng-for`, ... instead of `ProtoViewRef`.

Also, `ProtoViewRef` is no more injectable, but `TemplateRef` is.

First part of #1989 to clean up manual content projection.
Closes #3114
2015-07-17 10:40:32 -07:00
Tobias Bosch 116b64de25 fix(view_manager): allow to create host views even if there is an embedded view at the same place. 2015-07-16 16:18:43 -07:00
Pawel Kozlowski b785503543 refactor(ProtoViewBuilder): improve error message for dangling bindings
Closes #3066
2015-07-16 16:16:49 -07:00
Tobias Bosch b1df54501a feat(compiler): attach components and project light dom during compilation.
Closes #2529

BREAKING CHANGES:
- shadow dom emulation no longer
  supports the `<content>` tag. Use the new `<ng-content>` instead
  (works with all shadow dom strategies).
- removed `DomRenderer.setViewRootNodes` and `AppViewManager.getComponentView`
  -> use `DomRenderer.getNativeElementSync(elementRef)` and change shadow dom directly
- the `Renderer` interface has changed:
  * `createView` now also has to support sub views
  * the notion of a container has been removed. Instead, the renderer has
    to implement methods to attach views next to elements or other views.
  * a RenderView now contains multiple RenderFragments. Fragments
    are used to move DOM nodes around.

Internal changes / design changes:
- Introduce notion of view fragments on render side
- DomProtoViews and DomViews on render side are merged,
  AppProtoViews are not merged, AppViews are partially merged
  (they share arrays with the other merged AppViews but we keep
  individual AppView instances for now).
- DomProtoViews always have a `<template>` element as root
  * needed for storing subviews
  * we have less chunks of DOM to clone now
- remove fake ElementBinder / Bound element for root text bindings
  and model them explicitly. This removes a lot of special cases we had!
- AppView shares data with nested component views
- some methods in AppViewManager (create, hydrate, dehydrate) are iterative now
  * now possible as we have all child AppViews / ElementRefs already in an array!
2015-07-15 20:23:27 -07:00
vsavkin d449ea5ca4 feat(change_detection): added support for ObservableList from package:observe 2015-07-15 17:06:42 -07:00
vsavkin 7879761a41 fix(element_injector): inject the containing change detector ref to directives 2015-07-15 17:06:42 -07:00
vsavkin 7531b48d02 fix(di): instatiate services lazily 2015-07-14 17:10:30 -07:00
Misko Hevery b73ba68215 refactor(LifecycleEvent): change from onInit to Lifecycle.onInit
BREAKING CHANGE

Closes #2928
2015-07-14 16:51:44 -07:00
vsavkin 04baa46efe fix(di): removed default visibility
BREAKING CHANGE:
    Directives will use the Unbounded visibility by default, whereas before the change they used Self
2015-07-13 16:00:07 -07:00
Jacob MacDonald 4bdc91892a chore(transformer): add a test that generated change detectors dont call notifyOnBinding for template variables 2015-07-13 15:09:06 -07:00
Tobias Bosch b3a763a718 fix(compiler): keep `DOM.hasProperty` in sync between browser and transformer.
Right now, we always return true until
we have property schema support (#2014).

Fixes #2984
Closes #2981
2015-07-13 15:09:06 -07:00
Rado Kirov 7ee6963f5d feat(query): initial implementation of view query.
ViewQuery is a new API that allows a component to query its view.

Closes #1935
2015-07-13 14:44:55 -07:00
Martin Probst 3bf8c18c56 chore: run clang-format on code base.
This fixes several minor indentation issues (instanceof precendence,
type declaration specificity, template string length calculation).

This should also fix some flip-flop situations with template strings.
2015-07-12 18:50:52 +02:00
yjbanov 0e28297e68 feat(zone): add "on event done" zone hook 2015-07-10 15:45:52 -07:00
Jeff Cross 9a70f84e60 refactor(pipes): rename PipeRegistry to Pipes
BREAKING CHANGE:
    This change renames all instances of PipeRegistry to Pipes.
    As part of this change, the former "defaultPipes" export is
    now a Pipes instance, instead of a map. The map that was previously
    called "defaultPipes" no longer exists, but may be accessed via
    defaultPipes.config.
2015-07-10 15:42:56 -07:00
vsavkin 0ed5dd0d7b fix(di): hostInjector and viewInjector support nested arrays 2015-07-09 15:03:38 -07:00
vsavkin b54e7214f0 chore: removed angular2.api.ts
BREACKING CHANGE:

We export InjectMetadata instead of InjectAnnotation
2015-07-09 13:54:07 -07:00
vsavkin 4656c6f5cf tools: added experimentalDecorators flag to tsconfig 2015-07-08 10:46:03 -07:00
Pawel Kozlowski 0598226e24 fix(compiler): don't trigger duplicated directives
Fixes #2756
Closes #2568
2015-07-01 16:13:26 -07:00
Pouria Alimirzaei 600d53c68e feat(pipes): support arguments in transform function 2015-07-01 13:36:01 -07:00
vsavkin f0e962c55e feat(di): removed app injector
BREAKING CHANGE:

THe appInjector property has been removed. Instead use viewInjector or hostInjector.
2015-07-01 13:33:43 -07:00
Alex Eagle 27e710019c chore(typing): use types for DOM API
This is possible now that ts2dart special cases these for dart.

Fixes #2770
2015-07-01 09:57:11 -07:00
Alex Eagle 44891996b5 fix(build): add missing return types now enforced by linter 2015-06-29 15:31:41 -07:00
Tobias Bosch d6cef88dd8 fix(dynamic_component_loader): check whether the dynamically loaded component has already been destroyed
Fixes #2748
Closes #2767
2015-06-29 11:30:56 -07:00
vsavkin eb0fd7967c feat(di): changed InstantiationError to print the original stack 2015-06-29 11:16:12 -07:00
vsavkin 22d3943831 refactor(di): unified di injector and core injector
BREAKING CHANGES:

* InjectAsync and InjectLazy have been removed
* toAsyncFactory has been removed
2015-06-26 15:59:18 -07:00
Jason Teplitz 7a7b3a6cb9 perf(Compiler): do not resolve bindings for cached ProtoViews 2015-06-25 14:45:08 -07:00
Julie Ralph d3dda614dd chore(test): migrate remaining core tests to testcomponentbuilder
Also add a small utility function to debug element to get an
array of native elements, which works smoothly with the
toHaveText matcher.
2015-06-24 21:52:03 -07:00
Victor Berchet a0e0f3123b refactor: change template for view where it makes sense 2015-06-24 18:40:04 +02:00
Victor Berchet b15474c6f2 refactor(TemplateResolver): rename to ViewResolver 2015-06-24 18:40:04 +02:00
Victor Berchet 356c927d12 refactor(TemplateLoader): rename to ViewLoader 2015-06-24 18:40:04 +02:00
Victor Berchet b89c0672e6 test(refactor): cleanup test to use the new UrlMapper 2015-06-24 18:40:04 +02:00
Victor Berchet 3ea655918e refactor(Compiler): inline styles before compiling the template 2015-06-24 18:40:03 +02:00
Victor Berchet 06aaa0c50e refactor(UrlResolver): extract app url resolution into AppRootUrl
fixes #1732
2015-06-24 18:40:03 +02:00
Julie Ralph 2c11205b96 chore(testbed): migrate compiler integration spec to testcomponentbuilder
Part of #2354
2015-06-23 19:02:46 -07:00
Rado Kirov d800d2f5d7 fix(injectors): sync injector tree with dom element tree.
Changes adds createGrowableSize method to allow for growable lists with fixed
start.

Closes: #2498
2015-06-23 18:32:57 -07:00
Tobias Bosch 6149ce28a7 fix(render): fix failing tests in dynamic_component_loader.ts 2015-06-23 17:43:36 -07:00
Tobias Bosch c8bdacb195 refactor(render): cleanup access to native dom elements
BREAKING CHANGES:
- rename `ElementRef.domElement` to `ElementRef.nativeElement`
- add `Renderer.getNativeElementSync` to make the app side
  less dependent on the dom renderer.
- don’t use `ElementRef.nativeElement` in directives but
  use the methods on `Renderer` directly.
- Removed `ElementRef.setAttribute`. Use `Renderer.setElementAttribute` instead.

Closes #2712
Last part of #2476
Closes #2476
2015-06-23 17:27:59 -07:00
Julie Ralph 5c9e53a25e chore(testbed): migrate dynamic component loader spec to testcomponentbuilder
Part of #2354
2015-06-23 16:33:11 -07:00
Tobias Bosch ba9fecd068 refactor(render): use `RenderElementRef` in all renderer methods
BREAKING CHANGES:
- Almost all methods in `Renderer` now take a `RenderElementRef` instead
  of a `ViewRef` + `boundElementIndex`.
- These methods can be called with the `ElementRef` from the app side
  directly.

Closes #2706
Related to #2476
2015-06-23 14:26:34 -07:00
Tobias Bosch 0a51ccbd68 feat(render): don’t use the reflector for setting properties
BREAKING CHANGES:
- host actions don't take an expression as value any more but only a method name,
  and assumes to get an array via the EventEmitter with the method arguments.
- Renderer.setElementProperty does not take `style.`/... prefixes any more.
  Use the new methods `Renderer.setElementAttribute`, ... instead

Part of #2476
Closes #2637
2015-06-22 18:35:16 -07:00
Pawel Kozlowski d7b9345b6d feat(compiler): detect dangling property bindings
BREAKING CHANGE: compiler will throw on binding to non-existing properties.

Till now it was possible to have a binding to a non-existing property,
ex.: `<div [foo]="exp">`. From now on this is compilation error - any
property binding needs to have at least one associated property:
eaither on an HTML element or on any directive associated with a
given element (directives' properites need to be declared using the
`properties` field in the `@Directive` / `@Component` annotation).

Closes #2598
2015-06-20 08:06:07 +02:00
Caitlin Potter ed9d9d5096 build(broccoli): make node_trees produce strict-mode scripts
Closes #2575
Closes #2648
2015-06-19 21:19:12 -04:00
vsavkin 20a8f0dbe5 refactor(pipes): removed pipes from properties
BREAKING CHANGE:

This PR remove an ability to use pipes in the properties config. Instead, inject the pipe registry.
2015-06-19 16:56:52 -07:00
vsavkin c899b0a74c feat(element_injector): support multiple injectables with the same token 2015-06-19 16:02:56 -07:00
Martin Probst 920982c4e8 chore: update files to match clang-format 1.0.21. 2015-06-19 15:00:32 -07:00
vsavkin f80f97253c refactor(change_detection): made ChangeDetector and ProtoChangeDetector interfaces
List of changes:

- Makes ChangeDetector and ProtoChangeDetector interfaces
- Assigns a unique id to every detector
2015-06-18 17:41:22 -07:00
Martin Probst be7ac9fd41 feat: remove MapWrapper.create()/get()/set().
Better dart2js code, better Angular code.
2015-06-18 14:55:12 -07:00
vsavkin b0e2ebda70 feat(query): added support for querying by var bindings 2015-06-17 16:36:55 -07:00
Martin Probst c7e48350d3 chore: kill ListWrapper.create() and .push().
These wrappers are not natively understood by
ts2dart. Removing them will improve Dart2JS
compilation due to fewer megamorphic calls to List
functions.

It also makes Angular code more succinct and
improves type safety in Angular due to better type
inference of the Array component type.

This change exposed several bugs in Angular.
2015-06-17 16:21:55 -07:00
Tobias Bosch 5dee8e26cc fix(views): remove dynamic component views, free host views, free embedded views
Closes #2472
Closes #2339

BREAKING CHANGE
- `Compiler.compile` has been removed, the only way to compile
  components dynamically is via `Compiler.compileInHost`
- `DynamicComponentLoader.loadIntoExistingLocation` has changed:
  * renamed into `loadIntoLocation`
  * will always create the host element as well
  * requires an element with a variable inside of the host component view
    next to which it will load new component.
- `DynamicComponentLoader.loadNextToExistingLocation` was renamed into
  `DynamicComponentLoader.loadNextToLocation`
- `DynamicComponentLoader.loadIntoNewLocation` is removed
  * use `DynamicComponentLoader.loadNextToLocation` instead
    and then move the view nodes
    manually around via `DomRenderer.getRootNodes()`
- `AppViewManager.{create,destroy}Free{Host,Embedded}View` was removed
  * use `AppViewManager.createViewInContainer` and then move the view nodes
    manually around via `DomRenderer.getRootNodes()`
- `Renderer.detachFreeView` was removed. Use `DomRenderer.getRootNodes()`
  to get the root nodes of a view and detach them manually.
2015-06-17 11:33:51 -07:00
Misko Hevery b2c66949b2 feat: allow Type.annotations = Component(...).View(...)
Closes #2577
2015-06-16 16:36:46 -07:00
vsavkin d8e2795368 fix(view): local variables override local variables set by ng-for 2015-06-16 07:48:26 -07:00
vsavkin 5bfcca2d5b feat(query): notify on changes 2015-06-15 11:10:21 -07:00
Victor Berchet ac3e624d0f feat(View): add support for styleUrls and styles
fixes #2382
2015-06-15 19:35:16 +02:00
Misko Hevery c3ae34f066 feat: support decorator chaining and class creation in ES5
Closes #2534
2015-06-14 16:54:08 -07:00
Martin Probst 4ae7df27d2 fix: improve type safety by typing `refs`. 2015-06-12 18:02:07 -07:00
vsavkin c51aef9f7d fix(element_injector): changed visibility rules to expose hostInjector of the component to its shadow dom 2015-06-12 17:17:31 -07:00
Tim Blasi bbfb4e1dcc fix(dynamic_component_loader): Fix for ts2dart issue
Fix a build break by declaring a type for `locals`.
See https://github.com/angular/ts2dart/wiki/Builtin-fa%C3%A7ade-methods#fixing-untyped-property-access-errors
for some context.
2015-06-12 16:55:08 -07:00
vsavkin 21dcfc89e9 fix(dynamic_component_loader): implemented dispose for dynamically-loaded components 2015-06-12 15:47:09 -07:00
Martin Probst f3d741854a fix: add types for ts2dart's façade handling.
... in many, many places.
2015-06-12 15:41:08 -07:00
Martin Probst c4ecbf0a7f fix: rename FORWARD_REF to forwardRef in the Angular code base.
Now that ts2dart understands forwardRef, there's
no need to maintain the old syntax.
2015-06-12 15:41:08 -07:00
Martin Probst a6e7123995 feat: adjust formatting for clang-format v1.0.19. 2015-06-12 09:51:57 -07:00
Victor Berchet 7648bb8ee3 doc(Lifecycle events): Document the call order 2015-06-12 18:51:04 +02:00
Rado Kirov 355ab5b3a6 feat(query): adds support for descendants and more list apis.
Additional clean up of query code.

Closes: #1935

BREAKING CHANGE:
By default Query only queries direct children.
2015-06-11 16:05:06 -07:00
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