Releases: ui-router/angular
1.0.0-beta.8
1.0.0-beta.8 (2017-10-07)
Compare @uirouter/angular
versions 1.0.0-beta.7 and 1.0.0-beta.8
Bug Fixes
- NgModule: Use InjectionToken instead of OpaqueToken (bfa604c)
- typescript: Fix typescript 2.4 compatibility issue (d0c46ce)
- uiSref: run update when input properties change (#141) (9ecc6e2)
Features
- UIRouterModule: Add deferInitialRender toggle to forRoot. Waits for initial router transition before bootstrapping the app the initial render. (5ae9051)
- uiSrefStatus: Emit all enclosed uiSref targetStates in the status object (0687e19)
- uiSrefStatus: emit state/params in events (bd67d25)
@uirouter/core
updated from 5.0.4 to 5.0.10 (2017-10-07)
Compare @uirouter/core
versions 5.0.4 and 5.0.10
Bug Fixes
- angular/cli: Use package.json fields: 'typings', 'main', 'jsnext:main' (74143d9)
- bundle: Rollup: Do not warn on THIS_IS_UNDEFINED (a4581b1)
- globals: Use shallow copy to update the globals.params / $state.params object (e883afc)
- Injector: When getting tokens from native injector, only throw on undefined (not on falsey values) (ada9ca2)
- isomorphic: Remove use of CustomEvent. Detect root scope (global/window/self) for nodejs, browser, or web-worker. (2d206ba)
- redirectTo: Fix typings for redirectTo. Allow a function that returns a target state or a promise for one. (3904487)
- sourceMaps: Embed typescript sources in sourcemaps (10558a3)
- trace: Fall back to console.log if .table is unavailable (IE) (c8110fc)
- trace: Support tracing of object-parameters with circular references (2f1ae9a)
- typescript: Fix strictNullCheck type error (0ae585e)
- typescript: Update to typescript 2.4 (ce1669b)
- typings: Use StateObject for parameter to hook criteria functions (5b58566)
- url: Add CustomEvent polyfill for IE (a50db21)
- urlRouter: Fix absolute 'href' generation by using location.hostname (not location.host) (a28b68a)
- urlService: Fix priority sorting of URL rules (73a1fe0)
- vanilla: fix base path handling for vanilla push state (ad61d74)
- vanilla: Use
self
instead ofwindow
for webworker compat (a4629ee)
Features
- Resolvable: Add
.value()
: returns value (WAIT) or promise (NOWAIT) (8769449) - TargetState: Add builder methods .withState, .withParams, and .withOptions (6b93142)
- TransitionHook: Add hook registration option
invokeLimit
to limit the number of times a hook is invoked before being auto-deregistered. (2cb17ef) - urlMatcher: add support for multiline urls (5b11ce0)
1.0.0-beta.7
1.0.0-beta.7 (2017-06-19)
Bug Fixes
- lazyLoad: fixed getting parent injector in angular 4.2 (dcd1cda)
- Ng2LocationServices: Do not fireAfterUpdate when on server. (543afcd)
- UISrefStatus: Fix memory leak -- take only one inner subscription at a time. (#120) (5a65d3c), closes #21
Features
- view: Support shorthand for named views,
views: { viewName: Component }
(84aec02)
Changes in @uirouter/core
from 5.0.0 to 5.0.4
Bug Fixes
- common: Fix implementation of 'pick' -- use hasOwnProperty (09848a4)
- common: Re-fix implementation of 'pick' using for .. in (f2da7f4)
- future: Allow future states to specify a
parent:
(828fe1b) - transition: Do not ignore transitions which have states being entered or exited (175717e)
- view: only sync views which are of the same name and type (c48da4a)
Features
- build: Build and distribute UMD bundles (0a8da85)
- invalidTransition: Better error messaging when param values are invalid (2a15d1a)
- Resolvable: Add
.value()
: returns value (WAIT) or promise (NOWAIT) (8769449) - trace: Trace view synchronization. Allow trace.enable(...string) (284392d)
- urlMatcher: add support for multiline urls (5b11ce0)
1.0.0-beta.6
1.0.0-beta.6 (2017-04-28)
Adds supports for Angular 4.x, removes support for Angular 2.x
Bug Fixes
- uiSref: open new tab when a tag has target="_blank" (d13ed47)
Features
- resolve: auto-map resolve values to matching component inputs in AoT (f6c552d)
UIRouter for Angular 2.x 1.0.0-beta.5
1.0.0-beta.5 (2017-04-22)
NOTICE: The npm package name change
The npm package changed to @uirouter/angular
. See UIRouter scoped packages for details
Bug Fixes
- bindings: Make
bindings:
work on a state declaration (as well as a view declaration) (a21c479) - bundle: Only bundle ui-router-ng2 code (do not bundle ui-router-core) (a285218)
- bundle: work around rollup bug rollup/rollup#1322 (89884b9)
- lazyLoad: Supply native injector to lazy loaded states (ebce639)
- Ng2LocationServices: Ignore duplicated 'hashchange' event in favor of 'popstate' event (82a3e2e)
- NgModule: De-dupe states loaded from NgModule (ffe85cb)
- package.json: Fix engines in package.json (b2d828a)
- rxjs: Fix missing RxJS operators in tree-shaked apps (5f03719)
- rxjs: import rxjs operators. (26a74ef)
- uiSref: avoid empty links (#26) (5f6870d)
Features
- bindings: Apply explicit bindings even when no
[@Input](https://github.com/Input)()
found. (4351c53) - config: Pass the module object to the module config function (e9705b0)
- Ng2LocationConfig: use BrowserLocationConfig. (7e0aef6)
- uiCanExit: Add
uiCanExit
hook for routed components (633573e)
Reverts
- ResolveData: Remove @ResolveData decorator (0c8226d)
BREAKING CHANGES
bundle: We no longer bundle the core nor rx code in the UMD bundle.
Previously, the ui-router-ng2
bundle included the code from ui-router-core
and ui-router-rx
.
Now, each UMD bundle must be included separately.
This change is most likely to affect:
- SystemJS projects
- projects that do not bundle (but ship pre-built UMD bundles)
- Users of ui-router plugins that import ui-router-core, such as sticky-states.
This release of @uirouter/angular
updates @uirouter/core
from 4.0.0
to 5.0.0
.
Here are the changes from core:
@ui-router/core changes
5.0.0 (2017-04-22)
Bug Fixes
- BrowserLocationConfig: fixed protocol + port value (#38) (5559382)
- lazyLoad: Wait for future state to be replaced before registering lazy children (4bdce47)
- noImplicitAny: Fix noimplicitany compliance (1a6cdfc)
- redirect: Do not update URL after redirect with { location: false } (652a760)
- tfs: Rename $q.ts and $injector.ts files, removing leading dollar signs (cb653ee)
- trace: Re-add transitionStart trace (b019036)
- TransitionHook: Do not process transition hooks after router has been disposed. (666c6d7)
- TransitionHook: Transition hooks no longer expose the internal StateObject (2b0e48b)
- typings: Allow strictNullChecks for HookMatchCriteria (d92d4d5)
- ui-sref: Improve performance of generating hrefs (c3967bd)
- view: Do not throw when uiView doesn't have a state context (f76ee2a)
- view: Update views in order of ui-view depth and also by state depth (46dea2b)
Features
- abort: Add API to manually abort/cancel a transition (39f8a53)
- common: Perf improvements in hot functions: (4193244)
- core: Switch to @uirouter/core npm module (e3f389f)
- defaultErrorHandler: Do not invoke default error handler for ABORTED transitions (b07a24b)
- Globals: implement Disposable and delete global transition data (a794018)
- onBefore: Run onBefore hooks asynchronously. (30b82aa)
- onEnter/Exit/Retain: Use onExit/onEnter/onRetain from StateObject, not state.self (bc1f554)
- Rejection: Add $id to ease debugging of transition rejections (d456d54)
- State: Switch Internal State Object to prototypally inherit from the State Declaration (027c995), closes #34
- StateObject: Rename internal
State
object toStateObject
(feceaf9) - StateRegistry: improve perf for:
.register()
andStateMatcher.find()
misses (fdb3ab9) - Transition: Ignore duplicate transitions (double clicks) (bd1bd0b)
- Transition: Improve supersede logic: Do not supersede if the new trans is aborted before onStart (3141a8f)
- Transition: Run hooks synchronously in current stack, when possible (953e618)
- Transition: Normalize all transition errors to a Rejection. (a7464bb)
- UrlService: (
UrlRouter
) improve perf of registering Url Rules and sorting Url Rules (64fbfff) - UrlService: Add
rules.initial("/home")
to config initial state (like otherwise) (bbe4209)
BREAKING CHANGES
TransitionHook: Transition hooks no longer expose the internal State
object (now named StateObject
)
Before:
import { State } from "ui-router-core";
const match = { to: (state: State) => state.data.auth };
transitionsvc.onEnter(match, (trans: Transition, state: State) => {
// state is the internal State object
if (state.includes["foo"]) { // internal ui-router API
return false;
}
}
Now:
import { StateDeclaration } from "ui-router-core";
const match = { to: (state: StateDeclaration) => state.data.auth };
transitionsvc.onEnter(match, (trans: Transition, state: StateDeclaration) => {
// state === the state object you registered
// Access internal ui-router API using $$state()
if (state.$$state().includes["foo"]) {
return false;
}
}
Motivation:
The State
object (now named StateObject
) is an internal API and should not be exposed via any public APIs.
If you depend on the internal APIs, you can still access the internal object by calling state.$$state()
.
BC Likelihood
How likely is this BC to affect me?
Medium: You will likely be affected you 1) have transition hooks, 2) are using typescript and/or 3) use the internal ui-router State API.
BC Severity
How severe is this BC?
Low: Access to the internal api is still available using $$state()
.
StateObject: Renamed internal API State
object to StateObject
Before:
import {State} from "ui-router-core";
Now:
import {StateObject} from "ui-router-core";
Motivation:
We'd like to use the State
name/symbol as a public API.
Some day (not today) it will likely be an ES7/TS decorator for ES6/TS state definition classes, i.e:
@State("foo")
export class FooState implements StateDeclaration {
url = "/foo";
component = FooComponent;
@Resolve({ deps: [FooService] })
fooData(fooService) {
return fooService.getFoos();
}
}
BC Likelihood
How likely is this to affect me?
Low: This only affects code that imports the internal API symbol State
.
You will likely be affected you 1) import that symbol, 2) are using typescript and 3) explicitly
typed a variable such as let internalStateObject = state.$$state();
BC Severity
How severe is this change?
Low: Find all places where State
is imported and rename to StateObject
Transition: All Transition errors are now wrapped in a Rejection object.
Before:
Previously, if a transition hook returned a rejected promise:
.onStart({}, () => Promise.reject('reject transition'));
In onError
or transtion.promise.catch()
, the raw rejection was returned:
.onError({}, (trans, err) => err === 'reject t...
1.0.0-beta.4: AoT + Angular-CLI support
1.0.0-beta.4 (2017-01-22)
This is a major release of ui-router-ng2
with many new features, including support for the angular-cli.
We now support AoT compilation with NgModule lazy loading (via Future States).
We also enabled code splitting support from the @ngtools/webpack
project.
There are numerous BREAKING CHANGES including those from the ui-router-core
dependency.
Please read through them carefully.
AoT support + lazy loading + Angular-CLI
Commits eb5d599, 2a4b174, and 8088ef9 enable AoT compilation support and better Lazy Loading support.
When @ngtools/webpack
is being used, this also enables automatic code splitting + lazy loading.
Because angular-cli
uses @ngtools/webpack
, this change also enables angular-cli
support.
To use these new features, define a Future State
(by appending .**
to
the state name). Give the state a loadChildren
property which points
to a nested NgModule that will be lazy loaded. Use the same syntax that
@ngtools/webpack
expects: <pathToModule>#<name of export>
.
export var futureFooState = {
name: 'foo.**',
url: '/foo',
loadChildren: './foo/foo.module#FooModule'
};
...
imports: [
UIRouterModule.forRoot({ states: [ futureFooState ] }),
...
In your nested module, add a state named foo
(without the .**
). This
nested module's foo
state will replace the foo.**
Future State (placeholder).
export var fooState = {
name: 'foo',
url: '/foo',
resolve: {
fooData: fooResolveFn
},
onEnter: onEnterFooFn,
data: {
requiresAuth: true
}
};
...
imports: [
UIRouterModule.forChild({ states: [ fooState ] }),
...
This change works by providing the same DI token as the @angular/router
which is then analyzed for lazy loading by @ngtools/webpack
.
The ROUTES
token is deep imported from @angular/router/src/router_config_loader
.
The module's states are provided on the ROUTES token, which enables the
webpack tooling to analyze the states, looking for loadChildren
.
When the UMD bundle is built, the ROUTES token is pulled in from
@angular/router
(and duplicated), but should not be used by anything.
Because we pull in the token from the @angular/router
package, we have
a temporary dependency on the angular router. This is a temporary hack
until the @ngtools/webpack
project makes itself router-agnostic.
Bug Fixes
- #3087: deep rxjs imports (964c99f)
- build: bump ng2 deps and remove prepublish step (c6628fa)
- lazyLoad: Update lazyLoad for ui-router-core 3.1 (2a4b174)
- loadNgModule: Better error message when lazy loaded NgModule contains no state defs (7d4ac6d)
- location: Do not deep import
vanilla.*
fromui-router-core
(19113ee) - location: make initial otherwise('/') activate state (perform url sync) (33ae6a8)
- uiSrefActive: Allow ng-if on nested uiSrefs (e3051f5), closes #3046
- params: Fix typed parameters by auto-flushing the param type queue (6241bca), closes #14
- ui-router-rx: Fix ui-router-rx plugin name (a1855ab)
Features
- BC: We no longer ship commonjs in the npm package. We now ship esm+es5 (individual files) and UMD bundles only. (34ea6ad)
- BC: You no longer configure a module using an Injectable
UIRouterConfig
class. Now you use a function that receives theUIRouter
and theInjector
(9aae71a) - UIRouterConfig: Use a simple function to configure module instead of an injectable class (9aae71a)
- AoT: Enable AoT with Lazy Loading. Enable Angular CLI support. (eb5d599)
- build: Generate bundle using rollup instead of webpack (42b0f16)
- bundles: Point package.json main: to the umd bundle. Stop shipping commonjs. (34ea6ad)
- lazyLoad: Allow
loadChildren:
sugar on a state definition (2a4b174) - lazyLoad: automatically unwrap default export (
__esModule
) (allows easier default export of NgModule) (2a4b174) - lazyLoad: Support passing callback to lazyLoad for loading ng2 module (#3037) (a0688ae)
- UrlService: Add UrlService injectable (33ae6a8), closes #17
- rx: Move reactive extension to its own project at http://github.com/ui-router/rx (b0a672f)
BREAKING CHANGES
BREAKING CHANGE: We no longer ship commonjs in the npm package. We now ship esm+es5 (individual files) and UMD bundles only.
This brings ui-router-ng2 npm package in line with how the core Angular 2 packages are packaged.
We compile and distribute esm+es5 + typescript typings in lib/
(formerly in lib-esm/
)
We no longer include the commonjs+es5 (formerly in lib/
)
We now point the main:
entry to the UMD bundle for commonjs users.
BREAKING CHANGE: You no longer configure a module using an Injectable UIRouterConfig
class. Now you use a function that receives the UIRouter
and the Injector
In 1.0.0-beta.3 you might have a config class like this:
export class MyUIRouterConfig {
constructor(@Inject(UIRouter) router: UIRouter, @Inject(SomeService) myService: SomeService) {
// do something with router and injected service
}
}
which was wired into the root module like this:
```js
@NgModule({
imports: [
UIRouterModule.forRoot({ configClass: MyUIRouterConfig })
]
})
export class AppModule {}
In 1.0.0-beta.4 you should switch to a simple function.
The function receives the router: UIRouter
and injector: Injector
export function configureModule(router: UIRouter, injector: Injector) {
// do something with router
router.urlService.rules.type('slug', slugParamType);
// inject other services
const myService: SomeService = injector.get(SomeService);
// do something injected service
myService.init();
}
which is now wired using config: configureModule
instead of configClass: ...
@NgModule({
imports: [
UIRouterModule.forRoot({ configClass: MyUIRouterConfig })
]
})
export class AppModule {}
ui-router-core changes
This 1.0.0-beta.4
release of ui-router-ng2
updates ui-router-core
from 1.0.0-beta.3
to 4.0.0
4.0.0 (2017-01-22)
Bug Fixes
- lazyLoad: Allow
lazyLoad
stateBuilder: Get lazyLoad fn from internal State object, not StateDeclaration (9313880) - lazyLoad: Fix
State.lazyLoad
type def (9313880) - lazyLoad: Sync by URL after nested lazy load triggered by URL (1c6220c)
- lazyLoad: Use UrlService.match() to retry url sync after successful lazy load triggered by url (8c2461d), closes #19
- onBefore: Skip remaining hooks after the (#2) (8a45d04)
- param:
params: { foo: { raw: true } }
overridesParamType.raw
(aefeabf) - Param: Mark all query parameters as optional (7334d98)
- params: Check for null in
int
param typeis()
check (aa551e4), closes #3197 - pushStateLocation: call listeners in url() (#24) (7c90911), closes #23
- redirect: Do not allow
onBefore
hooks to cause infinite redirect loops (5c5f7eb), closes #6 - redirectTo: Do not puke when redirectTo returns undefined (bde9c0f)
- redirectTo: fix TS type signature of
redirectTo
(2c059c4) - resolve: Allow resolve's state context to be injected as
$state$
(a06948b) - StateQueueManager: Compare parsed url parameters using typed parameters (beca1f5)
- StateRegistry: Fix error message: State '' is already defined (f5bd96b)
- StateService: Compare typed parameters in .is() and .includes() (b1a5155)
- TargetState: Narrow
name()
retur...