Linux:从kill命令中获取退出代码(Linux: get the exit code from the kill command)
如果我使用
kill
命令向进程发送一个SIGTERM
信号,我期望一个退出代码,但是在杀死一个进程后运行下面的命令时我总是得到0(零):echo $?
根据这篇文章的答案,当向进程发送一个
SIGTERM
时,我应该得到143: 始终应用Java结束与“退出143”Ubuntu但我没有得到退出代码。 为什么?
If I send a
SIGTERM
signal to a process using thekill
command, I expect an exit code, but I always get 0 (zero) when running the below command after killing a process:echo $?
According to the answer in this post, I should get 143 when sending a
SIGTERM
to a process: Always app Java end with "Exit 143" UbuntuBut I don´t get that exit code. Why?
原文:https://stackoverflow.com/questions/8256511
最满意答案
您可以使用
ng-repeat
创建链接以根据点击显示酒店,如下面的演示或此小提琴中所示 。对于类别,您可以使用另一个
ng-repeat
(未在演示中添加)。angular.module('demoApp', []) .controller('mainController', MainController); function MainController() { this.hotels = [ { "id" : 1, "name": "some hotel 1", "category" : [{ "id" : 1, "hotel_id" : 1, "name" : "Cat name 1", "bnb" : "yes", "simple" : "yes" }] }, { "id" : 2, "name": "some hotel 2", "category" : [{ "id" : 1, "hotel_id" : 2, "name" : "Cat name 1", "bnb" : "yes", "simple" : "yes" }] } ]; this.selectedHotel = this.hotels[0]; }
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <div ng-app="demoApp" ng-controller="mainController as mainCtrl"> <a href="#" ng-repeat="hotel in mainCtrl.hotels" ng-click="mainCtrl.selectedHotel = hotel">{{hotel.name}}</a> <div> Hotel name: {{mainCtrl.selectedHotel.name}} Category: {{mainCtrl.selectedHotel.category}} </div> </div>
You could use
ng-repeat
to create the links to display the hotel based on the click like in the following demo or in this fiddle.For the categories you can use another
ng-repeat
(not added in the demo).angular.module('demoApp', []) .controller('mainController', MainController); function MainController() { this.hotels = [ { "id" : 1, "name": "some hotel 1", "category" : [{ "id" : 1, "hotel_id" : 1, "name" : "Cat name 1", "bnb" : "yes", "simple" : "yes" }] }, { "id" : 2, "name": "some hotel 2", "category" : [{ "id" : 1, "hotel_id" : 2, "name" : "Cat name 1", "bnb" : "yes", "simple" : "yes" }] } ]; this.selectedHotel = this.hotels[0]; }
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <div ng-app="demoApp" ng-controller="mainController as mainCtrl"> <a href="#" ng-repeat="hotel in mainCtrl.hotels" ng-click="mainCtrl.selectedHotel = hotel">{{hotel.name}}</a> <div> Hotel name: {{mainCtrl.selectedHotel.name}} Category: {{mainCtrl.selectedHotel.category}} </div> </div>
相关问答
更多-
根据AngularJS中的Array中的值隐藏和显示元素(Hide and Show elements based on values in Array in AngularJS)[2023-02-23]
向控制器添加一个新属性,该属性将存储所选的设计选项: $scope.designOption = 4; // default to Full 在视图中将绑定添加到此属性: 将ng-show指令添加到复选框标签:如何根据分页找到id(how to find id based on pagination)[2023-06-17]
在研究了jQuery DataTables的分页后,发现了很多很棒的东西,比如这个家伙Todd。 A. Wood在使用PetaPoco进行数据加载时做了很好的工作。 但即使与您的要求相比,它也很复杂。 我必须承认DataTables有很棒的文档,我找到了答案分页插件 。 所以神奇的功能是: fnPagingInfo 。 但是,为了获取页面信息,必须通过fnDrawCallback捕获数据表呈现(或重新呈现)事件。 无论如何你应该嵌入以下代码: