I'm carrying a $ ionicPopup with a variable that I get from my webservice. The problem that I have is not as filling into a variable. I leave my code:
if(data.Count > 0){
$scope.areas = data.Area;
var contentHtml = '<ul ng-repeat="area in data.Area"><li>{{area.name}}</li></ul>';
$ionicPopup.show({
title: 'Areas disponibles',
subTitle: '',
content: contentHtml,
scope: $scope,
buttons: [{
text: 'Salir',
onTap: function(e) {
}
}]
})
}
This obviously does not work and I'm looking to be able to load that variable in the ng-repeat, if someone could help me appreciate it.
In your HTML you can only use scoped var (ie : $scope.data mean that data is scoped).
data.Area isn't accessible into your html.
Doing this :
$scope.areas = data.Area;
You make it accessible as "areas" in your html.
Using ng-repeat like this :
ng-repeat="area in areas"
Will do the trick.