Hello guys ,
I developped a large application photos managements with Ionic
the inputs of my application is not always put at the right place according to the keyboard (suggestions lists etc).
I told myself that I was going to manage the positions with $ionicScrollDelegate when the input will be focus.
And yesterday , i had some problem with the $ionicScrollDelegate :s
i have this line of code for the beginning of my js controller :
Phory.controller('MyCtrl', ['$scope', '$ionicModal', '$ionicViewSwitcher', function ($scope, $ionicModal, $ionicViewSwitcher,$ionicScrollDelegate, $translate) {
$scope.scrollTop = function() {
$ionicScrollDelegate.scrollTop();
};
And this line of code for the html side :
<button class="button button-add clear" ng-click="scrollTop()"> {{'shareStoryButton' | translate}} </button>
** when I click the button I have this error happens : **
( http://img11.hostingpics.net/pics/502671error.jpg ) :
TypeError: Cannot read property ‘scrollTop’ of undefined
at l.$scope.scrollTop (app.js:287)
at ionic.bundle.min.js:229
at ionic.bundle.min.js:386
at l.$eval (ionic.bundle.min.js:156)
at l.$apply (ionic.bundle.min.js:157)
at HTMLButtonElement. (ionic.bundle.min.js:386)
at HTMLButtonElement.c (ionic.bundle.min.js:63)
at n (ionic.bundle.min.js:22)
at t (ionic.bundle.min.js:22)
at HTMLDocument.l (ionic.bundle.min.js:22)ionic.bundle.min.js:133 (anonymous function)ionic.bundle.min.js:107 (anonymous function)ionic.bundle.min.js:157 l.$applyionic.bundle.min.js:386 (anonymous function)ionic.bundle.min.js:63 cionic.bundle.min.js:22 nionic.bundle.min.js:22 tionic.bundle.min.js:22 l
I use as script :
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>Phory</title>
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<!-- General styles -->
<link href="css/style.css" rel="stylesheet">
<link href="css/extraStyles.css" rel="stylesheet">
<link href="css/styleIos.css" rel="stylesheet">
<!-- Roboto Google font -->
<link href='css/roboto.css' rel='stylesheet' type='text/css'>
<script src="js/ionic.bundle.min.js"></script>
<script src="js/angular-translate.min.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
<!-- your app's js -->
<script type="text/javascript" src="js/app.js"></script>
</head>
the beginning of the ionic.bundle.min.js :
* Ionic, v1.0.0-rc.2
* A powerful HTML5 mobile app framework.
* http://ionicframework.com/
thank you in advance for the help !!!
SOLVED : [‘$scope’, ‘$ionicModal’, ‘$ionicViewSwitcher’, … useless just to fuck the shit ^^"