如何通过angular2使用linux终端 [英] How to use the linux terminal through angular2

查看:73
本文介绍了如何通过angular2使用linux终端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Angular 2 的新手,我想知道 angular 2 中是否有任何方法可以使用我的 Linux (Raspbian) 终端.类似于 php 中的一个方法,当我们使用:system("终端中的任何命令");

I am new with Angular 2 and I wonder if there is any method in angular 2 that I could use the terminal of my Linux (Raspbian). Something like to a method in php, when we use the : system("any command in the terminal");

推荐答案

简而言之:不,你不能.Angular 是 UI 框架,在浏览器/客户端执行,即它与您的服务器代码(Rapsberry)无关.您所能做的:在后端创建端点,如果发出 http 请求,它将执行命令.除非您在后端(节点/流星)上使用一些 javascript 服务器,但它与 Angular 本身无关,您必须阅读服务器的文档.

In short: no you cannot. Angular is UI framework, that is executed in browser/client side, i.e. it has nothing to do with your server code (Rapsberry). All you can do: make endpoint on backend, that will execute command if http request made. Unless you are using some javascript server on backend (node/meteor), but again it has nothing to do with Angular itself and you have to read documentation of your server.

如果你的目标是在客户端执行命令行,那么答案仍然是不,你不能",因为浏览器与其他系统隔离,无法从浏览器执行任何系统命令.

If your target is executing command line on client side, so answer is still "no you cannot", as browser is isolated from other system and there is no way to execute any system commands from browser.

这篇关于如何通过angular2使用linux终端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆