I want to use the variable between functions in one controller. Controller: app.controller { .......
$http.get("json.php")
.success(function (response) {
$scope.m = response.p;
$scope.licznikm = $scope.m.length;
$scope.date = new Date();
$scope.openp = function (id, m) {
ngDialog.open({
template : 'formn.php',
className : 'ngdialog-theme-default',
backdrop : 'static',
});
$scope.name = m;
$scope.id = id;
console.log($scope.name); //is OK
console.log($scope.id); // is OK
};
console.log($scope.miasta); //undefined
console.log($scope.id); //undefined
.successis deprecated. You should just use.thenand.catchfor error handling.