[ts] can't find module @angular/router

How can I implement those:
canReuse, canDeactivate, onActivate, onReuse, onDeactivate
in ionic 2?

import {Routes,ROUTER_PROVIDERS,ROUTER_DIRECTIVES} from '@angular/router';

is giving me the error:

[ts] can't find module @angular/router

Do you have the package ?

"@angular/router": "3.0.0-alpha.8",

"@angular/router": "2.0.0-rc.3"
and then
ionic build
and then even
npm update

Maybe in angular 2.0.0-rc.3 the router was a part of common or core?
I whant to update my ionic project to angular 3.0.0-alpha.8 but don’t know if the framework support this version (or the current beta 10 version)

Terns out there’s no “@angular/router”: “2.0.0-rc.3” repository, only fro “@angular/router”: “3.0.0”

Just need to remove that from the change log.

The angular Router is still very much a WIP and is not in a usable state right now. So please do not try mixing it with ionic, as it will not work.

O.K.

Can you provide me with some good example of your router usage?

I already know how to navigate with parqams:

this.nav.push(ItemDetailsPage, {
item: item
});

But how can I do a angular 1.X like resolve behavior if not with:
canReuse, canDeactivate, onActivate, onReuse, onDeactivate

And another question:
When (if ever) would your CLI be compatible with Angular CLI best practices in terms of Project structure etc?
When do you think you’ll upgrade to the newest angular packages? Are you waiting for things to stable out there?

These a features currently being worked on, so they should be possible soon.

CLI: not sure if we would. It’s a very complicated project setup in my opinion and it creates a lot of confusion. Who knows those, maybe we’ll find some middle ground.

Angular Package: We have our nightly builds up to date with the latest RC, so when we feel like it’s time to cut a release, we’ll update all of our starters to use the latest stuff.

1 Like