Commit Graph

45 Commits

Author SHA1 Message Date
Alex Rickabaugh 60727c4d2b revert(format): Revert "chore(format): update to latest formatter"
This reverts commit 03627aa84d.
2016-04-12 09:41:01 -07:00
Alex Eagle 03627aa84d chore(format): update to latest formatter
Closes #7958
2016-04-11 22:15:23 +00:00
Peter Bacon Darwin 8e3e45097a fix(router): handle URL that does not match a route
Closes #7349
Closes #7203
2016-03-09 20:48:52 -08:00
Misko Hevery 14f0e9ada8 chore: fix DDC errors / warnings
Closes #7195
2016-03-08 22:17:32 +00:00
Brandon Roberts 6dce4f49c2 feat(router): Added method to get current instruction
This method delegates to the root router to get the current complete instruction.
2016-03-04 02:10:58 -08:00
Brian Ford 75343eb340 feat(router): add regex matchers
@petebacondarwin deserves credit for most of this commit.

This allows you to specify a regex and serializer function instead
of the path DSL in your route declaration.

```
@RouteConfig([
  { regex: '[a-z]+.[0-9]+',
    serializer: (params) => `{params.a}.params.b}`,
    component: MyComponent }
])
class Component {}
```

Closes #7325
Closes #7126
2016-03-02 16:08:19 -08:00
Julie Ralph abff302e52 chore(tests): fix broken test from using the wrong xit
Also, run clang-format.
2016-02-25 10:50:59 -08:00
vsavkin ee298baa1b test(router): disable a flaky test 2016-02-25 10:21:53 -08:00
Alex Eagle 265703b950 fix(typing): Remove re-export of the Promise built-in type.
Instead, ts2dart can add the 'dart:async' import whenever
Promise is used.

Fixes #6468
2016-02-12 20:45:41 -08:00
Brian Yarger 995a9e0cf8 fix(router): fix incorrect url param value coercion of 1 to true
seriliazeParams is coercing a value of 1 to true, which causes the value to be completey dropped.
Change the test from double equals to triple equals to prevent this from happening.

Closes #5346

Closes #6286
2016-02-03 15:00:24 +00:00
Brian Ford aa85856e1c fix(router): set correct redirect/default URL from hashchange
Currently, hashchange events outside of Angular that cause navigation
do not take into account cases where the initial route URL changes
due to a redirect or a default route.

Closes #5590

Closes #5683
2015-12-08 22:34:19 +00: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 #5036
2015-11-30 16:40:50 -08:00
Brian Ford 6ddfff5cd5 refactor(router): improve recognition and generation pipeline
This is a big change. @matsko also deserves much of the credit for the implementation.

Previously, `ComponentInstruction`s held all the state for async components.
Now, we introduce several subclasses for `Instruction` to describe each type of navigation.

BREAKING CHANGE:

Redirects now use the Link DSL syntax. Before:

```
@RouteConfig([
	{ path: '/foo', redirectTo: '/bar' },
	{ path: '/bar', component: BarCmp }
])
```

After:

```
@RouteConfig([
	{ path: '/foo', redirectTo: ['Bar'] },
	{ path: '/bar', component: BarCmp, name: 'Bar' }
])
```

BREAKING CHANGE:

This also introduces `useAsDefault` in the RouteConfig, which makes cases like lazy-loading
and encapsulating large routes with sub-routes easier.

Previously, you could use `redirectTo` like this to expand a URL like `/tab` to `/tab/posts`:

@RouteConfig([
	{ path: '/tab', redirectTo: '/tab/users' }
	{ path: '/tab', component: TabsCmp, name: 'Tab' }
])
AppCmp { ... }

Now the recommended way to handle this is case is to use `useAsDefault` like so:

```
@RouteConfig([
	{ path: '/tab', component: TabsCmp, name: 'Tab' }
])
AppCmp { ... }

@RouteConfig([
	{ path: '/posts', component: PostsCmp, useAsDefault: true, name: 'Posts' },
	{ path: '/users', component: UsersCmp, name: 'Users' }
])
TabsCmp { ... }
```

In the above example, you can write just `['/Tab']` and the route `Users` is automatically selected as a child route.

Closes #4728
Closes #4228
Closes #4170
Closes #4490
Closes #4694
Closes #5200

Closes #5475
2015-11-30 17:06:03 +00:00
Alex Rickabaugh c5294c77d9 Revert "refactor(router): improve recognition and generation pipeline"
This reverts commit cf7292fcb1.

This commit triggered an existing race condition in Google code. More work is needed on the Router to fix this condition before this refactor can land.
2015-11-23 16:26:47 -08:00
Brian Ford cf7292fcb1 refactor(router): improve recognition and generation pipeline
This is a big change. @matsko also deserves much of the credit for the implementation.

Previously, `ComponentInstruction`s held all the state for async components.
Now, we introduce several subclasses for `Instruction` to describe each type of navigation.

BREAKING CHANGE:

Redirects now use the Link DSL syntax. Before:

```
@RouteConfig([
  { path: '/foo', redirectTo: '/bar' },
  { path: '/bar', component: BarCmp }
])
```

After:

```
@RouteConfig([
  { path: '/foo', redirectTo: ['Bar'] },
  { path: '/bar', component: BarCmp, name: 'Bar' }
])
```

BREAKING CHANGE:

This also introduces `useAsDefault` in the RouteConfig, which makes cases like lazy-loading
and encapsulating large routes with sub-routes easier.

Previously, you could use `redirectTo` like this to expand a URL like `/tab` to `/tab/posts`:

@RouteConfig([
  { path: '/tab', redirectTo: '/tab/users' }
  { path: '/tab', component: TabsCmp, name: 'Tab' }
])
AppCmp { ... }

Now the recommended way to handle this is case is to use `useAsDefault` like so:

```
@RouteConfig([
  { path: '/tab', component: TabsCmp, name: 'Tab' }
])
AppCmp { ... }

@RouteConfig([
  { path: '/posts', component: PostsCmp, useAsDefault: true, name: 'Posts' },
  { path: '/users', component: UsersCmp, name: 'Users' }
])
TabsCmp { ... }
```

In the above example, you can write just `['/Tab']` and the route `Users` is automatically selected as a child route.

Closes #4170
Closes #4490
Closes #4694
Closes #5200

Closes #5352
2015-11-20 23:18:43 +00: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
Vamsi V 7d83959be5 refactor(router): rename "as" to "name" in RouteConfig
BREAKING CHANGE:

This is a rename to make routing concepts easier to understand.

Before:

```
@RouteConfig([
  { path: '/', component: MyCmp, as: 'Home' }
])
```

After:

```
@RouteConfig([
  { path: '/', component: MyCmp, name: 'Home' }
])
```

Closes #4622

Closes #4896
2015-10-29 10:52:55 -07:00
Brian Ford 07cdc2ff44 feat(router): add support for route links with no leading slash
Closes #4623
2015-10-27 09:01:16 +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 #4684
2015-10-12 21:09:09 +00:00
vsavkin 1eb0162cde feat(di): rename Binding into Provider
Closes #4416

Closes #4654
2015-10-11 05:13:31 +00:00
Tobias Bosch 6248a5e846 refactor(core): move core/compiler to core/linker, adjust imports 2015-10-02 08:42:12 -07:00
Brian Ford cb4a9a3c04 refactor(router): use CamelCase aliases for routes 2015-09-14 22:46:02 -07:00
Brian Ford d2458866c1 refactor(router): remove unused Pipeline 2015-09-14 21:21:57 +00:00
Brian Ford d9036c6cf3 feat(router): introduce new navigate method
Previously, `router.navigate` took a string representing the URL.
Now, it accepts an array that mirrors the link DSL.

Closes #4040

BREAKING CHANGE

The old method has been renamed to `router.navigateByUrl`.
Either change your navigation calls to use the DSL (preferred) or
call `router.navigateByUrl` instead.

Closes #4074
2015-09-11 17:20:13 -07:00
Brian Ford acc2722cb8 refactor(router): rename navigate and navigateInstruction methods 2015-09-11 17:17:45 -07: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 #3977
2015-09-05 07:01:34 +00:00
Brian Ford de37729823 feat(router): implement Router.isRouteActive 2015-08-31 18:09:32 +00: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
Brian Ford 5c95b376b5 fix(router): subscribe should return subscription
Closes #3491

Closes #3695
2015-08-19 01:34:08 +00:00
Brian Ford 26d2ea8afc fix(router): fix regression with generating links to async routes
Closes #3650
2015-08-14 22:32:48 +00:00
Brian Ford ac6227e434 feat(router): auxiliary routes
Closes #2775
2015-08-10 10:47:37 -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
Matias Niemelä 7bf7ec6d9c fix(router): ensure navigation via back button works
The router will now navigate and respect the current address value
accordingly whenever a popState event is handled.

Closes #2201
2015-08-03 22:24: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
Matias Niemelä fdffcaba9b feat(router): use querystring params for top-level routes
Closes #3017
2015-07-22 14:40:55 -07:00
Brian Ford 4d28167bc0 feat(router): add interfaces for route definitions in RouteConfig
Closes #2261
2015-07-16 16:36:22 -07:00
Matias Niemelä 5677bf73ca feat(router): introduce matrix params
Closes #2774
Closes #2989
2015-07-13 17:15:13 -07:00
Brian Ford a9a552c112 feat(router): lifecycle hooks
Closes #2640
2015-07-13 09:12:15 -07:00
Brian Ford 286a249a9a feat(router): support deep-linking to siblings
Closes #2807
2015-07-07 14:54:59 -07:00
Brian Ford f66ce096d8 feat(router): support deep-linking to anywhere in the app
Closes #2642
2015-06-30 17:21:50 -07:00
Brian Ford cd95e078fe feat(router): add routing to async components
Note that this also removes the `components` option from `RouteConfig`.
This functionality will be reintroduced with the more general `//` routing.
See #2329 for more details.
2015-06-08 15:49:56 -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
Jeff Cross ba07f39347 refactor(router): convert to typescript
Fixes #2001
2015-06-02 11:06:44 -07:00