1

I am using the typescript definitions installed with tsd to work with Angular2's preview. Recently they have released 2.0.0-alpha.40 and now my routing doesn't work anymore. I have taken a look at the examples on angular's site and they are referencing for example routerBindings from angular2/router, but the current angular2/router does not define this function. I did ran an update and a reinstall with tsd but nothing changes. How do I know if the angular2 typescript definition published are up to date with the javascript version releases?

3
  • 1
    They stopped using tsd from alpha-41. typings: *.d.ts files are now bundled with npm package, tsd link or tsd install no longer needed. Commented Oct 13, 2015 at 21:28
  • As Jesse said, it comes with npm package now docs.google.com/document/d/… Commented Oct 14, 2015 at 0:08
  • Thanks guys, appreciated. Commented Oct 14, 2015 at 5:34

2 Answers 2

1

Just get the typings via npm install

Put this in your package.json:

"angular2": "^2.0.0-alpha.42"

Among other things - they have renamed routerBindings to ROUTER_PROVIDERS.

Here is an updated write-up of routing in Angular 2.0: http://www.syntaxsuccess.com/viewarticle/routing-in-angular-2.0

You can see working samples here:http://www.syntaxsuccess.com/viewarticle/angular-2.0-examples

Sign up to request clarification or add additional context in comments.

1 Comment

The samples you linked to use HashLocationStrategy which is only used to match fragments (ex /url/path#fragment).
0

This was changed in [email protected]

routerInjectables was renamed to ROUTER_BINDINGS

ROUTER_BINDINGS was then renamed to ROUTER_PROVIDERS

Use ROUTER_PROVIDERS

It includes:

  • RouteRegistry - the registry of defined routes
  • LocationStrategy = PathLocationStragety - match routes by path

This is basically a shortcut to bootstrap your Router with a default setup.

For example:

@Component ({
...
})
@View ({
...
})
@RouteConfig ({
...
})
class App {}

bootstrap(App, [ ROUTER_PROVIDERS ]);

Sources:

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.