通过模态显示 json 数据或使用 ng-click table
displaying json data via modal or table with ng-click
显示 json 连接时需要帮助。当我按下用户名时,我需要在模式或 table 中显示该特定用户的详细信息。关于如何使用 onclick 执行此操作的任何建议?
var mainApp= angular.module("mainApp", []);
mainApp.controller('TableFilterController', function($scope) {
$scope.clickMe = function(p) {
$scope.selected = p;
}
$scope.isSelected = function(p) {
return $scope.selected === p;
}
$scope.details = [
{
name : 'Mercury',
age : 0.4,
mass : 0.055,
descp : 'it is the hottest planet',
},
可以使用$modal
的bootstrap,
弹出对话框
$modal.open({
templateUrl: 'myModalContent.html',
backdrop: true,
windowClass: 'modal',
controller: function($scope, $modalInstance, $log) {
$scope.selected = p;
$scope.submit = function() {
$log.log('Submiting user info.');
$log.log($scope.selected);
$modalInstance.dismiss('cancel');
}
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};
},
resolve: {
user: function() {
return $scope.selected;
}
}
});
显示 json 连接时需要帮助。当我按下用户名时,我需要在模式或 table 中显示该特定用户的详细信息。关于如何使用 onclick 执行此操作的任何建议?
var mainApp= angular.module("mainApp", []);
mainApp.controller('TableFilterController', function($scope) {
$scope.clickMe = function(p) {
$scope.selected = p;
}
$scope.isSelected = function(p) {
return $scope.selected === p;
}
$scope.details = [
{
name : 'Mercury',
age : 0.4,
mass : 0.055,
descp : 'it is the hottest planet',
},
可以使用$modal
的bootstrap,
$modal.open({
templateUrl: 'myModalContent.html',
backdrop: true,
windowClass: 'modal',
controller: function($scope, $modalInstance, $log) {
$scope.selected = p;
$scope.submit = function() {
$log.log('Submiting user info.');
$log.log($scope.selected);
$modalInstance.dismiss('cancel');
}
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};
},
resolve: {
user: function() {
return $scope.selected;
}
}
});