0

I am trying to write a ionic app based on the sidemenu basis. One view that I am creating is a login view on which the sidemenu should be deactivated. Therefore I need the dependency variable $ionicView.
This leads to the error
Unknown provider: $ionicViewProvider <- $ionicView <- LoginController

The same error appears when trying to access $ionicConfigProvider.

Login.module.js:

 angular.module("Login", ['ionic']); 

Login.Controller.js:

angular.module("Login") .controller("LoginController", function($ionicSideMenuDelegate, $ionicView){ var thisRef = this; thisRef.Username = ""; thisRef.Password = ""; $ionicView.beforeEnter(function() { $ionicSideMenuDelegate.canDragContent(false); }); $ionicView.beforeLeave(function(){ $ionicSideMenuDelegate.canDragContent(true); }); }); 

2 Answers 2

1

i have the same problem with my ionic sidemenu app.

To fix this problem i followed the ionic documentation: Ionic View

And update my ionic bundle version lib to the final version.

You can update in bower.json file, change the version to ionic-bower#1.3.1"

See this codepen to help you

<script src="//code.ionicframework.com/1.3.1/js/ionic.bundle.js"></script> 

Code Pen

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

Comments

0

From what I conclude from the Ionic forum (http://forum.ionicframework.com/t/how-to-use-ionicview-with-ionic-nightly/13666), is that you don't inject $ionicView directly in your controller, but rather use it in your controller.

angular.module("Login") .controller("LoginController", function($ionicSideMenuDelegate){ $scope.$on('$ionicView.beforeEnter', function() { //Do whatever you want here }); var thisRef = this; thisRef.Username = ""; thisRef.Password = ""; $ionicView.beforeEnter(function() { $ionicSideMenuDelegate.canDragContent(false); }); $ionicView.beforeLeave(function(){ $ionicSideMenuDelegate.canDragContent(true); }); }); 

Read the documentation on what is possible with $ionicView: http://ionicframework.com/docs/nightly/api/directive/ionView/ under 'View LifeCycle and Events'

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.