Witam,
mam problem ze zmienna $rootScope, jak poprawnie jej użyć w poniższym przykładzie ?:
class LoginController {
constructor($scope, $location, $rootScope) {
this.$scope = $scope;
this.$rootScope = $rootScope;
this.$scope.username = null;
this.$rootScope.password = null;
}
submit(){
if(this.$scope.username === 'admin' && this.$rootScope.password === 'admin'){
this.zzz = 'Logowanie przebiegło pomyslnie';
}else{
alert('Logowanie nie przebiegło pomyslnie');
}
}
}
export default LoginController;
Drugi problem mam z $http mianowicie chcę pobrać json z : http://localhost:82/database.json, jednakże przy tej próbie otrzymuje informację:
"...SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data..."
this.$http.get('http://localhost:82/database.json').
success(function (response) {
alert('Stop');
this.$scope.persons = response.records;
});