Why would I see "$ionicViewService is deprecated" warning in console?

I’ve upgraded an app to version 1.0.0-beta.14 and now see the following warning in the console when previewing the app in a browser:

$ionicViewService is deprecated, please use $ionicHistory instead: http://ionicframework.com/docs/nightly/api/service/$ionicHistory/

I’m unclear (actually, clueless) as to why this would now showing in console - I wasn’t aware I was using $ionicViewService, and looking at the documentation for $ionicHistory doesn’t help.

Perhaps someone could help by letting me know what directives are affected by $ionicViewService being deprecated.


Are you injecting $ionicView into a controller? This error can occur when you do that.

The way to use $ionicView is as follows:

$scope.$on('$ionicView.enter', function() {
    // any code you want to execute on enter of the view

Thanks @brandyshea - I was injecting into a controller, though not actually using it. I probably saw it in some demo code and thought it was required. Now removed, the warning is no longer showing.

1 Like