Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

When I run my ionic app on device geting this error

$
0
0

TypeError: $browser.addPollFn is not a function
at Object. (angular-cookies.js:60)
at Object.invoke (ionic.bundle.js:13282)
at Object.enforcedReturnValue as $get
at Object.invoke (ionic.bundle.js:13282)
at ionic.bundle.js:13100
at getService (ionic.bundle.js:13241)
at invoke (ionic.bundle.js:13273)
at Object.instantiate (ionic.bundle.js:13290)
at Object. (ionic.bundle.js:13151)
at Object.invoke (ionic.bundle.js:13282)

controllers.js
This is my controllers file.

angular.module('starter.controllers', ['ngRoute','ngCookies'])

//.config(function($routeProvider) {
// $routeProvider
// .when('/', {
// templateUrl:'login.html'
// })
// .when('/app/dashboard', {
// resolve: {
// "check": function($location, $rootScope) {
// if(!$rootScope.loggedIn){
// $location.path('/');
// }
// }
// },
// templateUrl:'dashboard.html'
// })
// .otherwise({
// redirectTo: '/'
// });
//})

.directive('flippy', function() {
return {
restrict: 'EA',
link: function($scope, $elem, $attrs) {

            var options = {
                flipDuration: ($attrs.flipDuration) ? $attrs.flipDuration : 400,
                timingFunction: 'ease-in-out',
            };

            // setting flip options
            angular.forEach(['flippy-front', 'flippy-back'], function(name) {
                var el = $elem.find(name);
                if (el.length == 1) {
                    angular.forEach(['', '-ms-', '-webkit-'], function(prefix) {
                        angular.element(el[0]).css(prefix + 'transition', 'all ' + options.flipDuration/1000 + 's ' + options.timingFunction);
                    });
                }
            });

            /**
             * behaviour for flipping effect.
             */
            $scope.flip = function() {
                $elem.toggleClass('flipped');
            }

        }
    };
})

.controller('AppCtrl', function($scope, $ionicModal, $timeout) {

// With the new view caching in Ionic, Controllers are only called
// when they are recreated or on app start, instead of every page change.
// To listen for when this page is active (for example, to refresh data),
// listen for the $ionicView.enter event:
//$scope.$on('$ionicView.enter', function(e) {
//});

})

.controller('LoginCtrl', function($scope, LoginService, $ionicPopup, $state, $cookies, $rootScope) {
$scope.data = {};

$scope.create = function () {
    $state.go('app.signup');
}

$scope.forgot = function () {
    $state.go('app.forgotpassword');
}

$scope.login = function () {
    LoginService.loginUser($scope.data.user_email, $scope.data.password).success(function (data) {
        var wat = $rootScope.session;
        console.log(wat);
        $state.go('app.dashboard');
    }).error(function (data) {
        var alertPopup = $ionicPopup.alert({
            title: 'Login failed!',
            template: 'Please check your credentials!'
        });
    });
}

})

//.controller('LoginCtrl', function($scope, $location, $rootScope, $http, $ionicPopup) {
// $scope.submit = function(){
//
// if($scope.username == 'admin' && $scope.password == 'admin'){
// $rootScope.loggedIn = true;
// $location.path('/app/dashboard');
// } else {
// var alertPopup = $ionicPopup.alert({
// title: 'Login failed!',
// template: 'Please check your credentials!'
// });
// }
// };
//
//
//})

.controller('SignUpCtrl', function($http, $scope, $state) {

  $scope.data = {};

$scope.create = function () {
    console.log($scope.data.user_email);
    $http.get('http://vanhalterenwatersport.nl/van/webservice/appc/register.php', { params: { prefix: $scope.data.user_name_prefix, fname: $scope.data.user_fname, lname: $scope.data.user_lname, pass: $scope.data.user_password, email: $scope.data.user_email, mobno: $scope.data.user_mobno, address: $scope.data.user_address, postcode: $scope.data.user_postcode, city: $scope.data.user_city } });
    console.log($scope.data.user_email);
    $state.go('login');
}

})

.controller('ForgotpasswordCtrl', function($scope, $stateParams) {

})

.controller('EditCtrl', function ($http, $scope, $rootScope, $state) {

$scope.user_id = 1;
    $http.get('http://vanhalterenwatersport.nl/van/webservice/appc/user.php?action=user_detail&user_id='+$scope.user_id).then(function(resp) {
     $scope.user = resp.data;
    console.log('Success', resp);
    // For JSON responses, resp.data contains the result
  }, function(err) {
    console.error('ERR', err);
    // err.status will contain the status code
  });

$scope.edit = function () {
    $http.get('http://vanhalterenwatersport.nl/van/webservice/appc/user.php?action=user_detail&user_id=1', { params: { prefix: $scope.user.user_name_prefix, fname: $scope.user.user_fname, lname: $scope.user.user_lname, email: $scope.user.user_email, mobno: $scope.user.user_mobno, address: $scope.user.user_address, postcode: $scope.user.user_postcode, city: $scope.user.user_city, gender: $scope.user.user_gender, user_id: $rootScope.session } });
    $state.go('app.mijnprofiel');
}

})

.controller('Mijnprofiel', function ($scope, $http, $rootScope, $state, $ionicPopup) {

 $scope.user_id = 1;
    $http.get('http://vanhalterenwatersport.nl/van/webservice/appc/user.php?action=user_detail&user_id='+$scope.user_id).then(function(resp) {
     $scope.user = resp.data;
    console.log('Success', resp);
    // For JSON responses, resp.data contains the result
  }, function(err) {
    console.error('ERR', err);
    // err.status will contain the status code
  });

// $http.get("http://vanhalterenwatersport.nl/van/webservice/appc/user.php", { params: { "action": "user_detail", "user_id": $scope.user_id } })
// .success(function(resp) {
// $scope.userdata = resp.data;
// })
// .error(function(resp) {
// alert("ERROR");
// });

$scope.edit = function () {
    $state.go('editprofile');
}

})

.controller('PlaylistsCtrl', function($http, $scope, $rootScope, $state, detailService) {

 //$scope.news_id = 2;
    $http.get('http://vanhalterenwatersport.nl/van/webservice/appc/news.php?action=news').then(function(resp) {
     $scope.playlists = resp.data;
    console.log('Success', resp);
    // For JSON responses, resp.data contains the result
  }, function(err) {
    console.error('ERR', err);
    // err.status will contain the status code
  });

$scope.getDetail=function(ObjectData){
detailService.itemName=ObjectData.news_heading;
detailService.itemface=ObjectData.news_img;
detailService.itemdescription=ObjectData.news_data;
detailService.itemlastText=ObjectData.news_created;
}
})

.controller('PlaylistCtrl', function($scope,$stateParams,detailService) {
$scope.detailService=detailService;
})

.controller('DashboardCtrl', function($scope, $stateParams) {

})

.controller('ContactCtrl', function($scope, $http) {

 $scope.data = {};

$scope.submit = function(){
    var link = 'http://vanhalterenwatersport.nl/van/webservice/appc/contact_us.php';

    $http.post(link, {title : $scope.data.enq_title, firstname : $scope.data.enq_first_name, lastname : $scope.data.enq_last_name, eemail : $scope.data.enq_email, telephone : $scope.data.enq_telephone, contactmethod : $scope.data.enq_contact_method, message : $scope.data.enq_message,}).then(function (res){
        $scope.response = res.data;

    });
};

})

.controller('MapCtrl', function($scope, $ionicPlatform, $cordovaGeolocation, $ionicLoading) {

$ionicPlatform.ready(onDeviceReady);

function onDeviceReady() {

    $ionicLoading.show({
        template: '<ion-spinner icon="bubbles"></ion-spinner><br/>Acquiring location!'
    });

    var posOptions = {
        enableHighAccuracy: true,
        timeout: 50000,
        maximumAge: 0
    };
    $cordovaGeolocation.getCurrentPosition(posOptions).then(function (position) {
        var lat  = position.coords.latitude;
        var long = position.coords.longitude;

        var myLatlng = new google.maps.LatLng(28.580004, 77.319665);

        var mapOptions = {
            center: myLatlng,
            zoom: 16,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };



        var map = new google.maps.Map(document.getElementById("map"), mapOptions);

        $scope.map = map;
        $ionicLoading.hide();

    }, function(err) {
        $ionicLoading.hide();
        console.log(err);
    });
}

});

services.js

angular.module('starter.services', ['ngCookies'])

.service('LoginService', function ($q, $http, $cookies, $rootScope) {
return {
loginUser: function (name, pw) {
var deferred = $q.defer();
var promise = deferred.promise;
var user_data = $http.get("http://vanhalterenwatersport.nl/van/webservice/appc/login.php");
user_data.then(function (result) {
var user = result.data;
log(user);
console.log($rootScope.session);
})
function log(user) {
var i;
var isloggedin = false;
for (i = 0; i < user.length; i++) {
if (name == user[i].user_email && pw == user[i].password) {
isloggedin = true;
id = user[i].iduser;
$rootScope.session = id;
break;
}
}
if (isloggedin) {
deferred.resolve('Welcome ' + name + '!');
} else {
deferred.reject('Wrong credentials.');
}
}
promise.success = function (fn) {
promise.then(fn);
return promise;
}
promise.error = function (fn) {
promise.then(null, fn);
return promise;
}
return promise;
}
}
})

.service('detailService', function() {
this.itemName;
this.itemface;
this.itemdescription;
this.itemlastText;
})

.factory('NewAccount', function ($http) {
return {
create: function (prefix, fname, lname, pass, email, mobno, address, postcode, city) {
return $http.get('http://vanhalterenwatersport.nl/van/webservice/appc/register.php', { params: { prefix: prefix, fname: fname, lname: lname, pass: pass, email: email, mobno: mobno, address: address, postcode: postcode, city: city } })
}
};
})


Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>