Comments (5)
found this in the changelog.md of ui-router-ng2 :
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 {}
from quickstart-ng2.
+1
from quickstart-ng2.
+1
from quickstart-ng2.
you can still make the quickstart work changing ui-router version to 1.0.0-beta3.
Go to your package.json and replace :
"ui-router-ng2": "^1.0.0-beta.3"
with
"ui-router-ng2": "1.0.0-beta.3"
Then run npm install to update the version. It should work
from quickstart-ng2.
Yep, the configClass wasn't working nicely with angular DI. Instead, just pass a function as config: configFn
which will receive the UIRouter instance.
from quickstart-ng2.
Related Issues (20)
- Will there be any LazyLoading or loadChildren for dynamic loading of routes
- Lite server could not start HOT 1
- lazyLoad error. HOT 3
- Beta.3? HOT 2
- Why we need ui-router-visualizer? HOT 1
- error: 'zone.js:484 Unhandled Promise rejection: Zone.assertZonePatched is not a function' after upgrading to 2.0.0 HOT 3
- core.umd.js:3462 EXCEPTION: Uncaught (in promise): TransitionRejection(type: 2, message: The transition has been superseded by a different transition, detail: 'app.baz'{}) HOT 2
- Angular 2.1.0 support? HOT 1
- running HOT 1
- can someone adress this issue? HOT 1
- Nested Views As Home "/" Route HOT 1
- Angular-CLI and The future of quickstart-ng2 repository HOT 1
- Unmet Peer Dependency Installation error HOT 1
- Update with ^4.0.0 Angular 2 version HOT 1
- UI router ng2 not working for ng4 - which is backward compatible?! HOT 5
- ui-router ng2 and Angular 4: almost got lazy loading working...need help HOT 10
- Simplified state definition
- Trouble getting start with repo
- Action required: Greenkeeper could not be activated 🚨
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quickstart-ng2.