Angular rc warning

A heads-up for people toying with upgrading projects to the release candidate versions of Angular2:

They moved modules from angular2 to @angular. If you accidentally mix and match versions (for example, you forgot to update your bootstrap file, but you did update your application file), you are in for pain. You will get obscure errors about directive annotations not being present on your application class.

I recommend completely removing the old ‘angular2’ directory out of node_modules. That way you will break the build until you update everything in sync.

1 Like

I really don’t recommend updating angular 2 independently from ionic2. We haven’t released an update yet as there are several breaking changes. This will cause your app to break, so we want to make sure we fix what ever broke before releasing.


After upgrading to Ionic Beta 7 which is on Angular rc 1, I am facing this problem. The problem is I am unable to load any @page without getting the “No Directive found for MyPage” error. No matter if I use Nav.setRoot or even having the root property of the <ion-nav> being set through binding.

However none of my code is referring to angular2 package dependancies. In fact I have remove the angular2 npm package and only have the @angular packages. But still I see that angular2 package is being installed. I am going to go through the dependancies to see if they require any upgrading of angular. Any idea/improvement on this so far?


What I did was to physically remove the angular2 directory from node_modules, which helped me track down the offending dependencies.

1 Like

read the changelog for the ionic beta7 release. There are more breaking changes :wink:

Like: IonicApp --> there is no getComponent-method anymore. You should use @ViewChild decorator to get the NavController in your App class.

1 Like

I have removed the angular2 from package.json and made sure the folder isnt there as well. Managed to get app running. However the problem persists. When using Nav.setRoot with any @page the following error occurs

EXCEPTION: No Directive annotation found on UserLogin
No Directive annotation found on UserLogin
at new BaseException (exceptions.js:17)
at DirectiveResolver.resolve (directive_resolver.js:31)
at CompileMetadataResolver.getDirectiveMetadata (metadata_resolver.js:55)
at RuntimeCompiler.resolveComponent (runtime_compiler.js:34)
at DynamicComponentLoader_.loadNextToLocation (dynamic_component_loader.js:40)
at NavController.loadPage (nav-controller.js:1262)
at NavController._render (nav-controller.js:915)
at NavController._transition (nav-controller.js:878)
at NavController.setPages (nav-controller.js:321)
at NavController.setRoot (nav-controller.js:211)BrowserDomAdapter.logError @

1 Like

Thanks mate. I had done that change, but I guess it didn’t help.

protected nav: Nav;

<ion-nav #navContainer ></ion-nav>

1 Like

Sort of a long shot, but if you’re using TypeScript, try wiping all build directories, enabling noEmitOnError in tsconfig.json and rebuilding. The defaults sort of allow one to muddle through with stale and broken code without knowing it sometimes.

1 Like

Thanks again. I managed to get rid of this though I dont know what was the cause still. I used the sample app to replace parts of the code and try. Nothing was wrong with the code. However the problem went away after switching from webpack to browserify.

1 Like