在我的AngularJS应用程序中,我正在执行以下操作
$http.get('/plugin/' + key + '/js').success(function (data) {
if (data.length > 0) {
console.log(data);
// Here I would also need the value of 'key'
}
});
Run Code Online (Sandbox Code Playgroud)
现在我需要访问key成功回调中的值,即我需要知道在get()请求发出时它具有哪个值.
任何"最佳实践"如何做到这一点?
PS:我可以做到以下几点,但有更好的方法吗?
var key = config.url.split('/')[2];
Run Code Online (Sandbox Code Playgroud) 在Python中,我启动了一个新的进程Popen(),工作正常.现在,在子进程中,我想查找父进程的进程ID.
实现这一目标的最佳方法是什么,也许我可以通过Popen构造函数传递PID ,但是如何?或者有更好的方法吗?
PS:如果可能,我会优先使用标准库来解决问题.