hi guys,
i am getting this error and i didn’t find whats wrong (still learning )
typeError: Cannot read property ‘get’ of undefined
angular.module('app.services', [])
.factory('EspritService', [function($http){
................
getData: function () {
var parseGrades = function (response) {
alert(response.data);
var tmp = document.implementation.createHTMLDocument();
tmp.body.innerHTML = response.data;
var items = $(tmp.body.children).find('#__VIEWSTATEGENERATOR')[0].value;
var items2 = $(tmp.body.children).find('#__EVENTVALIDATION')[0].value;
var items3 = $(tmp.body.children).find('#__VIEWSTATE')[0].value;
viewStategen = items;
eventValidation = items2;
viewStateval = items3;
return items;
}
return $http.get('https://something.com')
.then(parseGrades);
}
and the controller
.controller('loginCtrl', ['$state','$scope', '$stateParams','EspritService', // The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller
// You can include any angular dependencies as parameters for this function
// TIP: Access Route Parameters for your page via $stateParams.parameterName
function ($state,$scope, $stateParams,EspritService) {
var vm = this;
vm.doLogin = function () {
EspritService.getData()
.then(function(response) {
//will implement later
/* EspritService.login(vm.cin)
.then(onSuccess);*/
});
}
}])