I'm intending to create a salesforce app using angularjs and ionic framework. I've been trying in vain to visualize an arbitrary array in a modal window and failing. Have asked elsewhere but no luck. My plunkr is: http://plnkr.co/edit/wZVItjUwYPExllECYzM7
As you can see, clicking "display" brings up the window but the array is not displayed.
angular.module('starter.controllers', ['ngGrid'])
.controller('AppCtrl', function($scope) {})
.controller('DisplayCtrl', function($scope, ModalFactory) {
$scope.array = []; //initialize to null
$scope.run = function() {
$scope.array = $scope.array.concat( [{ //arbitrary array of UNKNOWN fields
"a": 0,
"b": 1
}, {
"a": 1,
"b": 8
}, {
"a": 2,
"b": 5
}, {
"a": 3,
"b": 7
}, {
"a": 4,
"b": 0
}, {
"a": 5,
"b": 3
}, {
"a": 6,
"b": 6
}, {
"a": 7,
"b": 4
}, {
"a": 8,
"b": 2
}, {
"a": 9,
"b": 9
}]);
//$scope.array = array;
ModalFactory.init($scope).then(function(modal) {
modal.show();
});
}
});
HTML is
<div class="modal">
<ion-header-bar>
<h1 class="title">output array</h1>
<div class="buttons">
<button class="button button-icon ion-ios7-close-empty" ng-click="closeModal()"></button>
</div>
</ion-header-bar>
<ion-content>
<div ng-grid="{data: 'array'}" class="grid"></div>
</ion-content>
</div>