Hier ist mein Controller:Ionic/AngularJS Änderung Controller zu einem globalen Variable
(function() {
var app= angular.module('app');
app.controller('recommendedJobsCtrl', ['$scope', function(dataShare,$q,$scope, $ionicSideMenuDelegate,$window,$http,$timeout) {
// passes contents to jobDetails to be rendered and displayed
window.post = function($event, res){
console.log(angular.element($event.target).parent());
dataShare.sendData(res)
}
/**
* handles pagination
*loads first 3 pages
**/
var i=1;
window.result=[];
window.noMoreItemsAvailable=false;
window.loadMore = function()
{
console.log('here')
if(i<4)
{
$http.get("http://test.website.com/api/search/"+i).success(function(response)
{
i++;
$scope.result=$scope.result.push(response);
console.log(response);
$timeout(function()
{
$scope.result = response
});
$scope.$broadcast('scroll.infiniteScrollComplete');
});
}else
{
$scope.noMoreItemsAvailable=true;
}
}
]);
}());
ich gelesen, dass mein Controller unter ‚Benutzer streng‘ war, so dass es nicht die Variablen oder Funktionen zugreifen können. Also habe ich das Wort "window" platziert, um es global zu machen. Aber jetzt greift es nicht auf die Funktion zu, weil die Konsole nicht drucken wird. Wie behebe ich das?
danke! es funktionierte – noor