49 Commits

Author SHA1 Message Date
Victor Berchet
933a9112da fix(ChangeDetection): chain expressions evaluate to the last expression (codegen)
fixes 
Closes 
2016-01-12 17:10:42 +00:00
Tobias Bosch
7ae23adaff feat(core): speed up view creation via code gen for view factories.
BREAKING CHANGE:
- Platform pipes can only contain types and arrays of types,
  but no bindings any more.
- When using transformers, platform pipes need to be specified explicitly
  in the pubspec.yaml via the new config option
  `platform_pipes`.
- `Compiler.compileInHost` now returns a `HostViewFactoryRef`
- Component view is not yet created when component constructor is called.
  -> use `onInit` lifecycle callback to access the view of a component
- `ViewRef#setLocal` has been moved to new type `EmbeddedViewRef`
- `internalView` is gone, use `EmbeddedViewRef.rootNodes` to access
  the root nodes of an embedded view
- `renderer.setElementProperty`, `..setElementStyle`, `..setElementAttribute` now
  take a native element instead of an ElementRef
- `Renderer` interface now operates on plain native nodes,
  instead of `RenderElementRef`s or `RenderViewRef`s

Closes 
2016-01-05 08:56:46 -08:00
flyyang
9276dad42c docs: fix some typos in comments and strings
Couple of typos fixed:
- occuring -> occurring
- imlement -> implement
- idenitifer -> identifer
etc...

Closes 
2015-12-17 22:57:43 +00:00
Victor Berchet
da9b46a071 feat: camelCase Angular (kebab-case removal)
BREAKING CHANGE:

Angular is now fully camel case.

Before:

    <p *ng-if="cond">
    <my-cmp [my-prop]="exp">
    <my-cmp (my-event)="action()">
    <my-cmp [(my-prop)]="prop">
    <input #my-input>
    <template ng-for #my-item [ng-for-of]=items #my-index="index">

After

    <p *ngIf="cond">
    <my-cmp [myProp]="exp">
    <my-cmp (myEvent)="action()">
    <my-cmp [(myProp)]="prop">
    <input #myInput>`,
    <template ngFor="#my-item" [ngForOf]=items #myIndex="index">

The full details are found in [angular2/docs/migration/kebab-case.md](https://github.com/angular/angular/blob/master/modules/angular2/docs/migration/kebab-case.md)
2015-12-09 19:59:40 -08:00
Yegor Jbanov
2d313c4d1d chore(parser): add tests for conditional expressions
Closes 
2015-12-07 15:16:57 -08:00
Jeff Cross
fcc7ce225e refactor(pipes): use angular lifecycle hooks instead of PipeOnDestroy
BREAKING CHANGE:
Previously, pipes that wanted to be notified when they were destroyed
would implement the PipeOnDestroy interface and name the callback
`onDestroy`. This change removes the PipeOnDestroy interface and
instead uses Angular's lifecycle interface `OnDestroy`, with the
`ngOnDestroy` method.

Before:
```
import {Pipe, PipeOnDestroy} from 'angular2/angular2';
@Pipe({pure: false})
export class MyPipe implements PipeOnDestroy {
  onDestroy() {}
}
```

After:
import {Pipe, OnDestroy} from 'angular2/angular2';
@Pipe({pure: false})
export class MyPipe implements PipeOnDestroy {
  ngOnDestroy() {}
}
2015-11-30 16:40:50 -08:00
Jeff Cross
604c8bbad5 refactor(lifecycle): prefix lifecycle methods with "ng"
BREAKING CHANGE:
Previously, components that would implement lifecycle interfaces would include methods
like "onChanges" or "afterViewInit." Given that components were at risk of using such
names without realizing that Angular would call the methods at different points of
the component lifecycle. This change adds an "ng" prefix to all lifecycle hook methods,
far reducing the risk of an accidental name collision.

To fix, just rename these methods:
 * onInit
 * onDestroy
 * doCheck
 * onChanges
 * afterContentInit
 * afterContentChecked
 * afterViewInit
 * afterViewChecked
 * _Router Hooks_
 * onActivate
 * onReuse
 * onDeactivate
 * canReuse
 * canDeactivate

To:
 * ngOnInit,
 * ngOnDestroy,
 * ngDoCheck,
 * ngOnChanges,
 * ngAfterContentInit,
 * ngAfterContentChecked,
 * ngAfterViewInit,
 * ngAfterViewChecked
 * _Router Hooks_
 * routerOnActivate
 * routerOnReuse
 * routerOnDeactivate
 * routerCanReuse
 * routerCanDeactivate

The names of lifecycle interfaces and enums have not changed, though interfaces
have been updated to reflect the new method names.

Closes 
2015-11-30 16:40:50 -08:00
Yegor Jbanov
b90de66535 fix(parser): do not crash on untokenizable quote prefixes
Closes 
2015-11-25 23:43:52 +00:00
Yegor Jbanov
b6ec2387b3 feat(templates): introduce quoted expressions to support 3rd-party expression languages
A quoted expression is:

quoted expression = prefix `:` uninterpretedExpression
prefix = identifier
uninterpretedExpression = arbitrary string

Example: "route:/some/route"

Quoted expressions are parsed into a new AST node type Quote. The `prefix` part of the
node must be a legal identifier. The `uninterpretedExpression` part of the node is an
arbitrary string that Angular does not interpret.

This feature is meant to be used together with template AST transformers introduced in
a43ed79ee7. The
transformer would interpret the quoted expression and convert it into a standard AST no
longer containing quoted expressions. Angular will continue compiling the resulting AST
normally.
2015-11-25 14:28:11 -08:00
Tobias Bosch
e667ad3e6b refactor(compiler): make all commands const
Closes 
2015-11-09 10:59:08 -08:00
vsavkin
79472b77ca refactor(core): move facades out of core
This is part of ongoing work to make core platform-independent.

BREAKING CHANGE

All private exports from 'angular2/src/core/facade/{lang,collection,exception_handler}' should be replaced with 'angular2/src/facade/{lang,collection,exception_handler}'.
2015-11-07 01:36:06 +00:00
Tim Blasi
63e853dcd7 feat(change_detect): Guard checkNoChanges behind assertionsEnabled
Always generate `checkNoChanges` tests, but guard them behind
`assertionsEnabled` tests.

Closes 
2015-11-06 11:59:03 -08:00
vsavkin
6edd964a83 chore(core): move compiler out of core
BREAKING CHANGE

All imports from 'angular2/core/compiler' should be changed to 'angular2/compiler'.
2015-11-05 14:44:52 -08:00
Victor Berchet
7e92d2e6b7 feat(ChangeDetector): Add support for short-circuiting 2015-11-05 19:28:30 +00:00
Victor Berchet
c56efc0c5f refactor(ChangeDetector): use View/ShadowDom & Content/LightDom consistently 2015-11-05 19:28:30 +00:00
Alex Rickabaugh
d1b54d6807 fix(core): Add an error state for ChangeDetectors that is set when bindings or lifecycle events throw exceptions and prevents further detection.
- Changes the `alreadyChecked` flag of AbstractChangeDetector to a new `state` flag.
- Changes all checks of alreadyChecked to check that the state is NeverChecked.
- Set state to Errored if an error is thrown during detection.
- Skip change detection for a detector and its children when the state is Errored.
- Add a test to validate this fixes issue .

Closes 
2015-10-29 23:11:02 +00:00
Martin Probst
c02f2bdab0 chore: adjust formatting to new clang-format.
- fixes wrapping for object literal keys called `template`.
- spacing in destructuring expressions.
- changes to keep trailing return types of functions closer to their
  function declaration.
- better formatting of string literals.

Closes 
2015-10-28 11:19:10 +01:00
Victor Berchet
1316c3e391 fix(ChangeDetector): support for NaN
Closes 
2015-10-28 00:44:06 +00:00
Victor Berchet
4639f449cf feat(Parser): associate pipes right to left
closes 

BREAKING CHANGE:

Before:

`1 + 1 | pipe:a | pipe:b` was parsed as `(1 + 1) | pipe:(a | pipe:b)`

After:

`1 + 1 | pipe:a | pipe:b` is parsed as `((1 + 1) | pipe:a) | pipe:b`

Closes 
2015-10-21 18:43:10 +00:00
Victor Berchet
0a940211d5 feat(change detection): remove support for "if"
BREAKING CHANGE: Remove if statement support from actions.

Closes 
2015-10-20 18:15:08 +00:00
Tim Blasi
fd0ba37734 refactor(dart): Format Dart code
Use the dart formatter to clean up all pure Dart code.

Closes 
2015-10-20 17:39:37 +00:00
Julie Ralph
f529236bfc refactor(test): rename test_lib to testing
Old test_lib is now testing_internal
test_lib_public is now testing
2015-10-13 10:36:49 -07:00
vsavkin
1aeafd31bd feat(di): change the params of Provider and provide to start with "use"
Closes 
2015-10-12 21:09:09 +00:00
vsavkin
1eb0162cde feat(di): rename Binding into Provider
Closes 

Closes 
2015-10-11 05:13:31 +00:00
Victor Berchet
a8c34ae290 refactor(MapWrapper): drop delete(), get(), forEach() and size
Closes 
2015-10-09 20:07:43 +00:00
Alex Eagle
5458036de7 fix(typings): update test.typings for abstract superclasses 2015-10-08 13:54:43 -07:00
Alex Eagle
6075509f26 chore(typing): extract abstract superclasses to replace @private constructors 2015-10-08 13:54:43 -07:00
Victor Berchet
aee176115b refactor(ListWrapper): drop forEach and removeLast
Closes 
2015-10-07 17:17:31 +00:00
Victor Berchet
a0277f1b3a refactor: add missing types for ts2dart
Closes 
2015-10-07 06:39:14 +00:00
Victor Berchet
aaa215514b refactor(ListWrapper): get ride of ListWrapper.map 2015-10-07 06:39:14 +00:00
Alex Eagle
7c4199cd1c chore(typings): remove StringMap
This was a poorly typed attempt to mimic TypeScript's index signatures,
which we can use instead.
This eliminates a very strange type that we were exposing to users, but
not re-exporting through our public API.

Fixes 
2015-10-03 01:09:42 +00:00
Tobias Bosch
d21c7bdf90 refactor(compiler): remove unused code
BREAKING CHANGE:
- Removes `ChangeDetection`, use a binding for `ChangeDetectorGenConfig` instead
  to configure change detection.
- `RenderElementRef.renderBoundElementIndex` was renamed to `RenderElementRef.boundElementIndex`.
- Removes `ViewLoader`, use `XHRImpl` instead.
2015-10-01 22:27:41 -07:00
Tobias Bosch
76247b7097 refactor(compiler): use the new compiler everywhere
Closes 

BREAKING CHANGE:
- we don't mark an element as bound any more if it only contains text bindings
  E.g. <div>{{hello}}</div>
  This changes the indices when using `DebugElement.componentViewChildren` / `DebugElement.children`.
- `@Directive.compileChildren` was removed,
  `ng-non-bindable` is now builtin and not a directive any more
- angular no more adds the `ng-binding` class to elements with bindings
- directives are now ordered as they are listed in the View.directives regarding change detection.
  Previously they had an undefined order.
- the `Renderer` interface has new methods `createProtoView` and `registerComponentTemplate`. See `DomRenderer` for default implementations.
- reprojection with `ng-content` is now all or nothing per `ng-content` element
- angular2 transformer can't be used in tests that modify directive metadata.
  Use `angular2/src/transform/inliner_for_test` transformer instead.
2015-10-01 18:48:27 -07:00
vsavkin
cec4b36d9b fix(change_detection): _throwError should not mask the original exception 2015-09-30 18:18:28 -07:00
Marc Laval
390aacd442 fix(facade): workaround for lack of Symbol.iterator in es6-shim
Closes 
Fixes 
2015-09-18 09:46:13 +02:00
Misko Hevery
63e785902f feat(change_detection): allow triggering CD form ChangeDetectorRef
Closes 
2015-09-14 18:07:31 +00:00
vsavkin
f6cc573687 fix(exception_handler): fix error messages of wrapped exceptions
Closes 
2015-09-10 22:26:56 +00:00
Tobias Bosch
12dd44f7f6 feat(compiler): add change detector generation
Runtime and Codegen.

Part of 
Closes 
2015-09-10 00:59:34 +00:00
vsavkin
a8bdb693b9 feat(pipes): add support for pure pipes
By default, pipes are pure. This means that an instance of a pipe will be reused and the pipe will be called only when its arguments change.

BREAKING CHANGE

Before:

@Pipe({name: 'date'}) class DatePipe {} defines an impure pipe.

After:

@Pipe({name: 'date'}) class DatePipe {} defines a pure pipe.
@Pipe({name: 'date', pure: false}) class DatePipe {} defines an impure pipe.

Closes 
2015-09-08 16:24:27 +00:00
Jeff Cross
f14b212dc9 refactor: export core APIs from angular2/core
This change moves many APIs to the angular2/core export.

This change also automatically adds FORM_BINDINGS in
the application root injector.

BREAKING CHANGE:
    Many dependencies that were previously exported from specific
    APIs are now exported from angular2/core. Affected exports, which
    should now be included from angular2/core include:

    angular2/forms
    angular2/di
    angular2/directives
    angular2/change_detection
    angular2/bootstrap (except for dart users)
    angular2/render
    angular2/metadata
    angular2/debug
    angular2/pipes
Closes 
2015-09-05 07:01:34 +00:00
Victor Berchet
ecf6ba3974 refactor: prefer const over var for constants
Closes 
2015-08-31 21:59:33 +00:00
Misko Hevery
e916836261 chore(ts2dart): replace List with Array
Closes 
2015-08-31 21:32:10 +00:00
vsavkin
d49bc438e8 feat(core): added afterContentInit, afterViewInit, and afterViewChecked hooks
Closes 
2015-08-31 17:16:54 +00:00
Misko Hevery
551d9a1688 chore(LifecycleEvent): change to PascalCase / rename
BREAKING CHANGE

Closes 

- LifecycleEvent.onInit => LifecycleEvent.OnInit
- LifecycleEvent.onDestroy => LifecycleEvent.OnDestroy
- LifecycleEvent.onChange => LifecycleEvent.OnChanges
- LifecycleEvent.onCheck => LifecycleEvent.DoCheck
- LifecycleEvent.onAllChangesDone => LifecycleEvent.AfterContentChecked
- OnCheck.onCheck() => DoCheck.doCheck()
- OnChange.onChange() => OnChanges.onChanges()
- OnAllChangesDone.onAllChangesDone() => AfterContentChecked.afterContentChecked

Closes 
2015-08-27 22:32:21 -07:00
Misko Hevery
37b042b361 chore: Make enum names consistent with TypeScript convention
BREAKING_CHANGE

Ts2Dart issue: https://github.com/angular/ts2dart/issues/270
TypeScript convention: https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines
DartConvertion: https://www.dartlang.org/articles/style-guide/

Rename:

- NumberFormatStyle.DECIMAL => NumberFormatStyle.Decimal
- NumberFormatStyle.PERCENT => NumberFormatStyle.Percent
- NumberFormatStyle.CURRENCY => NumberFormatStyle.Currency
- RequestMethods.GET => RequestMethods.Get
- RequestMethods.POST => RequestMethods.Post
- RequestMethods.PUT => RequestMethods.Put
- RequestMethods.DELETE => RequestMethods.Delete
- RequestMethods.HEAD => RequestMethods.Head
- RequestMethods.PATCH => RequestMethods.Patch
- ReadyStates.UNSENT => ReadyStates.Unsent
- ReadyStates.OPEN => ReadyStates.Open
- ReadyStates.HEADERS_RECEIVED => ReadyStates.HeadersReceived
- ReadyStates.LOADING => ReadyStates.Loading
- ReadyStates.DONE => ReadyStates.Done
- ReadyStates.CANCELLED => ReadyStates.Canceled
2015-08-27 22:32:21 -07:00
Misko Hevery
69926dd002 refactor(change_detection): introduce enum ChangeDetectionStrategy
BREAKING CHANGE

Closes 

- change detection strategy type changes from string to ChangeDetectionStrategy
- CHECK_ONCE => ChangeDetectionStrategy.CheckOnce
- CHECKED => ChangeDetectionStrategy.Checked
- CHECK_ALWAYS => ChangeDetectionStrategy.CheckAlways
- DETACHED => ChangeDetectionStrategy.Detached
- ON_PUSH => ChangeDetectionStrategy.OnPush
- DEFAULT => ChangeDetectionStrategy.Default
- ON_PUSH_OBSERVE => ChangeDetectionStrategy.OnPushObserve
2015-08-27 21:41:46 -07:00
vsavkin
343dcfa0c0 refactor(tests): removed @IMPLEMENTS 2015-08-26 15:06:25 -07:00
Jeff Cross
8ed22ce6e7 chore: update all import paths 2015-08-25 15:33:23 -07:00
Jeff Cross
38a5a2a955 chore: move core modules into core directory
BREAKING CHANGE:
    This change moves the http module into angular2/, so its import
    path is now angular2/http instead of http/http.

    Many other modules have also been moved around inside of angular2,
    but the public API paths have not changed as of this commit.
2015-08-25 15:33:22 -07:00