我這個plnkr玩:http://plnkr.co/edit/DRJtivCrxQy4s22ntsci顯示NG-電網正確模式
控制器是:
angular.module('starter.controllers', [])
.controller('AppCtrl', function($scope) {})
.controller('DisplayCtrl', function($scope, ModalFactory) {
$scope.array = null; //initialize to null
$scope.run = function() {
var array = [{ //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();
});
}
});
莫代爾通過工廠創建:
angular.module('modalfactory',['ionic'])
.service('ModalFactory', function($ionicModal, $rootScope) {
var init = function($scope) {
var promise;
$scope = $scope;
promise = $ionicModal.fromTemplateUrl('array.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.modal = modal;
return modal;
});
$scope.openModal = function() {
$scope.modal.show();
};
$scope.closeModal = function() {
$scope.modal.hide();
};
$scope.$on('$destroy', function() {
$scope.modal.remove();
});
return promise;
}
return {
init: init
}
})
如果點擊顯示一個模式窗口彈出。我想能夠顯示任何任意數組。 ng-grid不能按我想要的方式工作。我們怎樣才能做到這一點?
Plnkr是:http://plnkr.co/edit/DRJtivCrxQy4s22ntsci?p=info – ginger 2014-12-04 17:18:49